* [PATCH v2] kernel.bbclass: fix -dev files when KERNEL_PACKAGE_NAME is PN
@ 2026-10-29 4:13 prasanth
0 siblings, 0 replies; 3+ messages in thread
From: prasanth @ 2026-10-29 4:13 UTC (permalink / raw)
To: openembedded-core; +Cc: bruce.ashfield
For a second kernel next to virtual/kernel needs its own package names, e.g.
KERNEL_PACKAGE_NAME:pn-linux-yocto-rt = "linux-yocto-rt"
PROVIDES:remove:pn-linux-yocto-rt = "virtual/kernel"
FILES:${KERNEL_PACKAGE_NAME}-dev and FILES:${PN}-dev from bitbake.conf
are then the same key. Keys expand in sorted order, bitbake.conf wins
and do_package fails with installed-vs-shipped for System.map,
Module.symvers and config. -dbg only gets the collision warning, as the
bitbake.conf value is a superset.
Rename the kernel FILES to the ${PN} names in a RecipePreFinalise
handler. __anonymous() is too late and would drop bbappend :append, and
a class :append would still warn.
-dev now matches kernel-dev, without the bitbake.conf -dev defaults.
The default KERNEL_PACKAGE_NAME = "kernel" is unchanged. Drop the bug
11905 warning, as that is expected bitbake behaviour.
AI-Generated: Uses Claude
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
Notes:
v2: added the use case, why the handler is needed, -dbg/-dev notes
and the comment.
Found while checking the bug 11905 warning in kernel.bbclass. Tested on
master (qemux86-64): linux-yocto-rt next to linux-yocto fails without
the patch and builds with no warnings with it. The default "kernel"
case is unchanged.
meta/classes-recipe/kernel.bbclass | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 0a6d754108..77ae9df4c9 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -60,16 +60,24 @@ KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
+# With KERNEL_PACKAGE_NAME = "${PN}", FILES:${PN}-dev/-dbg from bitbake.conf
+# would replace the kernel values during key expansion, so rename the kernel
+# variables to the ${PN} names first. This must run before key expansion, so
+# it cannot be moved to __anonymous().
+python kernel_package_name_handler () {
+ d = e.data
+ if d.getVar("KERNEL_PACKAGE_NAME") != d.getVar("PN"):
+ return
+
+ for pkg in ("dev", "dbg"):
+ d.renameVar("FILES:${KERNEL_PACKAGE_NAME}-%s" % pkg, "FILES:${PN}-%s" % pkg)
+}
+addhandler kernel_package_name_handler
+kernel_package_name_handler[eventmask] = "bb.event.RecipePreFinalise"
+
python __anonymous () {
- pn = d.getVar("PN")
kpn = d.getVar("KERNEL_PACKAGE_NAME")
- # XXX Remove this after bug 11905 is resolved
- # FILES:${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly
- if kpn == pn:
- bb.warn("Some packages (E.g. *-dev) might be missing due to "
- "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)")
-
# The default kernel recipe builds in a shared location defined by
# bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
# Set these variables to directories under ${WORKDIR} in alternate
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2] kernel.bbclass: fix -dev files when KERNEL_PACKAGE_NAME is PN
@ 2026-10-29 6:08 Prasanth R
2026-10-29 13:11 ` Bruce Ashfield
0 siblings, 1 reply; 3+ messages in thread
From: Prasanth R @ 2026-10-29 6:08 UTC (permalink / raw)
To: openembedded-core; +Cc: bruce.ashfield, Prasanth R
For a second kernel next to virtual/kernel needs its own package names, e.g.
KERNEL_PACKAGE_NAME:pn-linux-yocto-rt = "linux-yocto-rt"
PROVIDES:remove:pn-linux-yocto-rt = "virtual/kernel"
FILES:${KERNEL_PACKAGE_NAME}-dev and FILES:${PN}-dev from bitbake.conf
are then the same key. Keys expand in sorted order, bitbake.conf wins
and do_package fails with installed-vs-shipped for System.map,
Module.symvers and config. -dbg only gets the collision warning, as the
bitbake.conf value is a superset.
Rename the kernel FILES to the ${PN} names in a RecipePreFinalise
handler. __anonymous() is too late and would drop bbappend :append, and
a class :append would still warn.
-dev now matches kernel-dev, without the bitbake.conf -dev defaults.
The default KERNEL_PACKAGE_NAME = "kernel" is unchanged. Drop the bug
11905 warning, as that is expected bitbake behaviour.
AI-Generated: Uses Claude
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
Notes:
v2: added the use case, why the handler is needed, -dbg/-dev notes
and the comment.
Found while checking the bug 11905 warning in kernel.bbclass. Tested on
master (qemux86-64): linux-yocto-rt next to linux-yocto fails without
the patch and builds with no warnings with it. The default "kernel"
case is unchanged.
meta/classes-recipe/kernel.bbclass | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 0a6d754108..77ae9df4c9 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -60,16 +60,24 @@ KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}"
KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION'))}"
KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
+# With KERNEL_PACKAGE_NAME = "${PN}", FILES:${PN}-dev/-dbg from bitbake.conf
+# would replace the kernel values during key expansion, so rename the kernel
+# variables to the ${PN} names first. This must run before key expansion, so
+# it cannot be moved to __anonymous().
+python kernel_package_name_handler () {
+ d = e.data
+ if d.getVar("KERNEL_PACKAGE_NAME") != d.getVar("PN"):
+ return
+
+ for pkg in ("dev", "dbg"):
+ d.renameVar("FILES:${KERNEL_PACKAGE_NAME}-%s" % pkg, "FILES:${PN}-%s" % pkg)
+}
+addhandler kernel_package_name_handler
+kernel_package_name_handler[eventmask] = "bb.event.RecipePreFinalise"
+
python __anonymous () {
- pn = d.getVar("PN")
kpn = d.getVar("KERNEL_PACKAGE_NAME")
- # XXX Remove this after bug 11905 is resolved
- # FILES:${KERNEL_PACKAGE_NAME}-dev doesn't expand correctly
- if kpn == pn:
- bb.warn("Some packages (E.g. *-dev) might be missing due to "
- "bug 11905 (variable KERNEL_PACKAGE_NAME == PN)")
-
# The default kernel recipe builds in a shared location defined by
# bitbake/distro confs: STAGING_KERNEL_DIR and STAGING_KERNEL_BUILDDIR.
# Set these variables to directories under ${WORKDIR} in alternate
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kernel.bbclass: fix -dev files when KERNEL_PACKAGE_NAME is PN
2026-10-29 6:08 [PATCH v2] kernel.bbclass: fix -dev files when KERNEL_PACKAGE_NAME is PN Prasanth R
@ 2026-10-29 13:11 ` Bruce Ashfield
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Ashfield @ 2026-10-29 13:11 UTC (permalink / raw)
To: Prasanth R; +Cc: openembedded-core, prasanth.r
On Thu, Oct 29, 2026 at 2:08 AM Prasanth R <ragaprasanth@gmail.com> wrote:
>
> For a second kernel next to virtual/kernel needs its own package names, e.g.
>
> KERNEL_PACKAGE_NAME:pn-linux-yocto-rt = "linux-yocto-rt"
> PROVIDES:remove:pn-linux-yocto-rt = "virtual/kernel"
>
[...]
Thanks for the updates. That covers everything I asked for in v1.
Acked-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Bruce
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-29 13:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 6:08 [PATCH v2] kernel.bbclass: fix -dev files when KERNEL_PACKAGE_NAME is PN Prasanth R
2026-10-29 13:11 ` Bruce Ashfield
-- strict thread matches above, loose matches on Subject: below --
2026-10-29 4:13 prasanth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.