Skip to contentSkip to conversation

linux-cip: Add support for building branch heads

PATCH Superseded Jan Kiszka 1 participant 4 messages May 23, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

cover linux-cip: Add support for building branch heads

This turned out to be trickier than I thought, but now it seems to work fine. Please check.

Jan

Jan Kiszka (3):
linux-cip: Prepare for building from git branches
linux-cip: Add support for building head of development branches Expose kernel branch head recipes via kas option and Kconfig

 Kconfig                                       | 11 ++++++
 kas/opt/kernel-head.yml                       | 18 ++++++++++
 recipes-kernel/linux/linux-cip-common.inc     |  9 +----
 recipes-kernel/linux/linux-cip-head.inc       | 34 +++++++++++++++++++
 ...x-cip-common.inc => linux-cip-release.inc} | 11 ++----
 .../linux/linux-cip-rt_4.19-cip-head.bb       |  1 +
 .../linux-cip-rt_4.19.325-cip118-rt41.bb      |  2 +-
 .../linux/linux-cip-rt_4.4-cip-head.bb        |  1 +
 .../linux/linux-cip-rt_4.4.302-cip98-rt55.bb  |  2 +-
 .../linux/linux-cip-rt_5.10-cip-head.bb       |  1 +
 .../linux/linux-cip-rt_5.10.237-cip60-rt26.bb |  2 +-
 .../linux/linux-cip-rt_6.1-cip-head.bb        |  1 +
 .../linux/linux-cip-rt_6.1.134-cip41-rt22.bb  |  2 +-
 .../linux/linux-cip-rt_6.12-cip-head.bb       |  1 +
 .../linux/linux-cip_4.19-cip-head.bb          |  1 +
 .../linux/linux-cip_4.19.325-cip120.bb        |  2 +-
 .../linux/linux-cip_4.4-cip-head.bb           |  1 +
 .../linux/linux-cip_4.4.302-cip99.bb          |  2 +-
 .../linux/linux-cip_5.10-cip-head.bb          |  1 +
 .../linux/linux-cip_5.10.237-cip60.bb         |  2 +-
 .../linux/linux-cip_6.1-cip-head.bb           |  1 +
 .../linux/linux-cip_6.1.137-cip42.bb          |  2 +-
 .../linux/linux-cip_6.12-cip-head.bb          |  1 +
 .../linux/linux-cip_6.12.29-cip1.bb           |  2 +-
 24 files changed, 85 insertions(+), 26 deletions(-)
 create mode 100644 kas/opt/kernel-head.yml
 create mode 100644 recipes-kernel/linux/linux-cip-head.inc
 copy recipes-kernel/linux/{linux-cip-common.inc => linux-cip-release.inc} (50%)
 create mode 120000 recipes-kernel/linux/linux-cip-rt_4.19-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_4.4-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_5.10-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_6.1-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_6.12-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_4.19-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_4.4-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_5.10-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_6.1-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_6.12-cip-head.bb
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/3 linux-cip: Prepare for building from git branches

From: Jan Kiszka <[email protected]>

Split off to common bits that are relevant for all cip kernel builds from those that are only used when building release tarballs. This prepares to build from git branches as well.

---
 recipes-kernel/linux/linux-cip-common.inc             |  9 +--------
 .../{linux-cip-common.inc => linux-cip-release.inc}   | 11 ++---------
 .../linux/linux-cip-rt_4.19.325-cip118-rt41.bb        |  2 +-
 .../linux/linux-cip-rt_4.4.302-cip98-rt55.bb          |  2 +-
 .../linux/linux-cip-rt_5.10.237-cip60-rt26.bb         |  2 +-
 .../linux/linux-cip-rt_6.1.134-cip41-rt22.bb          |  2 +-
 recipes-kernel/linux/linux-cip_4.19.325-cip120.bb     |  2 +-
 recipes-kernel/linux/linux-cip_4.4.302-cip99.bb       |  2 +-
 recipes-kernel/linux/linux-cip_5.10.237-cip60.bb      |  2 +-
 recipes-kernel/linux/linux-cip_6.1.137-cip42.bb       |  2 +-
 recipes-kernel/linux/linux-cip_6.12.29-cip1.bb        |  2 +-
 11 files changed, 12 insertions(+), 26 deletions(-)
 copy recipes-kernel/linux/{linux-cip-common.inc => linux-cip-release.inc} (50%)
recipes-kernel/linux/linux-cip-common.inc +1 -8
index f20d6a06..aa625674 100644
@@ -11,17 +11,10 @@
 
 FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/files:"
 
-KERNEL_MAJOR_MINOR = "${@d.getVar('PV').split('.')[0] + '.' + d.getVar('PV').split('.')[1]}"
-
 KERNEL_DEFCONFIG_VERSION ?= "${KERNEL_MAJOR_MINOR}.y-cip"
 KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
 
 require recipes-kernel/linux/linux-custom.inc
 require recipes-kernel/linux/cip-kernel-config.inc
 
-SRC_URI += " \
-    https://cdn.kernel.org/pub/linux/kernel/projects/cip/${KERNEL_MAJOR_MINOR}/linux-cip-${PV}.tar.xz \
-    ${@'file://preempt-rt.cfg' if d.getVar('KERNEL_NAME') == 'cip-rt' else ''} \
-    "
-
-S = "${WORKDIR}/linux-cip-${PV}"
+SRC_URI += "${@'file://preempt-rt.cfg' if d.getVar('KERNEL_NAME') == 'cip-rt' else ''}"
recipes-kernel/linux/linux-cip-release.inc renamed from recipes-kernel/linux/linux-cip-common.inc +2 -9
similarity index 50%
copy from recipes-kernel/linux/linux-cip-common.inc
copy to recipes-kernel/linux/linux-cip-release.inc
index f20d6a06..25c2789b 100644
@@ -1,7 +1,7 @@
 #
 # CIP Core, generic profile
 #
-# Copyright (c) Siemens AG, 2022-2025
+# Copyright (c) Siemens, 2022-2025
 #
 # Authors:
 #  Jan Kiszka <[email protected]>
@@ -9,19 +9,12 @@
 # SPDX-License-Identifier: MIT
 #
 
-FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/files:"
+require linux-cip-common.inc
 
 KERNEL_MAJOR_MINOR = "${@d.getVar('PV').split('.')[0] + '.' + d.getVar('PV').split('.')[1]}"
 
-KERNEL_DEFCONFIG_VERSION ?= "${KERNEL_MAJOR_MINOR}.y-cip"
-KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
-
-require recipes-kernel/linux/linux-custom.inc
-require recipes-kernel/linux/cip-kernel-config.inc
-
 SRC_URI += " \
     https://cdn.kernel.org/pub/linux/kernel/projects/cip/${KERNEL_MAJOR_MINOR}/linux-cip-${PV}.tar.xz \
-    ${@'file://preempt-rt.cfg' if d.getVar('KERNEL_NAME') == 'cip-rt' else ''} \
     "
 
 S = "${WORKDIR}/linux-cip-${PV}"
recipes-kernel/linux/linux-cip-rt_4.19.325-cip118-rt41.bb +1 -1
index 1d791669..8c32f39c 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "ac71b31b34e89e7d6daf98a202806037e44203d5d79bc74da5c57f5c24ccf946"
recipes-kernel/linux/linux-cip-rt_4.4.302-cip98-rt55.bb +1 -1
index e5bfca91..8c88eb5e 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "70e223852d3a7f711dd511524243df512dcc7799010004b4d99e0acf1f95866a"
recipes-kernel/linux/linux-cip-rt_5.10.237-cip60-rt26.bb +1 -1
index 5440ae62..8edf6e85 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "e2d8fae539c6429e1680b9875b6b6c16792ee20a85d47b6f8c8227ef679c9886"
recipes-kernel/linux/linux-cip-rt_6.1.134-cip41-rt22.bb +1 -1
index eafe09b8..f4cc8d2a 100644
@@ -5,6 +5,6 @@
 #
 # SPDX-License-Identifier: MIT
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "8582da7b30925237cf4905988aefe0a8de23bb4e7546e6ebb998419ee121fa7e"
recipes-kernel/linux/linux-cip_4.19.325-cip120.bb +1 -1
index 9bdf79c0..cbeef699 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "9149d5ce9bd1a27ebb67358db8c81ef5c3e960c196007d501b731295ce8f7f69"
recipes-kernel/linux/linux-cip_4.4.302-cip99.bb +1 -1
index 4eea2e79..bb307304 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "ecc90814484dff84dae3f25ac2da7eb9156dc43c18acf2e806dc71ed4800b558"
recipes-kernel/linux/linux-cip_5.10.237-cip60.bb +1 -1
index 7cad5613..81e21268 100644
@@ -9,6 +9,6 @@
 # SPDX-License-Identifier: MIT
 #
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "be99dae17d2989965dc6dae2092067332f9965df0dcee8b7d517b823aac67990"
recipes-kernel/linux/linux-cip_6.1.137-cip42.bb +1 -1
index 124c205d..125fbe49 100644
@@ -5,6 +5,6 @@
 #
 # SPDX-License-Identifier: MIT
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "05e279c5e955e96c85be7f8b19b3cd7aba109343d7837bbfa9b9a1b6362ecf2b"
recipes-kernel/linux/linux-cip_6.12.29-cip1.bb +1 -1
index 5b8fbdbc..40a3a702 100644
@@ -5,6 +5,6 @@
 #
 # SPDX-License-Identifier: MIT
 
-require linux-cip-common.inc
+require linux-cip-release.inc
 
 SRC_URI[sha256sum] = "27bf5750e3ac4ed50b3cca0eb910e330eb3b24ec3d078af3d7d626123ba7b819"
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/3 linux-cip: Add support for building head of development branches

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

Add a recipe for each CIP kernel version series that selects via AUTOREV the head of the related git branch and builds the kernel from it. This enables earlier testing via isar-cip-core.

---
 recipes-kernel/linux/linux-cip-head.inc       | 34 +++++++++++++++++++
 .../linux/linux-cip-rt_4.19-cip-head.bb       |  1 +
 .../linux/linux-cip-rt_4.4-cip-head.bb        |  1 +
 .../linux/linux-cip-rt_5.10-cip-head.bb       |  1 +
 .../linux/linux-cip-rt_6.1-cip-head.bb        |  1 +
 .../linux/linux-cip-rt_6.12-cip-head.bb       |  1 +
 .../linux/linux-cip_4.19-cip-head.bb          |  1 +
 .../linux/linux-cip_4.4-cip-head.bb           |  1 +
 .../linux/linux-cip_5.10-cip-head.bb          |  1 +
 .../linux/linux-cip_6.1-cip-head.bb           |  1 +
 .../linux/linux-cip_6.12-cip-head.bb          |  1 +
 11 files changed, 44 insertions(+)
 create mode 100644 recipes-kernel/linux/linux-cip-head.inc
 create mode 120000 recipes-kernel/linux/linux-cip-rt_4.19-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_4.4-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_5.10-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_6.1-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip-rt_6.12-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_4.19-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_4.4-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_5.10-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_6.1-cip-head.bb
 create mode 120000 recipes-kernel/linux/linux-cip_6.12-cip-head.bb
recipes-kernel/linux/linux-cip-head.inc new file +34 -0
new file mode 100644
index 00000000..df604db0
@@ -0,0 +1,34 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens, 2025
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+require linux-cip-common.inc
+
+def get_commit(d):
+    try:
+        return bb.fetch2.get_srcrev(d).replace('AUTOINC+', '')
+    except bb.fetch2.FetchError:
+        return ""
+
+KERNEL_MAJOR_MINOR := "${@d.getVar('PV').split('-')[0]}"
+
+BRANCH := "${@ \
+    'linux-' + d.getVar('PV').split('-')[0] + '.y-cip' + \
+    ('-rt' if d.getVar('KERNEL_NAME') == 'cip-rt' and \
+              d.getVar('KERNEL_MAJOR_MINOR') in ['4.4', '4.19', '5.10', '6.1'] else '') \
+    }"
+
+PV .= "${@'-g' + get_commit(d)}"
+
+SRC_URI += "git://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git;protocol=https;branch=${BRANCH};name=cip-kernel"
+SRCREV_FORMAT = "cip-kernel"
+SRCREV_cip-kernel = "${AUTOREV}"
+
+S = "${WORKDIR}/git"
recipes-kernel/linux/linux-cip-rt_4.19-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip-rt_4.4-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip-rt_5.10-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip-rt_6.1-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip-rt_6.12-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip_4.19-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip_4.4-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip_5.10-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip_6.1-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
recipes-kernel/linux/linux-cip_6.12-cip-head.bb new file +1 -0
new file mode 120000
index 00000000..8f99b54e
@@ -0,0 +1 @@
+linux-cip-head.inc
\ No newline at end of file
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/3 Expose kernel branch head recipes via kas option and Kconfig

In reply to Jan Kiszka

From: Jan Kiszka <[email protected]>

The kas option file adjusts the PREFERRED_VERSION for the CIP kernel so that the corresponding head recipe is selected. This avoids having to define an option for each kernel version series.

---
 Kconfig                 | 11 +++++++++++
 kas/opt/kernel-head.yml | 18 ++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 kas/opt/kernel-head.yml
Kconfig +11 -0
index 0887125a..18560292 100644
@@ -113,6 +113,17 @@ config KAS_INCLUDE_KERNEL
 	default "kas/opt/6.1.yml" if KERNEL_6_1
 	default "kas/opt/6.12.yml" if KERNEL_6_12
 
+config KERNEL_HEAD
+	bool "Head of selected CIP kernel branch"
+	help
+	  Build head of the git branch that corresponds to the selected CIP
+	  kernel. May point to an unreleased state.
+
+config KAS_INCLUDE_KERNEL_HEAD
+	string
+	default "kas/opt/kernel-head.yml"
+	depends on KERNEL_HEAD
+
 config KERNEL_RT
 	bool "Real-time CIP kernel"
 	depends on !ARCH_RISCV64 || KERNEL_6_12
kas/opt/kernel-head.yml new file +18 -0
new file mode 100644
index 00000000..abb4d624
@@ -0,0 +1,18 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens, 2025
+#
+# Authors:
+#  Jan Kiszka <[email protected]>
+#
+# SPDX-License-Identifier: MIT
+#
+
+header:
+  version: 14
+
+local_conf_header:
+  kernel-version-head: |
+    PREFERRED_VERSION_linux-cip := "${@d.getVar('PREFERRED_VERSION_linux-cip').rsplit('.', 1)[0] + '-cip-head%'}"
+    PREFERRED_VERSION_linux-cip-rt := "${@d.getVar('PREFERRED_VERSION_linux-cip-rt').rsplit('.', 1)[0] + '-cip-head%'}"
Signature · 1 line
2.43.0