From: bruce.ashfield@gmail.com
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
Adrian Freihofer <adrian.freihofer@siemens.com>
Cc: openembedded-core@lists.openembedded.org
Subject: [OE-core][RFC PATCH 01/08] kernel.bbclass: map the kernel build directory to KERNEL_SRC_PATH
Date: Fri, 6 Nov 2026 12:32:28 -0500 [thread overview]
Message-ID: <20261106173235.4155305-2-bruce.ashfield@gmail.com> (raw)
In-Reply-To: <20261106173235.4155305-1-bruce.ashfield@gmail.com>
From: Bruce Ashfield <bruce.ashfield@gmail.com>
kernel-arch's KERNEL_CC maps STAGING_KERNEL_DIR and
STAGING_KERNEL_BUILDDIR to KERNEL_SRC_PATH, but the kernel itself builds
in ${B}, which isn't mapped. Sources generated there (*.mod.c, asn1
parsers, data tables, etc) fall through to the generic debug prefix map,
so the kernel's debug info is split across two roots, and those files
are the only content of the kernel's ${PN}-src package.
Map ${B} to KERNEL_SRC_PATH too. All of the kernel's debug source paths
are then under /usr/src/kernel, and no ${PN}-src package is created
for the kernel.
The generated sources aren't packaged anywhere. They aren't needed to
debug the kernel, and those that are of any use can be regenerated from
the kernel source, where they land at the path the debug info expects.
This is only done in kernel.bbclass, since other kernel-arch users
(module-base, perf, make-mod-scripts) have their own mapping.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
meta/classes-recipe/kernel.bbclass | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 46da867a63..ab064bb085 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -246,6 +246,12 @@ UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}"
# Some Linux kernel configurations need additional parameters on the command line
KERNEL_EXTRA_ARGS ?= ""
+# The kernel builds out of tree in ${B}, which kernel-arch does not remap.
+# Map it to KERNEL_SRC_PATH as well, so generated sources are recorded under
+# the same root as the rest of the kernel and are not collected into a
+# ${PN}-src package. The last matching prefix map wins.
+KERNEL_CC:append = " -ffile-prefix-map=${B}=${KERNEL_SRC_PATH}"
+
EXTRA_OEMAKE += ' ARCH="${@oe.kernel.map_kernel_arch(d)}"'
EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}"'
EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"'
--
2.43.0
next prev parent reply other threads:[~2026-11-06 17:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 17:32 [OE-core][RFC PATCH 0/8] enhance kernel -devsrc output options bruce.ashfield
2026-11-06 17:32 ` bruce.ashfield [this message]
2026-11-06 17:32 ` [OE-core][RFC PATCH 02/08] kernel.bbclass: stage a manifest of the source files the build read bruce.ashfield
2026-11-06 17:32 ` [OE-core][RFC PATCH 03/08] kernel-devsrc: add build and source PACKAGECONFIG levels bruce.ashfield
2026-11-06 17:32 ` [OE-core][RFC PATCH 04/08] kernel-devsrc: add full and tarball " bruce.ashfield
2026-11-06 17:32 ` [OE-core][RFC PATCH 05/08] kernel-devsrc: optionally version the package bruce.ashfield
2026-11-06 17:32 ` [OE-core][RFC PATCH 06/08] kernel-devsrc: skip the recipe if no PACKAGECONFIG level is set bruce.ashfield
2026-11-06 17:32 ` [OE-core][RFC PATCH 07/08] rootfs: don't carry debug rootfs postinst registrations into the image bruce.ashfield
2026-11-06 17:32 ` [OE-core][RFC PATCH 08/08] rootfs: fail if an IMAGE_INSTALL_DEBUGFS package can't be installed bruce.ashfield
2026-11-06 19:08 ` [OE-core][RFC PATCH 0/8] enhance kernel -devsrc output options Richard Purdie
2026-11-06 20:20 ` bruce.ashfield
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=20261106173235.4155305-2-bruce.ashfield@gmail.com \
--to=bruce.ashfield@gmail.com \
--cc=adrian.freihofer@siemens.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.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