public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH 1/3] meta: Add class for building custom OpenSBI firmware
Date: Wed, 29 Oct 2025 19:08:15 +0100	[thread overview]
Message-ID: <c2d7f863fbce0d38531c0313158f5085530ca0cb.1761761297.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1761761297.git.jan.kiszka@siemens.com>

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.

  reply	other threads:[~2025-10-29 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2d7f863fbce0d38531c0313158f5085530ca0cb.1761761297.git.jan.kiszka@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox