From: Nicolas Schier <nsc@kernel.org>
To: Mathias Krause <minipli@grsecurity.net>
Cc: Nathan Chancellor <nathan@kernel.org>,
linux-kbuild@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>
Subject: Re: [PATCH] kbuild: builddeb - avoid recompiles for non-cross-compiles
Date: Tue, 7 Apr 2026 22:20:37 +0200 [thread overview]
Message-ID: <adVnFdusbO_2nIEP@levanger> (raw)
In-Reply-To: <20260402145116.1010901-1-minipli@grsecurity.net>
On Thu, Apr 02, 2026 at 04:51:16PM +0200, Mathias Krause wrote:
> 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>
> ---
> scripts/package/builddeb | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index 3627ca227e5a..ba1defc61652 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -139,7 +139,13 @@ install_kernel_headers () {
> pdir=debian/$1
> version=${1#linux-headers-}
>
> - CC="${DEB_HOST_GNU_TYPE}-gcc" "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
> + # Override $CC only for cross-compiles, to not unnecessarily rebuild
> + # scripts/ including plugins, which may lead to a full kernel rebuild.
> + if [ -n "${CROSS_COMPILE}" ]; then
> + CC="${DEB_HOST_GNU_TYPE}-gcc" "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
> + else
> + "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
> + fi
>
> mkdir -p $pdir/lib/modules/$version/
> ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
> --
> 2.47.3
>
Thanks!
Reviewed-by: Nicolas Schier <nsc@kernel.org>
--
Nicolas
prev parent reply other threads:[~2026-04-07 20:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 14:51 [PATCH] kbuild: builddeb - avoid recompiles for non-cross-compiles Mathias Krause
2026-04-07 20:20 ` Nicolas Schier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adVnFdusbO_2nIEP@levanger \
--to=nsc@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=minipli@grsecurity.net \
--cc=nathan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox