On 8/25/25 8:42 AM, Paul Menzel wrote:
Dear Linux folks,
Trying to get ptcpdump [1] running, I needed to build Linux with BTF
symbols.
```
@@ -5985,11 +5986,22 @@
#
# Compile-time checks and compiler options
#
+CONFIG_DEBUG_INFO=y
CONFIG_AS_HAS_NON_CONST_ULEB128=y
-CONFIG_DEBUG_INFO_NONE=y
+# CONFIG_DEBUG_INFO_NONE is not set
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
-# CONFIG_DEBUG_INFO_DWARF5 is not set
+CONFIG_DEBUG_INFO_DWARF5=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
+# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
+# CONFIG_DEBUG_INFO_SPLIT is not set
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_PAHOLE_HAS_SPLIT_BTF=y
+CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
+CONFIG_DEBUG_INFO_BTF_MODULES=y
+# CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set
+# CONFIG_GDB_SCRIPTS is not set
CONFIG_FRAME_WARN=2048
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_READABLE_ASM is not set
```
This increased the module size quite a bit:
$ du -sh /lib/modules/6.12.4*
128M /lib/modules/6.12.40.mx64.484
1.9G /lib/modules/6.12.43.mx64.485
The increase is mostly due to dwarf. The BTF related sections should be just ~6M.
Searching the WWW, it was suggested to run `INSTALL_MOD_STRIP=1` [2],
bringing it down to 137 MB:
137M /lib/modules/6.12.43.mx64.486
I was under the expression, that BTF symbols are small compared to the
debug symbol types from the past. (Excuse my ignorance about the
terminology and subject.) Is `INSTALL_MOD_STRIP=1` the “recommended”
way to still use BPF/BTF on production systems.
You can use INSTALL_MOD_STRIP=1 to reduce kernel binary size in /lib/modules/... directory.
Kind regards,
Paul
[1]: https://github.com/mozillazg/ptcpdump
[2]:
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/28218/diffs