@@ -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`.
new file mode 100644
@@ -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
+}
new file mode 100644
@@ -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 $@