Skip to content

Commit d8d326d

Browse files
committed
kbuild: deb-pkg: fix build error with O=
Since commit 13b2548 ("kbuild: change working directory to external module directory with M="), the Debian package build fails if a relative path is specified with the O= option. $ make O=build bindeb-pkg [ snip ] dpkg-deb: building package 'linux-image-6.13.0-rc1' in '../linux-image-6.13.0-rc1_6.13.0-rc1-6_amd64.deb'. Rebuilding host programs with x86_64-linux-gnu-gcc... make[6]: Entering directory '/home/masahiro/linux/build' /home/masahiro/linux/Makefile:190: *** specified kernel directory "build" does not exist. Stop. This occurs because the sub_make_done flag is cleared, even though the working directory is already in the output directory. Passing KBUILD_OUTPUT=. resolves the issue. Fixes: 13b2548 ("kbuild: change working directory to external module directory with M=") Reported-by: Charlie Jenkins <charlie@rivosinc.com> Closes: https://lore.kernel.org/all/Z1DnP-GJcfseyrM3@ghost/ Tested-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 7912405 commit d8d326d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/package/install-extmod-build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if [ "${CC}" != "${HOSTCC}" ]; then
6969
#
7070
# Use the single-target build to avoid the modpost invocation, which
7171
# would overwrite Module.symvers.
72-
"${MAKE}" HOSTCC="${CC}" KBUILD_EXTMOD="${destdir}" scripts/
72+
"${MAKE}" HOSTCC="${CC}" KBUILD_OUTPUT=. KBUILD_EXTMOD="${destdir}" scripts/
7373

7474
cat <<-'EOF' > "${destdir}/scripts/Kbuild"
7575
subdir-y := basic
@@ -78,7 +78,7 @@ if [ "${CC}" != "${HOSTCC}" ]; then
7878
EOF
7979

8080
# Run once again to rebuild scripts/basic/ and scripts/mod/modpost.
81-
"${MAKE}" HOSTCC="${CC}" KBUILD_EXTMOD="${destdir}" scripts/
81+
"${MAKE}" HOSTCC="${CC}" KBUILD_OUTPUT=. KBUILD_EXTMOD="${destdir}" scripts/
8282

8383
rm -f "${destdir}/Kbuild" "${destdir}/scripts/Kbuild"
8484
fi

0 commit comments

Comments
 (0)