Skip to content

Commit

Permalink
kbuild: deb-pkg: fix build error with O=
Browse files Browse the repository at this point in the history
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 <[email protected]>
Closes: https://lore.kernel.org/all/Z1DnP-GJcfseyrM3@ghost/
Tested-by: Charlie Jenkins <[email protected]>
Reviewed-by: Charlie Jenkins <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed Dec 8, 2024
1 parent 7912405 commit d8d326d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/package/install-extmod-build
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [ "${CC}" != "${HOSTCC}" ]; then
#
# Use the single-target build to avoid the modpost invocation, which
# would overwrite Module.symvers.
"${MAKE}" HOSTCC="${CC}" KBUILD_EXTMOD="${destdir}" scripts/
"${MAKE}" HOSTCC="${CC}" KBUILD_OUTPUT=. KBUILD_EXTMOD="${destdir}" scripts/

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

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

rm -f "${destdir}/Kbuild" "${destdir}/scripts/Kbuild"
fi
Expand Down

0 comments on commit d8d326d

Please sign in to comment.