public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Stefan Koch <stefan-koch@siemens.com>
To: isar-users@googlegroups.com
Cc: stefan-koch@siemens.com, jan.kiszka@siemens.com,
	christian.storm@siemens.com, michael.adler@siemens.com,
	simon.sudler@siemens.com, cedric.hombourger@siemens.com,
	adriaan.schmidt@siemens.com, felix.moessbauer@siemens.com,
	ubely@ilbers.de
Subject: [PATCH] linux-module: Support emulated module build with cross-compiled kernel
Date: Tue, 30 Apr 2024 15:10:58 +0200	[thread overview]
Message-ID: <20240430131058.2574127-1-stefan-koch@siemens.com> (raw)

Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
---
 meta/recipes-kernel/linux-module/module.inc | 9 ++++++++-
 meta/recipes-kernel/linux/linux-custom.inc  | 2 +-
 meta/recipes-kernel/linux/linux-distro.bb   | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index eddbf177..eaf086eb 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -17,7 +17,6 @@ PN .= "-${KERNEL_NAME}"
 
 KERNEL_IMAGE_PKG ??= "linux-image-${KERNEL_NAME}"
 KERNEL_HEADERS_PKG ??= "linux-headers-${KERNEL_NAME}"
-DEPENDS += "${KERNEL_HEADERS_PKG}"
 DEBIAN_BUILD_DEPENDS = "${KERNEL_HEADERS_PKG}"
 
 SIGNATURE_KEYFILE ??= ""
@@ -36,8 +35,16 @@ AUTOLOAD ?= ""
 python() {
     if d.getVar('KERNEL_NAME') in d.getVar('DISTRO_KERNELS').split():
         d.setVar('ISAR_CROSS_COMPILE', '0')
+
+    if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")):
+        d.appendVar("OVERRIDES", ":cross-profile")
 }
 
+DEFAULT_KERNEL_KBUILD_PKG = "linux-kbuild-${KERNEL_NAME}"
+DEFAULT_KERNEL_KBUILD_PKG:cross-profile = "linux-kbuild-${KERNEL_NAME}-native"
+KERNEL_KBUILD_PKG ??= "${DEFAULT_KERNEL_KBUILD_PKG}"
+DEPENDS += "${KERNEL_HEADERS_PKG} ${KERNEL_KBUILD_PKG}"
+
 inherit dpkg
 
 TEMPLATE_FILES = "debian/control.tmpl \
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 0d222332..16e65d7a 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -97,7 +97,7 @@ KERNEL_NAME_PROVIDED ?= "${@ d.getVar('BPN').partition('linux-')[2]}"
 
 # Determine cross-profile override
 python() {
-    if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and d.getVar("ISAR_CROSS_COMPILE", True) == "1" and "class-native" not in d.getVar("OVERRIDES", True).split(":"):
+    if d.getVar("DISTRO_ARCH") != d.getVar("HOST_ARCH") and bb.utils.to_boolean(d.getVar("ISAR_CROSS_COMPILE")) and "class-native" not in d.getVar("OVERRIDES", True).split(":"):
         d.appendVar("OVERRIDES", ":cross-profile")
 }
 
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-04-30 13:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 13:10 Stefan Koch [this message]
2024-04-30 13:44 ` Jan Kiszka
2024-04-30 16:52   ` Koch, Stefan
2024-05-02 14:09 Stefan Koch
2024-05-02 14:32 ` Jan Kiszka

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=20240430131058.2574127-1-stefan-koch@siemens.com \
    --to=stefan-koch@siemens.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=christian.storm@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=michael.adler@siemens.com \
    --cc=simon.sudler@siemens.com \
    --cc=ubely@ilbers.de \
    /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