Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Vincent Davis Jr <vince@underview.tech>
To: openembedded-core@lists.openembedded.org
Cc: Vincent Davis Jr <vince@underview.tech>
Subject: [PATCH v2 23/26] linux-kernel-base: locate virtual/kernel WORKDIR
Date: Sun, 12 Jul 2026 01:49:51 -0400	[thread overview]
Message-ID: <20260712054954.4063745-23-vince@underview.tech> (raw)
In-Reply-To: <20260712054954.4063745-1-vince@underview.tech>

If KERNEL_PACKAGE_NAME is not set to default
string "kernel" there's currently no way to
determine the WORKDIR of virtual/kernel.

Commit adds a way to determine virtual/kernel WORKDIR.
So, perf and make-mod-scripts builds.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
---
 meta/classes-recipe/linux-kernel-base.bbclass | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/meta/classes-recipe/linux-kernel-base.bbclass b/meta/classes-recipe/linux-kernel-base.bbclass
index e2187a73f0..83fc075ced 100644
--- a/meta/classes-recipe/linux-kernel-base.bbclass
+++ b/meta/classes-recipe/linux-kernel-base.bbclass
@@ -54,6 +54,36 @@ def linux_module_packages(s, d):
     suffix = ""
     return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split()))
 
+def set_kernel_staging_vars(d):
+    from pathlib import Path
+
+    kpn = d.getVar("KERNEL_PACKAGE_NAME")
+
+    # FROM: kernel.bbclass
+    # 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
+    # kernel recipes (I.e. where KERNEL_PACKAGE_NAME != kernel) so that they
+    # may build in parallel with the default kernel without clobbering.
+    #
+    # Due to this STAGING_KERNEL_DIR is changed from default defined in
+    # bitbake.conf. Currently there is no way to globally set a variable
+    # in a kernel recipe and no way to get the WORKDIR of the kernel
+    # recipe from within this recipe. So, folder path is determined
+    # using other pre-existing information.
+    if kpn != "kernel":
+        workdir = d.getVar("WORKDIR") + "/../../" + d.getVar("PREFERRED_PROVIDER_virtual/kernel")
+        src_path = Path(workdir)
+        # Helps acquire package version.
+        # Caller should only be using 1 version at given time.
+        for x in src_path.iterdir():
+            if x.is_dir():
+                staging_kernel_dir = os.path.join(workdir, "%s/kernel-source" % (x))
+                staging_kernel_builddir = os.path.join(workdir, "%s/kernel-build-artifacts" % (x))
+                d.setVar("STAGING_KERNEL_DIR", staging_kernel_dir)
+                d.setVar("STAGING_KERNEL_BUILDDIR", staging_kernel_builddir)
+                break
+
 export KBUILD_BUILD_VERSION = "1"
 export KBUILD_BUILD_USER ?= "oe-user"
 export KBUILD_BUILD_HOST ?= "oe-host"
-- 
2.43.0



  parent reply	other threads:[~2026-07-12  5:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-12  5:49 [PATCH v2 01/26] bitbake: globally define KERNEL_PACKAGE_NAME Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 02/26] kernel: remove KERNEL_PACKAGE_NAME Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 03/26] machine: rename kernel prefix Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 04/26] kernel: remove setting of KERNEL_PACKAGE_NAME Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 05/26] core-image-kernel: rename kernel prefix Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 06/26] packagegroup-self-hosted: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 07/26] packegroup-core-boot: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 08/26] packagegroup-base: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 09/26] ofono: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 10/26] iptables: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 11/26] watchdog: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 12/26] nfs-utils: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 13/26] mdadm: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 14/26] systemd: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 15/26] util-linux: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 16/26] connman: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 17/26] hwlatdetect: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 18/26] v86d: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 19/26] efivar: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 20/26] parted: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 21/26] ltp: " Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 22/26] libnl: " Vincent Davis Jr
2026-07-12  5:49 ` Vincent Davis Jr [this message]
2026-07-12  5:49 ` [PATCH v2 24/26] perf: preset STAGING_KERNEL_DIR Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 25/26] perf: disable discarded-qualifiers checks Vincent Davis Jr
2026-07-12  5:49 ` [PATCH v2 26/26] make-mod-scripts: preset STAGING_KERNEL_DIR Vincent Davis Jr
2026-07-12 13:08 ` [PATCH v2 01/26] bitbake: globally define KERNEL_PACKAGE_NAME Vincent Davis Jr

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=20260712054954.4063745-23-vince@underview.tech \
    --to=vince@underview.tech \
    --cc=openembedded-core@lists.openembedded.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