From 2b51e8397583f911df0616c402a63a23dff03ed8 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sun, 26 Jul 2020 07:51:34 -0700 Subject: [PATCH] build: add option KERNEL_DEBUG_INFO_BTF 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 Signed-off-by: Felix Fietkau --- config/Config-kernel.in | 15 +++++++++++++++ target/linux/generic/config-5.10 | 2 +- target/linux/generic/config-5.4 | 2 +- target/linux/layerscape/armv8_64b/config-5.4 | 1 - 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 07d65bc465..bd71bcebf2 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -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 diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index dbe3fb91d4..1af195f51f 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -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 diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 1f004a3eeb..cc44b593f4 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -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 diff --git a/target/linux/layerscape/armv8_64b/config-5.4 b/target/linux/layerscape/armv8_64b/config-5.4 index 2d717434d1..2751b25223 100644 --- a/target/linux/layerscape/armv8_64b/config-5.4 +++ b/target/linux/layerscape/armv8_64b/config-5.4 @@ -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 -- 2.30.2