-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbpf-tools: Add documentation about BTFGen integration
Signed-off-by: Mauricio Vásquez <[email protected]>
- Loading branch information
1 parent
50e80e7
commit 5a95333
Showing
1 changed file
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,12 @@ directory. `make clean` will clean up all the build artifacts, including | |
generated binaries. | ||
|
||
Given that the libbpf package might not be available across wide variety of | ||
distributions, all libbpf-based tools are linked statically against a version | ||
distributions, all libbpf-based tools are linked statically against a version | ||
of libbpf that BCC links against (from submodule under src/cc/libbpf). This | ||
results in binaries with minimal amount of dependencies (libc, libelf, and | ||
libz are linked dynamically, though, given their widespread availability). | ||
If your build fails because the libbpf submodule is outdated, try running `git | ||
submodule update --init --recursive`. | ||
libz are linked dynamically, though, given their widespread availability). | ||
If your build fails because the libbpf submodule is outdated, try running `git | ||
submodule update --init --recursive`. | ||
|
||
Tools are expected to follow a simple naming convention: | ||
- <tool>.c contains userspace C code of a tool. | ||
|
@@ -92,3 +92,27 @@ CONFIG_DEBUG_INFO=y | |
kernel build (it comes from dwarves package). Without it, BTF won't be | ||
generated, and on older kernels you'd get only warning, but still would | ||
build kernel successfully | ||
|
||
Running in kernels without CONFIG_DEBUG_INFO_BTF=y | ||
-------------------------------------------------- | ||
|
||
It's possible to run some tools in kernels that don't expose | ||
`/sys/kernel/btf/vmlinux`. For those cases, | ||
[BTFGen](https://lore.kernel.org/bpf/[email protected]) | ||
and [BTFHub](https://github.com/aquasecurity/btfhub) can be used to | ||
generate small BTF files for the most popular Linux distributions that | ||
are shipped with the tools in order to provide the needed information to | ||
perform the CO-RE relocations when loading the eBPF programs. | ||
|
||
```bash | ||
# clone btfhub-archive respository | ||
$ git clone https://github.com/aquasecurity/btfhub-archive/ | ||
|
||
# uncompress all files | ||
$ for file in $(find ./btfhub-archive/ -type f -iregex ".*x86_64.*" -name '*.tar.xz'); do \ | ||
tar xvfJ $file -C $(dirname $file); \ | ||
done | ||
|
||
# compile bcc tools | ||
$ BTF_HUB_ARCHIVE=<path_to_btfhub-archive> ENABLE_MIN_CORE_BTFS=1 make | ||
``` |