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: Mon, 23 Nov 2026 20:03:24 -0700 [thread overview]
Message-ID: <20261124030324.GA2247258@ax162> (raw)
In-Reply-To: <awRijCPFYK4J5L6C@levanger>
On Mon, Nov 23, 2026 at 04:58:04PM +0100, Nicolas Schier wrote:
> As Distros are moving everything to /usr/ -- but I haven't seen
> /usr/boot/ anywhere -- I'd prefer to move it away from /boot. The
> kmod build tree looks like the native location to me (as per
> scripts/depmod.sh) and from what I can find, most debugging tools use
> vmlinux or /proc/kallsyms rather than System.map; but I have never ever
> tried to debug a Linux without the full source + build tree at hand.
I guess we could try it and see who complains about the new location.
I am just not sure that we should treat scripts/depmod.sh expecting
System.map in the build folder as anything more than "external modules
won't have dependencies generated properly" (which is more of a missing
feature than a true bug) than "System.map does not belong in /boot" but
I don't have a really strong opinion here.
> Does System.map still help with regular debugging with CONFIG_KASLR
> enabled?
I think for debugging, you would want KASLR off?
> If it wasn't for 'depmod -e' I'd like to put System.map to the
> linux-image-${KVER}-dbg_*.deb, as Debian does.
>
>
> > 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"
> > +
>
> What about doing it the other way round? We could provide the symlink
> in the old /boot/ location for now and move System.map to the module
> build tree?
We would have to make sure that this location was available without
CONFIG_MODULES but that wouldn't be a bad option either.
> > 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
>
> Looking at line 122 (start of hunk), /lib/modules/%{KERNELRELEASE} seems to be a symlink to
> /lib/modules/%{KERNELRELEASE}/build/, thus that line will would create a
> funny symlink. ;)
/lib/modules/%{KERNELRELEASE} is a folder created at the beginning of
the %install stage. /lib/modules/%{KERNELRELEASE}/System.map is where it
is installed during this stage, so symlinking it to
/usr/src/kernels/%{KERNELRELEASE}/System.map should make it appear at
/lib/modules/%{KERNELRELEASE}/build/System.map as expected.
But as I mentioned above, I am totally fine with going the other way.
--
Cheers,
Nathan
prev parent reply other threads:[~2026-11-24 3:03 UTC|newest]
Thread overview: 5+ 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
2026-11-23 15:58 ` Nicolas Schier
2026-11-24 3:03 ` 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=20261124030324.GA2247258@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