2
1
Эх сурвалжийг харах

linux: add BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE

CONFIG_DEBUG_BTF_INFO relies on pahole, so kernel DWARF are converted to BTF.
If CONFIG_DEBUG_BTF_INFO is set and BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE not,
an error message is shown and .config is not written.

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Francis Laniel 3 жил өмнө
parent
commit
2da2f359db
2 өөрчлөгдсөн 24 нэмэгдсэн , 0 устгасан
  1. 12 0
      linux/Config.in
  2. 12 0
      linux/linux.mk

+ 12 - 0
linux/Config.in

@@ -470,6 +470,18 @@ config BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF
 	  CONFIG_UNWINDER_ORC=y, please install libelf-dev,
 	  CONFIG_UNWINDER_ORC=y, please install libelf-dev,
 	  libelf-devel or elfutils-libelf-devel".
 	  libelf-devel or elfutils-libelf-devel".
 
 
+config BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE
+	bool "Needs host pahole"
+	help
+	  Some Linux kernel configuration options (such as
+	  CONFIG_DEBUG_INFO_BTF) require building a host program
+	  called pahole. Enabling this option will ensure host-pahole
+	  gets built before the Linux kernel.
+
+	  Enable this option if you get a Linux kernel build failure
+	  such as "BTF: .tmp_vmlinux.btf: pahole (pahole) is not
+	  available".
+
 # Linux extensions
 # Linux extensions
 source "linux/Config.ext.in"
 source "linux/Config.ext.in"
 
 

+ 12 - 0
linux/linux.mk

@@ -114,6 +114,17 @@ ifeq ($(BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF),y)
 LINUX_DEPENDENCIES += host-elfutils host-pkgconf
 LINUX_DEPENDENCIES += host-elfutils host-pkgconf
 endif
 endif
 
 
+ifeq ($(BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE),y)
+LINUX_DEPENDENCIES += host-pahole
+else
+define LINUX_FIXUP_CONFIG_PAHOLE_CHECK
+	if grep -q "^CONFIG_DEBUG_INFO_BTF=y" $(KCONFIG_DOT_CONFIG); then \
+		echo "To use CONFIG_DEBUG_INFO_BTF, enable host-pahole (BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE)" 1>&2; \
+		exit 1; \
+	fi
+endef
+endif
+
 # If host-uboot-tools is selected by the user, assume it is needed to
 # If host-uboot-tools is selected by the user, assume it is needed to
 # create a custom image
 # create a custom image
 ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS),y)
 ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS),y)
@@ -324,6 +335,7 @@ define LINUX_KCONFIG_FIXUP_CMDS
 		$(call KCONFIG_DISABLE_OPT,$(opt))
 		$(call KCONFIG_DISABLE_OPT,$(opt))
 	)
 	)
 	$(LINUX_FIXUP_CONFIG_ENDIANNESS)
 	$(LINUX_FIXUP_CONFIG_ENDIANNESS)
+	$(LINUX_FIXUP_CONFIG_PAHOLE_CHECK)
 	$(if $(BR2_arm)$(BR2_armeb),
 	$(if $(BR2_arm)$(BR2_armeb),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI))
 		$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI))
 	$(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),
 	$(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),