fix: built-in lttng with kernel >= v6.1
[lttng-modules.git] / scripts / built-in.sh
index f0594eccdba217157bd016a2e75ad84805243333..5c58042263ae768378c6cee3e08f0b8628d7458e 100755 (executable)
@@ -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
This page took 0.024021 seconds and 4 git commands to generate.