From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: jan.kiszka@siemens.com, Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/1] auto disable cross for kmod build against distro kernels
Date: Thu, 18 Jan 2024 11:31:02 +0100 [thread overview]
Message-ID: <20240118103102.658035-1-felix.moessbauer@siemens.com> (raw)
Cross compiling kernel modules for distro kernels is not supported in debian.
To simplify downstream kernel module builds, we automatically turn off cross
compilation for a user-provided module when building it for a distro kernel.
This patch further replaces the hard-coded list of distro kernels with
the DISTRO_KERNELS variable to avoid code duplication.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
RECIPE-API-CHANGELOG.md | 6 +++++
.../example-module/example-module.bb | 22 -------------------
meta/recipes-kernel/linux-module/module.inc | 10 +++++++++
3 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index bea12871..b1e5a5ab 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -566,3 +566,9 @@ supported, but a warning is issued when it is used. Future versions will drop
When building a custom kernel module, the `KBuild` file might be located in
a subdirectory. To support this use-case, set `MODULE_DIR=$(PWD)/subdir` in
the module build recipe.
+
+### Automatically disable cross for kmod builds against distro kernels
+
+Cross compiling kernel modules for distro kernels is not supported in debian.
+To simplify downstream kernel module builds, we automatically turn of cross
+compilation for a user-provided module when building it for a distro kernel.
diff --git a/meta-isar/recipes-kernel/example-module/example-module.bb b/meta-isar/recipes-kernel/example-module/example-module.bb
index 5ebed102..22f3cc47 100644
--- a/meta-isar/recipes-kernel/example-module/example-module.bb
+++ b/meta-isar/recipes-kernel/example-module/example-module.bb
@@ -5,28 +5,6 @@
#
# SPDX-License-Identifier: MIT
-# Cross-compilation is not supported for the default Debian kernels.
-# For example, package with kernel headers for ARM:
-# linux-headers-armmp
-# has hard dependencies from linux-compiler-gcc-4.8-arm, what
-# conflicts with the host binaries.
-python() {
- if d.getVar('KERNEL_NAME') in [
- 'armmp',
- 'arm64',
- 'rpi-rpfv',
- 'amd64',
- '686-pae',
- '4kc-malta',
- 'riscv64',
- 'kernel',
- 'kernel7',
- 'kernel7l',
- 'kernel8',
- ]:
- d.setVar('ISAR_CROSS_COMPILE', '0')
-}
-
require recipes-kernel/linux-module/module.inc
SRC_URI += "file://src"
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 269da6ae..eddbf177 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -28,6 +28,16 @@ SRC_URI += "file://debian/"
AUTOLOAD ?= ""
+# Cross-compilation is not supported for the default Debian kernels.
+# For example, package with kernel headers for ARM:
+# linux-headers-armmp
+# has hard dependencies from linux-compiler-gcc-4.8-arm, what
+# conflicts with the host binaries.
+python() {
+ if d.getVar('KERNEL_NAME') in d.getVar('DISTRO_KERNELS').split():
+ d.setVar('ISAR_CROSS_COMPILE', '0')
+}
+
inherit dpkg
TEMPLATE_FILES = "debian/control.tmpl \
--
2.39.2
next reply other threads:[~2024-01-18 10:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 10:31 Felix Moessbauer [this message]
2024-01-18 10:34 ` Jan Kiszka
2024-01-18 10:39 ` MOESSBAUER, Felix
2024-02-01 8:38 ` MOESSBAUER, Felix
2024-03-25 14:22 ` MOESSBAUER, Felix
2024-03-28 13:35 ` Uladzimir Bely
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=20240118103102.658035-1-felix.moessbauer@siemens.com \
--to=felix.moessbauer@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@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