@@ -1175,6 +1175,10 @@ DPKG_ARCH ?= "${DISTRO_ARCH}"
Firmware packages are an exception because they are built for only one architecture.
+**Note**: This rule also applies to kernel packages. Set `KERNEL_NAME` to an
+architecture- or machine-specific name, as appropriate. If the kernel is built
+in different modes (such as prod or debug), encode the mode in the name too.
+
### Add Hyper-V machine support
A new machine `hyper-v` has been introduced for building images
@@ -628,11 +628,22 @@ For example, in your machine configuration:
```bitbake
KERNEL_NAME = "armmp"
-KERNEL_NAMES = "armmp mainline"
+KERNEL_NAMES = "armmp mainline-arm64"
```
When `KERNEL_NAMES` is set, recipes inheriting the `per-kernel` class will generate variants for each listed kernel. Installation of each must be explicitly handled in the image.
+Kernel source packages contain architecture-specific content. Therefore, builds
+for multiple architectures must publish source packages with distinct names.
+For a kernel built for only one target, the name may remain unchanged.
+
+Generic kernel recipes can append `${DISTRO_ARCH}` to `PN`, to provide the
+kernel for all architectures.
+
+```
+PN .= "-${DISTRO_ARCH}"
+```
+
---
## Add a New Image
@@ -5,7 +5,7 @@
DISTRO_ARCH ?= "arm64"
-KERNEL_NAME ?= "mainline"
+KERNEL_NAME ?= "mainline-${DISTRO_ARCH}"
IMAGE_FSTYPES ?= "wic"
WKS_FILE ?= "beagleplay.wks.in"
@@ -5,7 +5,7 @@
DISTRO_ARCH ?= "armhf"
-KERNEL_NAME ?= "mainline"
+KERNEL_NAME ?= "mainline-${DISTRO_ARCH}"
U_BOOT_CONFIG:de0-nano-soc = "socfpga_de0_nano_soc_defconfig"
U_BOOT_BIN:de0-nano-soc = "u-boot-with-spl.sfp"
@@ -5,7 +5,7 @@
DISTRO_ARCH = "arm64"
-KERNEL_NAME ?= "mainline"
+KERNEL_NAME ?= "mainline-${DISTRO_ARCH}"
IMAGE_FSTYPES = "wic"
WKS_FILE ?= "hikey"
@@ -5,4 +5,4 @@
include conf/machine/qemuamd64.conf
-KERNEL_NAME = "cip"
+KERNEL_NAME = "cip-${DISTRO_ARCH}"
@@ -5,7 +5,7 @@
DISTRO_ARCH = "riscv64"
-KERNEL_NAME ?= "mainline"
+KERNEL_NAME ?= "mainline-${DISTRO_ARCH}"
IMAGE_FSTYPES ?= "wic"
WKS_FILE ?= "sifive-fu540"
@@ -5,7 +5,7 @@
DISTRO_ARCH ?= "armhf"
-KERNEL_NAME ?= "mainline"
+KERNEL_NAME ?= "mainline-${DISTRO_ARCH}"
U_BOOT_CONFIG:stm32mp15x = "stm32mp15_trusted_defconfig"
U_BOOT_BIN:stm32mp15x = "u-boot.stm32"
@@ -5,6 +5,8 @@
#
# SPDX-License-Identifier: MIT
+PN .= "-${DISTRO_ARCH}"
+
inherit linux-kernel
SRC_URI += " \
@@ -5,4 +5,6 @@
#
# SPDX-License-Identifier: MIT
+PN .= "-${DISTRO_ARCH}"
+
require recipes-kernel/linux/linux-mainline.inc
@@ -627,7 +627,7 @@ class KernelTests(CIBaseTest):
"""Test per-kernel recipe variants for external kernel modules."""
targets = ['mc:qemuarm64-bookworm:isar-image-ci']
- kernel_names = self.params.get('kernel_names', default='mainline')
+ kernel_names = self.params.get('kernel_names', default='mainline-arm64')
kernel_names = [k.strip() for k in kernel_names.split(',') if k.strip()]
modules = [f"example-module-{k}" for k in kernel_names]
modules.append('example-module-${KERNEL_NAME}')
The kernel source packages are specific to at least the architecture, but also other aspects like machine and prod / debug configurations. The linux-mainline and linux-cip kernels here are only architecture specific, so we now encode the architecture in the KERNEL_NAME. For other kernels that are already specific to a machine, we don't encode the architecture in the name as this would be redundant. For the kernel recipes which are generic (like mainline and cip), we simply extend the PN with -${DISTRO_ARCH}, so bitbake can find the dependency and instanciate an architecture specific variant. By that, we also need to adapt the default in test_per_kernel, which explicitly builds the module for the kernel that corresponds to the multiconfig target. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> --- RECIPE-API-CHANGELOG.md | 4 ++++ doc/user_manual.md | 13 ++++++++++++- meta-isar/conf/machine/beagleplay.conf | 2 +- meta-isar/conf/machine/de0-nano-soc.conf | 2 +- meta-isar/conf/machine/hikey.conf | 2 +- meta-isar/conf/machine/qemuamd64-cip.conf | 2 +- meta-isar/conf/machine/sifive-fu540.conf | 2 +- meta-isar/conf/machine/stm32mp15x.conf | 2 +- .../recipes-kernel/linux/linux-cip_4.4.166-cip29.bb | 2 ++ .../recipes-kernel/linux/linux-mainline_6.12.85.bb | 2 ++ testsuite/citest.py | 2 +- 11 files changed, 27 insertions(+), 8 deletions(-)