From e0dfb3ef66db104d0a256d098df4d300c57fbccd Mon Sep 17 00:00:00 2001 From: linesight Date: Sun, 17 May 2026 21:12:20 -0700 Subject: [PATCH] Fix prebuilt tarball hardcoding CI build path Rewrite the generated Makefile include directive to use a relative "source/Makefile" path instead of the absolute CI machine path, so out-of-tree module builds work on any machine. Also include objtool in the tarball when CONFIG_OBJTOOL=y. Fixes #375 Co-Authored-By: Claude Opus 4.7 --- devtools/pack-prebuilt.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/devtools/pack-prebuilt.sh b/devtools/pack-prebuilt.sh index 4556ff24..d2c0e5ed 100755 --- a/devtools/pack-prebuilt.sh +++ b/devtools/pack-prebuilt.sh @@ -63,8 +63,12 @@ cp "$KERNEL_BUILD/.config" "$STAGE_BUILD/" cp "$KERNEL_BUILD/Module.symvers" "$STAGE_BUILD/" [ -f "$KERNEL_BUILD/modules.order" ] && cp "$KERNEL_BUILD/modules.order" "$STAGE_BUILD/" -# Top-level Makefile (kbuild entry point when using O=) +# Top-level Makefile (kbuild entry point when using O=). +# kbuild generates this with an absolute include path; rewrite it to use a +# relative "source" symlink so the prebuilt tarball is machine-independent. cp "$KERNEL_BUILD/Makefile" "$STAGE_BUILD/" +sed -i "s|^include .*/linux-${KERNEL_VERSION}/Makefile|include source/Makefile|" \ + "$STAGE_BUILD/Makefile" # Config stamp (for setup.sh staleness detection) [ -f "$KERNEL_BUILD/.config-stamp" ] && cp "$KERNEL_BUILD/.config-stamp" "$STAGE_BUILD/" @@ -93,6 +97,12 @@ rsync -a \ --exclude='*.a' --exclude='.tmp_*' \ "$KERNEL_BUILD/scripts/" "$STAGE_BUILD/scripts/" +# objtool (host tool required for out-of-tree module builds with CONFIG_OBJTOOL) +if [ -f "$KERNEL_BUILD/tools/objtool/objtool" ]; then + mkdir -p "$STAGE_BUILD/tools/objtool" + cp "$KERNEL_BUILD/tools/objtool/objtool" "$STAGE_BUILD/tools/objtool/" +fi + # bzImage for QEMU boot mkdir -p "$STAGE_BUILD/arch/x86/boot" cp "$KERNEL_BUILD/arch/x86/boot/bzImage" "$STAGE_BUILD/arch/x86/boot/"