From 78d6705746d435fa7e30192018366fe916ed2ba4 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 18 Aug 2023 11:28:30 -0400 Subject: [PATCH] fix: built-in lttng with kernel >= v6.1 In kernel v6.1 the list of subdirectories was moved from Makefile to Kbuild. Adjust our built-in.sh script to detect this change and use the appropriate file to graft ourself to the kernel build system. Thanks to Richa Bharti for the initial patch. See upstream commit: commit 5750121ae7382ebac8d47ce6d68012d6cd1d7926 Author: Masahiro Yamada Date: Sun Sep 25 03:19:10 2022 +0900 kbuild: list sub-directories in ./Kbuild Use the ordinary obj-y syntax to list subdirectories. Change-Id: Ifc0f1bdea5ee59b0e0b96cdb31c9c689deb20559 Reported-by: Richa Bharti Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- scripts/built-in.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/built-in.sh b/scripts/built-in.sh index f0594ecc..5c580422 100755 --- a/scripts/built-in.sh +++ b/scripts/built-in.sh @@ -16,7 +16,13 @@ ln -sf "$(pwd)" "${KERNEL_DIR}/lttng" # Graft ourself to the kernel build system echo 'source "lttng/src/Kconfig"' >> "${KERNEL_DIR}/Kconfig" -sed -i 's#+= kernel/#+= kernel/ lttng/#' "${KERNEL_DIR}/Makefile" + +# In kernel v6.1, subdirectories were moved to Kbuild +if grep -qE '^obj-y[[:space:]]+\+= kernel/' "${KERNEL_DIR}/Kbuild"; then + echo 'obj-y += lttng/' >> "${KERNEL_DIR}/Kbuild" +else + sed -i 's#+= kernel/#+= kernel/ lttng/#' "${KERNEL_DIR}/Makefile" +fi echo >&2 echo " $0: done." >&2 -- 2.34.1