* [PATCH 1/3] meta: Add class for building custom OpenSBI firmware
2025-10-29 18:08 [PATCH 0/3] Simplify OpenSBI builds 'Jan Kiszka' via isar-users
@ 2025-10-29 18:08 ` 'Jan Kiszka' via isar-users
2025-10-29 18:08 ` [PATCH 2/3] opensbi-starfive-visionfive2: Use new obensbi class 'Jan Kiszka' via isar-users
2025-10-29 18:08 ` [PATCH 3/3] opensbi-sifive-fu540: " 'Jan Kiszka' via isar-users
2 siblings, 0 replies; 4+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-10-29 18:08 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This is supposed to simplify this customization task.
For the first time, this deviates from the *-custom.inc pattern used for
many other targets, using a class which is shorter to inherit. Other
targets should be converted to this pattern later on.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
RECIPE-API-CHANGELOG.md | 6 ++++++
meta/classes/opensbi.bbclass | 28 ++++++++++++++++++++++++++++
meta/recipes-bsp/opensbi/rules.tmpl | 19 +++++++++++++++++++
3 files changed, 53 insertions(+)
create mode 100644 meta/classes/opensbi.bbclass
create mode 100644 meta/recipes-bsp/opensbi/rules.tmpl
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index cf04fa5c..1826667a 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -791,3 +791,9 @@ Set `Rules-Requires-Root: no` in `debian/control` files to prevent unnecessary
invocation of fakeroot during package builds. This follows Debian guidelines
recommending not to use fakeroot when no privileged operations (e.g., `chown`,
root file modifications) are required.
+
+### Add opensbi class to simplify custom OpenSBI builds
+
+A new class called `opensbi` has been introduced that shall help writing
+shorter recipes for custom OpenSBI builds. Usage examples can be found in
+`meta-isar/recipes/bsp/opensbi`.
diff --git a/meta/classes/opensbi.bbclass b/meta/classes/opensbi.bbclass
new file mode 100644
index 00000000..4475bd95
--- /dev/null
+++ b/meta/classes/opensbi.bbclass
@@ -0,0 +1,28 @@
+# Custom OpenSBI build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+DESCRIPTION ?= "Custom OpenSBI"
+
+FILESPATH:append = ":${LAYERDIR_core}/recipes-bsp/opensbi"
+SRC_URI += "file://rules.tmpl"
+
+OPENSBI_PLATFORM ?= "generic"
+OPENSBI_EXTRA_BUILDARGS ?= ""
+
+TEMPLATE_FILES = "rules.tmpl"
+TEMPLATE_VARS += "OPENSBI_PLATFORM OPENSBI_EXTRA_BUILDARGS"
+
+do_prepare_build[cleandirs] += "${S}/debian"
+do_prepare_build() {
+ deb_debianize
+
+ for bin in ${OPENSBI_BIN}; do
+ echo "build/platform/${OPENSBI_PLATFORM}/firmware/$bin /usr/lib/opensbi/${MACHINE}/" >> ${S}/debian/install
+ done
+}
diff --git a/meta/recipes-bsp/opensbi/rules.tmpl b/meta/recipes-bsp/opensbi/rules.tmpl
new file mode 100644
index 00000000..935d033e
--- /dev/null
+++ b/meta/recipes-bsp/opensbi/rules.tmpl
@@ -0,0 +1,19 @@
+#!/usr/bin/make -f
+
+# Debian rules for custom OpenSBI build
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
+override_dh_auto_build:
+ CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=${OPENSBI_PLATFORM} \
+ ${OPENSBI_EXTRA_BUILDARGS}
+
+%:
+ dh $@
--
2.51.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/c2d7f863fbce0d38531c0313158f5085530ca0cb.1761761297.git.jan.kiszka%40siemens.com.
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/3] opensbi-starfive-visionfive2: Use new obensbi class
2025-10-29 18:08 [PATCH 0/3] Simplify OpenSBI builds 'Jan Kiszka' via isar-users
2025-10-29 18:08 ` [PATCH 1/3] meta: Add class for building custom OpenSBI firmware 'Jan Kiszka' via isar-users
@ 2025-10-29 18:08 ` 'Jan Kiszka' via isar-users
2025-10-29 18:08 ` [PATCH 3/3] opensbi-sifive-fu540: " 'Jan Kiszka' via isar-users
2 siblings, 0 replies; 4+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-10-29 18:08 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This simplifies the recipe, specifically obsoleting the need for an own
rules file.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../opensbi/files/starfive-visionfive2-rules | 12 ------------
.../opensbi/opensbi-starfive-visionfive2_1.4.bb | 17 +++++------------
2 files changed, 5 insertions(+), 24 deletions(-)
delete mode 100644 meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules
diff --git a/meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules b/meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules
deleted file mode 100644
index 452ff356..00000000
--- a/meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/make -f
-
-ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
-endif
-
-override_dh_auto_build:
- CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) \
- PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0
-
-%:
- dh $@
diff --git a/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.4.bb b/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.4.bb
index 766d1ed7..0b08a1af 100644
--- a/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.4.bb
+++ b/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.4.bb
@@ -1,25 +1,18 @@
#
-# Copyright (c) Siemens AG, 2023
+# Copyright (c) Siemens AG, 2023-2025
#
# SPDX-License-Identifier: MIT
-inherit dpkg
+inherit opensbi
DESCRIPTION = "OpenSBI firmware for StarFive VisionFive 2"
-SRC_URI = " \
- https://github.com/riscv-software-src/opensbi/archive/refs/tags/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz \
- file://starfive-visionfive2-rules"
+SRC_URI += "https://github.com/riscv-software-src/opensbi/archive/refs/tags/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz"
SRC_URI[sha256sum] = "319b62a4186fbce9b81a0c5f0ec9f003a10c808397a72138bc9745d9b87b1eb1"
S = "${WORKDIR}/opensbi-${PV}"
-do_prepare_build[cleandirs] += "${S}/debian"
-do_prepare_build() {
- cp ${WORKDIR}/starfive-visionfive2-rules ${WORKDIR}/rules
- deb_debianize
-
- echo "build/platform/generic/firmware/fw_dynamic.bin /usr/lib/opensbi/starfive-visionfive2/" > ${S}/debian/install
-}
+OPENSBI_EXTRA_BUILDARGS = "FW_TEXT_START=0x40000000 FW_OPTIONS=0"
+OPENSBI_BIN = "fw_dynamic.bin"
COMPATIBLE_MACHINE = "starfive-visionfive2"
--
2.51.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/cd86cc0fbc82f27f07e28a61cfb14490eeb17ab1.1761761297.git.jan.kiszka%40siemens.com.
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/3] opensbi-sifive-fu540: Use new obensbi class
2025-10-29 18:08 [PATCH 0/3] Simplify OpenSBI builds 'Jan Kiszka' via isar-users
2025-10-29 18:08 ` [PATCH 1/3] meta: Add class for building custom OpenSBI firmware 'Jan Kiszka' via isar-users
2025-10-29 18:08 ` [PATCH 2/3] opensbi-starfive-visionfive2: Use new obensbi class 'Jan Kiszka' via isar-users
@ 2025-10-29 18:08 ` 'Jan Kiszka' via isar-users
2 siblings, 0 replies; 4+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-10-29 18:08 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
This simplifies the recipe, specifically obsoleting the need for an own
rules file.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../recipes-bsp/opensbi/files/sifive-fu540-rules | 12 ------------
.../opensbi/opensbi-sifive-fu540_1.1.bb | 15 ++++-----------
2 files changed, 4 insertions(+), 23 deletions(-)
delete mode 100644 meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules
diff --git a/meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules b/meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules
deleted file mode 100644
index 98bc1b49..00000000
--- a/meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/make -f
-
-ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
-endif
-
-override_dh_auto_build:
- CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=generic \
- FW_PAYLOAD_PATH=/usr/lib/u-boot/sifive_unleashed/u-boot.bin
-
-%:
- dh $@
diff --git a/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_1.1.bb b/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_1.1.bb
index 8902e13e..b83c27c9 100644
--- a/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_1.1.bb
+++ b/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_1.1.bb
@@ -3,23 +3,16 @@
#
# SPDX-License-Identifier: MIT
-inherit dpkg
+inherit opensbi
-SRC_URI = " \
- https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz \
- file://sifive-fu540-rules"
+SRC_URI += "https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz"
SRC_URI[sha256sum] = "d183cb890130983a4f01e75fc03ee4f7ea0e16a7923b8af9c6dff7deb2fedaec"
S = "${WORKDIR}/opensbi-${PV}"
DEBIAN_BUILD_DEPENDS = "u-boot-sifive"
-do_prepare_build[cleandirs] += "${S}/debian"
-do_prepare_build() {
- cp ${WORKDIR}/sifive-fu540-rules ${WORKDIR}/rules
- deb_debianize
-
- echo "build/platform/generic/firmware/fw_payload.bin /usr/lib/opensbi/sifive-fu540/" > ${S}/debian/install
-}
+OPENSBI_EXTRA_BUILDARGS = "FW_PAYLOAD_PATH=/usr/lib/u-boot/sifive_unleashed/u-boot.bin"
+OPENSBI_BIN = "fw_payload.bin"
COMPATIBLE_MACHINE = "sifive-fu540"
--
2.51.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/d24674eb9796556c47c3d9249d39088426114f23.1761761297.git.jan.kiszka%40siemens.com.
^ permalink raw reply [flat|nested] 4+ messages in thread