[4/5] kernel: move common parts of linux-mainline to inc

Message ID 20260813164500.3092151-5-felix.moessbauer@siemens.com
State Under Review
Headers show
Series Fix single-name single-content rule for kernel packages | expand

Commit Message

MOESSBAUER, Felix Aug. 13, 2026, 4:44 p.m. UTC
As a preparation to provide linux-mainline for multiple targets, we move
the common parts (currently everything) to an .inc file and include that
in the kernel recipes.

No functional change.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../recipes-kernel/linux/linux-mainline.inc   | 45 +++++++++++++++++++
 .../linux/linux-mainline_6.12.85.bb           | 39 +---------------
 .../recipes-kernel/linux/linux-phy_6.12.85.bb |  2 +-
 3 files changed, 47 insertions(+), 39 deletions(-)
 create mode 100644 meta-isar/recipes-kernel/linux/linux-mainline.inc

Patch

diff --git a/meta-isar/recipes-kernel/linux/linux-mainline.inc b/meta-isar/recipes-kernel/linux/linux-mainline.inc
new file mode 100644
index 00000000..d93c8e51
--- /dev/null
+++ b/meta-isar/recipes-kernel/linux/linux-mainline.inc
@@ -0,0 +1,45 @@ 
+# Example recipe for building the mainline kernel
+#
+# This software is a part of Isar.
+# Copyright (c) Siemens AG, 2026
+#
+# SPDX-License-Identifier: MIT
+
+inherit linux-kernel
+
+ARCHIVE_VERSION = "${@ d.getVar('PV')[:-2] if d.getVar('PV').endswith('.0') else d.getVar('PV') }"
+
+SRC_URI += " \
+    https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${ARCHIVE_VERSION}.tar.xz \
+    file://ftpm-module.cfg \
+    file://subdir \
+    file://no-root-nfs.cfg;apply=no"
+
+SRC_URI[sha256sum] = "e35ac999f40a6874493d8d60f33f1150d7a89ae5841c428da82257fbcd070aed"
+
+S = "${WORKDIR}/linux-${ARCHIVE_VERSION}"
+
+SRC_URI:append:amd64 = " file://${KERNEL_DEFCONFIG}"
+KERNEL_DEFCONFIG:amd64 = "x86_64_defconfig"
+
+LINUX_VERSION_EXTENSION = "-isar"
+
+KERNEL_CONFIG_FRAGMENTS = "subdir/no-ubifs-fs.cfg"
+
+check_fragments_applied() {
+    grep -q "# CONFIG_MTD is not set" ${S}/debian/rules ||
+        cat << EOF | sed -i '/^override_dh_auto_build/ r /dev/stdin' ${S}/debian/rules
+	if ! grep "# CONFIG_MTD is not set" \$(O)/.config && \\
+	   ! grep "# CONFIG_MTD_UBI is not set" \$(O)/.config; then \\
+	    grep "# CONFIG_UBIFS_FS is not set" \$(O)/.config || \\
+	        (echo "Self-check failed: CONFIG_UBIFS_FS still enabled" && exit 1); \\
+	fi
+	grep "CONFIG_ROOT_NFS=y" \$(O)/.config || \\
+	    (echo "Self-check failed: CONFIG_ROOT_NFS not enabled" && exit 1)
+EOF
+}
+
+# For testing purposes only
+dpkg_configure_kernel:append() {
+    check_fragments_applied
+}
diff --git a/meta-isar/recipes-kernel/linux/linux-mainline_6.12.85.bb b/meta-isar/recipes-kernel/linux/linux-mainline_6.12.85.bb
index 786a9db8..11b90127 100644
--- a/meta-isar/recipes-kernel/linux/linux-mainline_6.12.85.bb
+++ b/meta-isar/recipes-kernel/linux/linux-mainline_6.12.85.bb
@@ -5,41 +5,4 @@ 
 #
 # SPDX-License-Identifier: MIT
 
-inherit linux-kernel
-
-ARCHIVE_VERSION = "${@ d.getVar('PV')[:-2] if d.getVar('PV').endswith('.0') else d.getVar('PV') }"
-
-SRC_URI += " \
-    https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${ARCHIVE_VERSION}.tar.xz \
-    file://ftpm-module.cfg \
-    file://subdir \
-    file://no-root-nfs.cfg;apply=no"
-
-SRC_URI[sha256sum] = "e35ac999f40a6874493d8d60f33f1150d7a89ae5841c428da82257fbcd070aed"
-
-S = "${WORKDIR}/linux-${ARCHIVE_VERSION}"
-
-SRC_URI:append:amd64 = " file://${KERNEL_DEFCONFIG}"
-KERNEL_DEFCONFIG:amd64 = "x86_64_defconfig"
-
-LINUX_VERSION_EXTENSION = "-isar"
-
-KERNEL_CONFIG_FRAGMENTS = "subdir/no-ubifs-fs.cfg"
-
-check_fragments_applied() {
-    grep -q "# CONFIG_MTD is not set" ${S}/debian/rules ||
-        cat << EOF | sed -i '/^override_dh_auto_build/ r /dev/stdin' ${S}/debian/rules
-	if ! grep "# CONFIG_MTD is not set" \$(O)/.config && \\
-	   ! grep "# CONFIG_MTD_UBI is not set" \$(O)/.config; then \\
-	    grep "# CONFIG_UBIFS_FS is not set" \$(O)/.config || \\
-	        (echo "Self-check failed: CONFIG_UBIFS_FS still enabled" && exit 1); \\
-	fi
-	grep "CONFIG_ROOT_NFS=y" \$(O)/.config || \\
-	    (echo "Self-check failed: CONFIG_ROOT_NFS not enabled" && exit 1)
-EOF
-}
-
-# For testing purposes only
-dpkg_configure_kernel:append() {
-    check_fragments_applied
-}
+require recipes-kernel/linux/linux-mainline.inc
diff --git a/meta-isar/recipes-kernel/linux/linux-phy_6.12.85.bb b/meta-isar/recipes-kernel/linux/linux-phy_6.12.85.bb
index a61befe2..33265f6b 100644
--- a/meta-isar/recipes-kernel/linux/linux-phy_6.12.85.bb
+++ b/meta-isar/recipes-kernel/linux/linux-phy_6.12.85.bb
@@ -1,4 +1,4 @@ 
-require recipes-kernel/linux/linux-mainline_${PV}.bb
+require recipes-kernel/linux/linux-mainline.inc
 
 SRC_URI:remove = "file://ftpm-module.cfg"
 SRC_URI:remove = "file://subdir/no-ubifs-fs.cfg"