build: add option KERNEL_DEBUG_INFO_BTF
authorTony Ambardar <itugrok@yahoo.com>
Sun, 26 Jul 2020 14:51:34 +0000 (07:51 -0700)
committerFelix Fietkau <nbd@nbd.name>
Sat, 11 Dec 2021 12:53:01 +0000 (13:53 +0100)
Generate BTF (BPF Type Format) information from DWARF debug info. This is
embedded in the kernel and exported via sysfs as /sys/kernel/btf/vmlinux.
BTF data enhances kernel portability and introspection for BPF programs.

Selecting this also enables the dwarves host package which provides the
pahole tool used for BTF encoding.

Test using: "bpftool btf dump file /sys/kernel/btf/vmlinux format c"

Also preserve existing behaviour for KERNEL_DEBUG_INFO_REDUCED by adding
it to the "Kernel build options" Kconfig.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
config/Config-kernel.in
target/linux/generic/config-5.10
target/linux/generic/config-5.4
target/linux/layerscape/armv8_64b/config-5.4

index 07d65bc465c5ef7063372e49955968fb96d64ee2..bd71bcebf22ca52fd13ef82175ce4eed3eaae42a 100644 (file)
@@ -368,6 +368,21 @@ config KERNEL_DEBUG_INFO
        help
          This will compile your kernel and modules with debug information.
 
+config KERNEL_DEBUG_INFO_BTF
+       bool "Enable additional BTF type information"
+       default n
+       depends on KERNEL_DEBUG_INFO
+       depends on !HOST_OS_MACOS
+       select DWARVES
+       help
+         Generate BPF Type Format (BTF) information from DWARF debug info.
+         Turning this on expects presence of pahole tool, which will convert
+         DWARF type info into equivalent deduplicated BTF type info.
+
+config KERNEL_DEBUG_INFO_REDUCED
+       def_bool !KERNEL_DEBUG_INFO_BTF
+       depends on KERNEL_DEBUG_INFO
+
 config KERNEL_DEBUG_LL_UART_NONE
        bool
        default n
index dbe3fb91d4315b10e689f74fe6d51ca8ffe6c700..1af195f51fdb27f566e006f607784d62cbbc10c6 100644 (file)
@@ -1272,7 +1272,7 @@ CONFIG_DEBUG_FS_ALLOW_ALL=y
 # CONFIG_DEBUG_INFO_BTF is not set
 # CONFIG_DEBUG_INFO_COMPRESSED is not set
 # CONFIG_DEBUG_INFO_DWARF4 is not set
-CONFIG_DEBUG_INFO_REDUCED=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
 # CONFIG_DEBUG_INFO_SPLIT is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_KMEMLEAK is not set
index 1f004a3eeb70aa94293d43c4e464d27980a4dff6..cc44b593f4ae3bf12f7fc3782be068c24214db8f 100644 (file)
@@ -1194,7 +1194,7 @@ CONFIG_DEBUG_FS=y
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_DEBUG_INFO_BTF is not set
 # CONFIG_DEBUG_INFO_DWARF4 is not set
-CONFIG_DEBUG_INFO_REDUCED=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
 # CONFIG_DEBUG_INFO_SPLIT is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_KMEMLEAK is not set
index 2d717434d18d37eb5acb3a60c542b0910db3e2c9..2751b2522315f2a3f0df61f6f6fa632e0acb10df 100644 (file)
@@ -173,7 +173,6 @@ CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_DEBUG_INFO_REDUCED is not set
 CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_DECOMPRESS_BZIP2=y
 CONFIG_DECOMPRESS_GZIP=y