Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: builddeb - avoid recompiles for non-cross-compiles

Commit e2c318225ac1 ("kbuild: deb-pkg: add
pkg.linux-upstream.nokernelheaders build profile") changed how
install-extmod-build gets called, making it always rebuild the host
programs below scripts/ if HOSTCC wasn't specified with its full triplet
on the make command line. That is, apparently, needed to fix up commit
f1d87664b82a ("kbuild: cross-compile linux-headers package when
possible") for cross-compiles. However, in the much more common case of
non-cross-compile builds this will lead to unnecessary rebuilding of
host tools including gcc plugins. This, in turn, will lead to a full
kernel rebuild on the next 'make bindeb-pkg' which is unfortunate.

Avoid that by only triggering the rebuild of host tools for actual
cross-compile builds.

Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Fixes: e2c318225ac1 ("kbuild: deb-pkg: add pkg.linux-upstream.nokernelheaders build profile")
Cc: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/20260402145116.1010901-1-minipli@grsecurity.net
Signed-off-by: Nicolas Schier <nsc@kernel.org>

authored by

Mathias Krause and committed by
Nicolas Schier
2452dcf4 028ef9c9

+7 -1
+7 -1
scripts/package/builddeb
··· 139 139 pdir=debian/$1 140 140 version=${1#linux-headers-} 141 141 142 - CC="${DEB_HOST_GNU_TYPE}-gcc" "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}" 142 + # Override $CC only for cross-compiles, to not unnecessarily rebuild 143 + # scripts/ including plugins, which may lead to a full kernel rebuild. 144 + if [ -n "${CROSS_COMPILE}" ]; then 145 + CC="${DEB_HOST_GNU_TYPE}-gcc" "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}" 146 + else 147 + "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}" 148 + fi 143 149 144 150 mkdir -p $pdir/lib/modules/$version/ 145 151 ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build