public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Adriaan Schmidt <adriaan.schmidt@siemens.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, stefan-koch@siemens.com,
	Adriaan Schmidt <adriaan.schmidt@siemens.com>
Subject: [PATCH v4 1/3] module.inc: fix kbuild dependency
Date: Tue, 14 May 2024 16:15:25 +0200	[thread overview]
Message-ID: <20240514141527.1997170-2-adriaan.schmidt@siemens.com> (raw)
In-Reply-To: <20240514141527.1997170-1-adriaan.schmidt@siemens.com>

This achieves two things:

* Module builds now depend on linux-headers-*-native as build dependency.
  This is a minimal API change compared to the previous linux-headers-*.
  The dependency on the new linux-kbuild is kept hidden in linux-custom.inc
* Remove the unconditional building of native kbuild when it is
  not needed, i.e. when we're not actually cross-building a module

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
 meta/recipes-kernel/linux-module/module.inc |  2 +-
 meta/recipes-kernel/linux/linux-custom.inc  | 25 ++++++++++++++-------
 meta/recipes-kernel/linux/linux-distro.bb   |  1 +
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index eddbf177..229e6a5c 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -17,7 +17,7 @@ PN .= "-${KERNEL_NAME}"
 
 KERNEL_IMAGE_PKG ??= "linux-image-${KERNEL_NAME}"
 KERNEL_HEADERS_PKG ??= "linux-headers-${KERNEL_NAME}"
-DEPENDS += "${KERNEL_HEADERS_PKG}"
+DEPENDS += "${KERNEL_HEADERS_PKG}-native"
 DEBIAN_BUILD_DEPENDS = "${KERNEL_HEADERS_PKG}"
 
 SIGNATURE_KEYFILE ??= ""
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 0d222332..7b752f2b 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -116,11 +116,19 @@ HEADERS_DEPENDS:cross-profile = ", linux-kbuild-${KERNEL_NAME_PROVIDED}:${HOST_A
 
 # -native: kbuild package for host
 BUILD_PROFILES:class-native = "kbuild"
-RECIPE_PROVIDES:class-native = "linux-kbuild-${KERNEL_NAME_PROVIDED}-native"
+RECIPE_PROVIDES:class-native = " \
+    linux-headers-${KERNEL_NAME_PROVIDED} \
+    linux-kbuild-${KERNEL_NAME_PROVIDED}"
+# Use pseudo target to pull in the base variant of the recipe.
+# Will be auto-extended with -native by multiarch.bbclass.
+RDEPENDS:class-native += "${BPN}-pseudo"
 
 # -kbuildtarget: kbuild package for target, enforcing non-cross-build
 BUILD_PROFILES:class-kbuildtarget = "kbuild"
-RECIPE_PROVIDES:class-kbuildtarget = "linux-kbuild-${KERNEL_NAME_PROVIDED}"
+RECIPE_PROVIDES:class-kbuildtarget = " \
+    linux-headers-${KERNEL_NAME_PROVIDED} \
+    linux-kbuild-${KERNEL_NAME_PROVIDED}"
+RDEPENDS:class-kbuildtarget = "${BPN}"
 ISAR_CROSS_COMPILE:class-kbuildtarget = "0"
 
 # Make bitbake know we will be producing linux-image and linux-headers packages
@@ -132,11 +140,15 @@ RECIPE_PROVIDES = " \
     linux-libc-dev-${DISTRO_ARCH}-cross \
     linux-image-${KERNEL_NAME_PROVIDED}-dbg \
     linux-kbuild-${KERNEL_NAME_PROVIDED} \
+    ${BPN}-pseudo-native \
 "
 # When cross-profile is active:
-# kbuild package is provided by -native or -kbuildtarget variant
-# Otherwise it's provided by the default variant
-RECIPE_PROVIDES:remove:cross-profile = "linux-kbuild-${KERNEL_NAME_PROVIDED}"
+# kbuild package is provided by -native or -kbuildtarget variant. Also headers
+# provisioning moves over to ensure those variants are pulled, although the
+# package itself is still built by the base recipe.
+RECIPE_PROVIDES:remove:cross-profile = " \
+    linux-headers-${KERNEL_NAME_PROVIDED} \
+    linux-kbuild-${KERNEL_NAME_PROVIDED}"
 
 # Append headers depends
 HEADERS_DEPENDS = ", linux-kbuild-${KERNEL_NAME_PROVIDED}"
@@ -148,9 +160,6 @@ PROVIDES += "${RECIPE_PROVIDES}"
 # Append build profiles
 DEB_BUILD_PROFILES += "${BUILD_PROFILES}"
 
-# Add dependency to build -kbuildtarget and -native automatically
-RDEPENDS:append:cross-profile = " ${BPN}-native"
-
 def get_kernel_arch(d):
     distro_arch = d.getVar("DISTRO_ARCH")
     if distro_arch in ["amd64", "i386"]:
diff --git a/meta/recipes-kernel/linux/linux-distro.bb b/meta/recipes-kernel/linux/linux-distro.bb
index bc43528c..13b8dc7e 100644
--- a/meta/recipes-kernel/linux/linux-distro.bb
+++ b/meta/recipes-kernel/linux/linux-distro.bb
@@ -10,6 +10,7 @@ python() {
     for kernel in distro_kernels.split():
         d.appendVar('PROVIDES', ' linux-image-' + kernel)
         d.appendVar('PROVIDES', ' linux-headers-' + kernel)
+        d.appendVar('PROVIDES', ' linux-kbuild-' + kernel)
     if d.getVar('KERNEL_IMAGE_PKG'):
         d.appendVar('PROVIDES', ' ' + d.getVar('KERNEL_IMAGE_PKG'))
     if d.getVar('KERNEL_HEADERS_PKG'):
-- 
2.39.2


  reply	other threads:[~2024-05-14 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 14:15 [PATCH v4 0/3] kbuild follow-up Adriaan Schmidt
2024-05-14 14:15 ` Adriaan Schmidt [this message]
2024-05-15 15:07   ` [PATCH v4 1/3] module.inc: fix kbuild dependency Anton Mikanovich
2024-05-15 17:41     ` Jan Kiszka
2024-05-15 21:28       ` Schmidt, Adriaan
2024-05-16  5:21         ` Jan Kiszka
2024-05-16  6:15           ` Jan Kiszka
2024-05-16  6:21             ` Jan Kiszka
2024-05-16  6:28               ` Schmidt, Adriaan
2024-05-14 14:15 ` [PATCH v4 2/3] linux-custom: use to_boolean when checking ISAR_CROSS_COMPILE Adriaan Schmidt
2024-05-14 14:15 ` [PATCH v4 3/3] kbuildtarget.bbclass: add missing license header Adriaan Schmidt

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=20240514141527.1997170-2-adriaan.schmidt@siemens.com \
    --to=adriaan.schmidt@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=stefan-koch@siemens.com \
    /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