supporting-external-BTF
``conf CONFIGDEBUGINFO=y CONFIGDEBUGINFOBTF=y ``
1.确认内核BTF选项已经打开
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_BTF=y如果内核选项未开启,就需要重新编译内核
- 确认当前内核BTF信息是否可用,如不可用需添加外源BTF信息
若/sys/kernel/btf/vmlinux存在,则BTF可用,可通过bpftool生成vmlinux.h
apt install linux-tools-(uname -r)-generic
apt install linux-tools-generic
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h若/sys/kernel/btf/vmlinux不存在,则BTF不可用,可通过btfhub添加外源BTF信息或生成当前内核的定制化BTF信息
(1)添加外源BTF信息
参考 BTFgen tool to create smaller BTF files
$ git clone git@github.com:aquasecurity/btfhub.git
$ git clone git@github.com:aquasecurity/btfhub-archive.git
$ cd btfhub ; ls
//将克隆的归档文件放入 btfhub 目录
$ rsync -avz ../btfhub-archive/ --exclude=.git* --exclude=README.md ./archive/整个btfhub-archive目录相当庞大,可以单独下载某个BTF归档文件放入btfhub 目录
$ rsync -avz ../5.11.0-1027-azure.btf.tar.xz --exclude=.git* --exclude=README.md ./archive/
sending incremental file list
sent 77 bytes received 12 bytes 178.00 bytes/sec
total size is 144,419 speedup is 1,622.69之后就可以根据某个对应的eBPF 对象生成定制的BTF 文件
#生成定制的 eBPF 对象的 BTF 文件:
$ ./tools/btfgen.sh -a AARCH64 -o $HOME/****.bpf.core.o检查定制的新生成的 BTF 文件及其尺寸
$ find custom-archive | grep ubuntu | tail -10
$ls -lah custom-archive/ubuntu/20.04/x86_64/5.8.0-1041-azure.btf(2)生成当前内核的定制化BTF信息
$ sudo ./example-static
$ sudo ./example-c-static
$ sudo EXAMPLE_BTF_FILE=5.8.0-63-generic.btf ./example-static
$ sudo EXAMPLE_BTF_FILE=5.8.0-63-generic.btf ./example-c-static继续阅读
返回索引
eunomia-bpf:简化并增强eBPF,支持CO-RE[^1]和WebAssembly[^2]
  ![DeepSource](https://deepsource.io/gh/eunomia-bpf/eunomia-bpf/?ref=reposi
上一篇 / 上一页
Install ecli and ecc
- Install the ecli tool for running eBPF program from the cloud:
下一篇 / 下一页
video
- eunomia-bpf: 一个开源的 ebpf 动态加载运行时和开发工具链 - eunomia-bpf:eBPF轻量级开发框架 - wasm-bpf:eBPF 程序的 WebAssembly 编译工具链与运行时 - 使用 WASM 开发和分发 eBPF 应用 - 【达坦科技DatenLord】eunomia-bpf: 结合 wasm 的 ebpf 轻量级开发框架 - eunomia-bpf:超简洁的云端eBPF部署方式
- 最后更新
- 2024年1月26日
- 首次发布
- 2023年8月10日
- 贡献者
- 云微, oluceps
这个页面有帮助吗?