diff --git a/Makefile b/Makefile index 24bf8a3842ca..4084ef353f4d 100644 --- a/Makefile +++ b/Makefile @@ -294,6 +294,9 @@ minikube-iso-%: deploy/iso/minikube-iso/board/minikube/%/rootfs-overlay/usr/bin/ perl -pi -e 's@\s+source "package/sysdig/Config\.in"\n@@;' $(BUILD_DIR)/buildroot/package/Config.in; \ rm -r $(BUILD_DIR)/buildroot/package/sysdig; \ cp deploy/iso/minikube-iso/go.hash $(BUILD_DIR)/buildroot/package/go/go.hash; \ + git --git-dir=$(BUILD_DIR)/buildroot/.git config user.email "dev@random.com"; \ + git --git-dir=$(BUILD_DIR)/buildroot/.git config user.name "Random developer"; \ + git --git-dir=$(BUILD_DIR)/buildroot/.git --work-tree=$(BUILD_DIR)/buildroot am ../../deploy/iso/minikube-iso/0001-linux-add-BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE.patch; \ fi; $(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) O=$(BUILD_DIR)/buildroot/output-$* minikube_$*_defconfig $(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) O=$(BUILD_DIR)/buildroot/output-$* host-python @@ -307,9 +310,9 @@ minikube-iso-%: deploy/iso/minikube-iso/board/minikube/%/rootfs-overlay/usr/bin/ # Change buildroot configuration for the minikube ISO .PHONY: iso-menuconfig -iso-menuconfig: ## Configure buildroot configuration - $(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) menuconfig - $(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) savedefconfig +iso-menuconfig-%: ## Configure buildroot configuration + $(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) O=$(BUILD_DIR)/buildroot/output-$* menuconfig + $(MAKE) -C $(BUILD_DIR)/buildroot $(BUILDROOT_OPTIONS) O=$(BUILD_DIR)/buildroot/output-$* savedefconfig # Change the kernel configuration for the minikube ISO linux-menuconfig-%: ## Configure Linux kernel configuration diff --git a/deploy/iso/minikube-iso/0001-linux-add-BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE.patch b/deploy/iso/minikube-iso/0001-linux-add-BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE.patch new file mode 100644 index 000000000000..6d0445051106 --- /dev/null +++ b/deploy/iso/minikube-iso/0001-linux-add-BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE.patch @@ -0,0 +1,72 @@ +From 2da2f359dba50aafef1202edda34374d99b77a14 Mon Sep 17 00:00:00 2001 +From: Francis Laniel +Date: Wed, 22 Dec 2021 18:49:05 +0100 +Subject: [PATCH] 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 +Signed-off-by: Thomas Petazzoni +--- + linux/Config.in | 12 ++++++++++++ + linux/linux.mk | 12 ++++++++++++ + 2 files changed, 24 insertions(+) + +diff --git a/linux/Config.in b/linux/Config.in +index 891e2cdcb6..582f37ba7c 100644 +--- a/linux/Config.in ++++ b/linux/Config.in +@@ -470,6 +470,18 @@ config BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF + CONFIG_UNWINDER_ORC=y, please install libelf-dev, + 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 + source "linux/Config.ext.in" + +diff --git a/linux/linux.mk b/linux/linux.mk +index 61fdc0c76c..dd2eebd446 100644 +--- a/linux/linux.mk ++++ b/linux/linux.mk +@@ -114,6 +114,17 @@ ifeq ($(BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF),y) + LINUX_DEPENDENCIES += host-elfutils host-pkgconf + 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 + # create a custom image + ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS),y) +@@ -324,6 +335,7 @@ define LINUX_KCONFIG_FIXUP_CMDS + $(call KCONFIG_DISABLE_OPT,$(opt)) + ) + $(LINUX_FIXUP_CONFIG_ENDIANNESS) ++ $(LINUX_FIXUP_CONFIG_PAHOLE_CHECK) + $(if $(BR2_arm)$(BR2_armeb), + $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) + $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), +-- +2.25.1 + diff --git a/deploy/iso/minikube-iso/board/minikube/aarch64/linux_aarch64_defconfig b/deploy/iso/minikube-iso/board/minikube/aarch64/linux_aarch64_defconfig index 6580b3eb0979..4f4586e94bef 100644 --- a/deploy/iso/minikube-iso/board/minikube/aarch64/linux_aarch64_defconfig +++ b/deploy/iso/minikube-iso/board/minikube/aarch64/linux_aarch64_defconfig @@ -1,3 +1,9 @@ +CONFIG_FANOTIFY=y +CONFIG_KPROBE_EVENTS=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_INFO_BTF=y +CONFIG_IKHEADERS=y +CONFIG_BPF_LSM=y CONFIG_FTRACE_SYSCALLS=y CONFIG_FTRACE=y CONFIG_HAVE_SYSCALL_TRACEPOINTS=y diff --git a/deploy/iso/minikube-iso/board/minikube/x86_64/linux_x86_64_defconfig b/deploy/iso/minikube-iso/board/minikube/x86_64/linux_x86_64_defconfig index d1ffd4c0d3b5..01c27835db02 100644 --- a/deploy/iso/minikube-iso/board/minikube/x86_64/linux_x86_64_defconfig +++ b/deploy/iso/minikube-iso/board/minikube/x86_64/linux_x86_64_defconfig @@ -1,3 +1,9 @@ +CONFIG_FANOTIFY=y +CONFIG_KPROBE_EVENTS=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_INFO_BTF=y +CONFIG_IKHEADERS=y +CONFIG_BPF_LSM=y CONFIG_VBOXGUEST=m CONFIG_VBOXSF_FS=m CONFIG_DRM_VBOXVIDEO=m diff --git a/deploy/iso/minikube-iso/configs/minikube_aarch64_defconfig b/deploy/iso/minikube-iso/configs/minikube_aarch64_defconfig index 4d2b25421f21..9c7af275bfe3 100644 --- a/deploy/iso/minikube-iso/configs/minikube_aarch64_defconfig +++ b/deploy/iso/minikube-iso/configs/minikube_aarch64_defconfig @@ -67,6 +67,7 @@ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/minikube/aarch64/linux_aarch64_defconfig" BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y +BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE=y BR2_PACKAGE_GZIP=y BR2_PACKAGE_XZ=y BR2_PACKAGE_STRACE=y diff --git a/deploy/iso/minikube-iso/configs/minikube_x86_64_defconfig b/deploy/iso/minikube-iso/configs/minikube_x86_64_defconfig index 2ad7c3ceec2f..14984421822a 100644 --- a/deploy/iso/minikube-iso/configs/minikube_x86_64_defconfig +++ b/deploy/iso/minikube-iso/configs/minikube_x86_64_defconfig @@ -69,6 +69,7 @@ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/minikube/x86_64/linux_x86_64_defconfig" BR2_LINUX_KERNEL_LZ4=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y +BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE=y BR2_PACKAGE_GZIP=y BR2_PACKAGE_XZ=y BR2_PACKAGE_STRACE=y diff --git a/deploy/iso/minikube-iso/package/Config.in b/deploy/iso/minikube-iso/package/Config.in index 8fbd6c82f289..ee2036e559fe 100644 --- a/deploy/iso/minikube-iso/package/Config.in +++ b/deploy/iso/minikube-iso/package/Config.in @@ -1,6 +1,7 @@ menu "System tools" source "$BR2_EXTERNAL_MINIKUBE_PATH/package/tbb/Config.in" source "$BR2_EXTERNAL_MINIKUBE_PATH/package/sysdig/Config.in" + source "$BR2_EXTERNAL_MINIKUBE_PATH/package/pahole/Config.in.host" source "$BR2_EXTERNAL_MINIKUBE_PATH/package/crun/Config.in" source "$BR2_EXTERNAL_MINIKUBE_PATH/package/automount/Config.in" source "$BR2_EXTERNAL_MINIKUBE_PATH/package/gluster/Config.in" diff --git a/deploy/iso/minikube-iso/package/pahole/Config.in.host b/deploy/iso/minikube-iso/package/pahole/Config.in.host new file mode 100644 index 000000000000..a3ec9995efea --- /dev/null +++ b/deploy/iso/minikube-iso/package/pahole/Config.in.host @@ -0,0 +1,7 @@ +config BR2_PACKAGE_HOST_PAHOLE + bool "host pahole" + default y + help + Pahole and other DWARF utils. + + https://git.kernel.org/pub/scm/devel/pahole/pahole.git diff --git a/deploy/iso/minikube-iso/package/pahole/pahole.hash b/deploy/iso/minikube-iso/package/pahole/pahole.hash new file mode 100644 index 000000000000..0c6f0faeac50 --- /dev/null +++ b/deploy/iso/minikube-iso/package/pahole/pahole.hash @@ -0,0 +1,2 @@ +# Locally computed +sha256 cde85af68b368f50a913be387f94f6b43612a04af6c92387b4dcabb712a668fe pahole-v1.23-br1.tar.gz diff --git a/deploy/iso/minikube-iso/package/pahole/pahole.mk b/deploy/iso/minikube-iso/package/pahole/pahole.mk new file mode 100644 index 000000000000..2fb3985637ca --- /dev/null +++ b/deploy/iso/minikube-iso/package/pahole/pahole.mk @@ -0,0 +1,22 @@ +######################################################################## +# +# pahole +# +######################################################################## + +PAHOLE_VERSION = v1.23 +PAHOLE_SITE = git://git.kernel.org/pub/scm/devel/pahole/pahole.git +PAHOLE_SITE_METHOD = git +# This guy saved me: +# https://stackoverflow.com/a/50526817 +# Indeed, pahole contains git submodule and relies on them to be built. +# The problem is that buildroot default behavior is to remove .git from archive. +# Thus, it is not possible to use git submodule... +PAHOLE_GIT_SUBMODULES = YES +# We want to have static pahole binary to avoid problem while using it during +# Linux kernel build. +HOST_PAHOLE_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF -D__LIB=lib +PAHOLE_LICENSE = GPL-2.0 +PAHOLE_LICENSE_FILES = COPYING + +$(eval $(host-cmake-package))