Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Nicolas Schier <nsc@kernel.org>
Cc: sashiko-reviews@lists.linux.dev,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"Christian Heusel" <christian@heusel.eu>,
	linux-kbuild@vger.kernel.org,
	"Adrián García Casado" <adriangarciacasado42@gmail.com>
Subject: Re: [PATCH] kbuild: package: Install System.map to build tree only
Date: Sun, 22 Nov 2026 14:35:04 -0700	[thread overview]
Message-ID: <20261122213504.GA1454693@ax162> (raw)
In-Reply-To: <sashiko-outbox-219115@kernel.org>

On Tue, Nov 17, 2026 at 03:53:56PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] kbuild: package: System.map dropped from tar-pkg and dir-pkg
>   in buildtar
> --
> 
> commit 4e40237f8938f58bf4db63fc401e165ccfea766e
> Author: Nicolas Schier <nsc@kernel.org>
> 
> kbuild: package: Install System.map to build tree only
> 
> This commit removes the target-specific installation of System.map to
> /boot and instead installs System.map into the packaged kernel build tree
> via scripts/package/install-extmod-build.
> 
> > diff --git a/scripts/package/buildtar b/scripts/package/buildtar
> > index cc87a473c01f4..057ca4fc7d71f 100755
> > --- a/scripts/package/buildtar
> > +++ b/scripts/package/buildtar
> > @@ -45,7 +45,6 @@ make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_
> >  #
> >  # Install basic kernel files
> >  #
> > -cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}"
> >  cp -v -- "${KCONFIG_CONFIG}" "${tmpdir}/boot/config-${KERNELRELEASE}"
> >  cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
> 
> [Severity: Medium]
> Does removing this copy drop System.map from the tar-pkg and dir-pkg
> targets altogether?  Unlike PKGBUILD, builddeb, and kernel.spec, buildtar
> does not package a kernel build tree or call
> scripts/package/install-extmod-build, so System.map is no longer included
> anywhere in the resulting tarball or directory.

Seems legitimate.

This got me thinking a little more about this change and I am not sure
this is actually a good direction to go in. Tying the existence of
System.map to the external module build feels wrong to me since it may
be useful for other tools and /boot/System.map-${KERNELRELEASE} is a
common place for it to be. I think we should probably leave it where it
is in the current set of packaging scripts but symlink it to the
external module build location in the places that need it. Something
like this maybe (completely untested):

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index ba1defc61652..4261963a901e 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -147,6 +147,13 @@ install_kernel_headers () {
 		"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
 	fi
 
+	if [ "${ARCH}" = um ] ; then
+		system_map="/usr/lib/uml/modules/${KERNELRELEASE}/System.map"
+	else
+		system_map="/boot/System.map-${KERNELRELEASE}"
+	fi
+	ln -s "${system_map}" "${pdir}/usr/src/linux-headers-${version}/System.map"
+
 	mkdir -p $pdir/lib/modules/$version/
 	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
 }
diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index 8f0933cbbe45..3add2b2c7dd2 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -122,6 +122,7 @@ fi
 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
 %if %{with_devel}
 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
+ln -fns /lib/modules/%{KERNELRELEASE}/System.map %{buildroot}/usr/src/kernels/%{KERNELRELEASE}/System.map
 %endif
 
 {
-- 
Cheers,
Nathan

      reply	other threads:[~2026-11-22 21:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:52 [PATCH] kbuild: package: Install System.map to build tree only Nicolas Schier
2026-11-17 15:53 ` sashiko-bot
2026-11-22 21:35   ` Nathan Chancellor [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=20261122213504.GA1454693@ax162 \
    --to=nathan@kernel.org \
    --cc=adriangarciacasado42@gmail.com \
    --cc=christian@heusel.eu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=nsc@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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