Small recipe improvements for u-boot and opensbi
cover Small recipe improvements for u-boot and opensbi
Already shareable bits while testing a RISC-V board with isar-cip-core.
Jan
Jan Kiszka (5):
u-boot: Set COMPATIBLE_MACHINE to drop PREFERRED_PROVIDER_u-boot-*
u-boot: Add U_BOOT_EXTRA_BUILDARGS to rules.tmpl
opensbi: Refactor opensbi.inc
Update isar revision
opensbi-qemu-riscv64: Use the new class
conf/machine/bbb.conf | 1 -
conf/machine/qemu-arm.conf | 2 --
conf/machine/qemu-arm64.conf | 2 --
conf/machine/qemu-riscv64.conf | 2 --
kas-cip.yml | 2 +-
recipes-bsp/opensbi/files/qemu-riscv64-rules | 12 -------
.../opensbi/opensbi-qemu-riscv64_1.7.bb | 16 ++++++++--
recipes-bsp/opensbi/opensbi.inc | 32 -------------------
...bi-qemu-riscv64_1.7.bb => opensbi_1.7.inc} | 7 ++--
recipes-bsp/u-boot/files/rules.tmpl | 2 +-
recipes-bsp/u-boot/u-boot-bbb_2025.07.bb | 4 ++-
.../u-boot/u-boot-qemu-arm64_2025.07.bb | 4 ++-
recipes-bsp/u-boot/u-boot-qemu-arm_2025.07.bb | 4 ++-
.../u-boot/u-boot-qemu-riscv64_2025.07.bb | 4 ++-
14 files changed, 31 insertions(+), 63 deletions(-)
delete mode 100644 recipes-bsp/opensbi/files/qemu-riscv64-rules
delete mode 100644 recipes-bsp/opensbi/opensbi.inc
copy recipes-bsp/opensbi/{opensbi-qemu-riscv64_1.7.bb => opensbi_1.7.inc} (50%)Signature · 1 line
2.51.0
PATCH 1/5 u-boot: Set COMPATIBLE_MACHINE to drop PREFERRED_PROVIDER_u-boot-*
From: Jan Kiszka <[email protected]>
This is better to maintain as it keeps the key information local to the u-boot recipe.
--- conf/machine/bbb.conf | 1 - conf/machine/qemu-arm.conf | 2 -- conf/machine/qemu-arm64.conf | 2 -- conf/machine/qemu-riscv64.conf | 2 -- recipes-bsp/u-boot/u-boot-bbb_2025.07.bb | 4 +++- recipes-bsp/u-boot/u-boot-qemu-arm64_2025.07.bb | 4 +++- recipes-bsp/u-boot/u-boot-qemu-arm_2025.07.bb | 4 +++- recipes-bsp/u-boot/u-boot-qemu-riscv64_2025.07.bb | 4 +++- 8 files changed, 12 insertions(+), 11 deletions(-)
conf/machine/bbb.conf +0 -1
@@ -19,5 +19,4 @@ KERNEL_DEFCONFIG = "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/arm/cip_bbb_de # for SWUpdate setups: watchdog is configured in U-Boot WDOG_TIMEOUT = "0" -PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-bbb" PREFERRED_PROVIDER_factory-reset-helper = "factory-reset-helper-file"
conf/machine/qemu-arm.conf +0 -2
@@ -16,6 +16,4 @@ KERNEL_DEFCONFIG ?= "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/arm/qemu_arm_ # watchdog is not yet supported in our QEMU executor for this platform, disable it WDOG_TIMEOUT = "0" -PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-qemu-arm" - PREFERRED_PROVIDER_factory-reset-helper = "factory-reset-helper-file"
conf/machine/qemu-arm64.conf +0 -2
@@ -17,6 +17,4 @@ KERNEL_DEFCONFIG ?= "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/arm64/cip_mer # watchdog is not yet supported in our QEMU executor for this platform, disable it WDOG_TIMEOUT = "0" -PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-qemu-arm64" - PREFERRED_PROVIDER_factory-reset-helper = "factory-reset-helper-file"
conf/machine/qemu-riscv64.conf +0 -2
@@ -19,6 +19,4 @@ KERNEL_DEFCONFIG ?= "cip-kernel-config/${KERNEL_DEFCONFIG_VERSION}/riscv/cip_mer # watchdog is not yet supported in our QEMU executor for this platform, disable it WDOG_TIMEOUT = "0" -PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-qemu-riscv64" - PREFERRED_PROVIDER_factory-reset-helper = "factory-reset-helper-file"
recipes-bsp/u-boot/u-boot-bbb_2025.07.bb +3 -1
@@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2022-2024 +# Copyright (c) Siemens AG, 2022-2025 # # Authors: # Jan Kiszka <[email protected]>
@@ -11,6 +11,8 @@ require u-boot-common-${PV}.inc +COMPATIBLE_MACHINE = "bbb" + U_BOOT_CONFIG = "am335x_evm_defconfig" U_BOOT_BIN = "all"
recipes-bsp/u-boot/u-boot-qemu-arm64_2025.07.bb +3 -1
@@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2022 +# Copyright (c) Siemens AG, 2022-2025 # # Authors: # Jan Kiszka <[email protected]>
@@ -12,4 +12,6 @@ require u-boot-common-${PV}.inc require u-boot-qemu-common.inc +COMPATIBLE_MACHINE = "qemu-arm64" + U_BOOT_CONFIG = "qemu_arm64_defconfig"
recipes-bsp/u-boot/u-boot-qemu-arm_2025.07.bb +3 -1
@@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2022 +# Copyright (c) Siemens AG, 2022-2025 # # Authors: # Jan Kiszka <[email protected]>
@@ -12,4 +12,6 @@ require u-boot-common-${PV}.inc require u-boot-qemu-common.inc +COMPATIBLE_MACHINE = "qemu-arm" + U_BOOT_CONFIG = "qemu_arm_defconfig"
recipes-bsp/u-boot/u-boot-qemu-riscv64_2025.07.bb +3 -1
@@ -1,7 +1,7 @@ # # CIP Core, generic profile # -# Copyright (c) Siemens AG, 2022-2024 +# Copyright (c) Siemens AG, 2022-2025 # # Authors: # Jan Kiszka <[email protected]>
@@ -12,6 +12,8 @@ require u-boot-common-${PV}.inc require u-boot-qemu-common.inc +COMPATIBLE_MACHINE = "qemu-riscv64" + # we run as OpenSBI payload, hence use smode U_BOOT_CONFIG = "${MACHINE}_smode_defconfig"
Signature · 1 line
2.51.0
PATCH 2/5 u-boot: Add U_BOOT_EXTRA_BUILDARGS to rules.tmpl
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Upstream isar introduced that in 02e8053e6824. Will help to avoid forks of the common rules.
--- recipes-bsp/u-boot/files/rules.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-bsp/u-boot/files/rules.tmpl +1 -1
@@ -24,7 +24,7 @@ override_dh_auto_build: tools/efivar.py set -i ubootefi.var -n db -d secure-boot.esl -t file; \ fi $(MAKE) $(PARALLEL_MAKE) ${U_BOOT_CONFIG} - $(MAKE) $(PARALLEL_MAKE) ${U_BOOT_BIN} + $(MAKE) $(PARALLEL_MAKE) ${U_BOOT_EXTRA_BUILDARGS} ${U_BOOT_BIN} $(MAKE) -n u-boot-initial-env >/dev/null 2>&1; if [ $$? -ne 2 ]; then \ $(MAKE) $(PARALLEL_MAKE) u-boot-initial-env; \ else \
Signature · 1 line
2.51.0
PATCH 3/5 opensbi: Refactor opensbi.inc
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
The abstraction of opensbi.inc made some incorrect or suboptimal choices.
First of all, only QEMU will deploy a firmware.bin, other targets will more likely embed the output into another artifact (u-boot, disk image etc.).
Then, U-Boot may also be the integrator of the opensbi output. Therefore, pull all dependencies into the qemu recipe.
Factor out OPENSBI_DEPLOY_BIN to allow packaging different bits of the build process for other boards.
And finally, PLATFORM will most likely only be set to "generic", so hard-code this.
--- recipes-bsp/opensbi/opensbi-qemu-riscv64_1.7.bb | 13 +++++++++++++ recipes-bsp/opensbi/opensbi.inc | 17 ++--------------- 2 files changed, 15 insertions(+), 15 deletions(-)
recipes-bsp/opensbi/opensbi-qemu-riscv64_1.7.bb +13 -0
@@ -5,6 +5,19 @@ include opensbi.inc +inherit deploy-firmware + SRC_URI += "file://qemu-riscv64-rules" SRC_URI[opensbi.sha256sum] = "2cf856a4e5e2e052948ddb54ba48232b1f698b7f52e0374fc7d17d51e8c8f7ce" + +DEPENDS += "u-boot-qemu-riscv64" +DEBIAN_BUILD_DEPENDS .= ", u-boot-qemu-riscv64" + +OPENSBI_BIN = "fw_payload.bin" + +do_deploy_firmware() { + dpkg --fsys-tarfile "${WORKDIR}/${PN}_${PV}_${DISTRO_ARCH}.deb" | \ + tar xOf - "./usr/lib/opensbi/${MACHINE}/${OPENSBI_BIN}" \ + > "${DEPLOYDIR_FIRMWARE}/${OPENSBI_BIN}" +}
recipes-bsp/opensbi/opensbi.inc +2 -15
@@ -1,32 +1,19 @@ # -# Copyright (c) Siemens AG, 2023 +# Copyright (c) Siemens AG, 2023-2025 # # SPDX-License-Identifier: MIT inherit dpkg -inherit deploy-firmware - -U_BOOT_PACKAGE ?= "u-boot-${MACHINE}" -PLATFORM ?= "generic" SRC_URI = " \ https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz;name=opensbi" S = "${WORKDIR}/opensbi-${PV}" -DEPENDS += "${U_BOOT_PACKAGE}" -DEBIAN_BUILD_DEPENDS .= ",${U_BOOT_PACKAGE}" - do_prepare_build[cleandirs] += "${S}/debian" do_prepare_build() { cp ${WORKDIR}/${MACHINE}-rules ${WORKDIR}/rules deb_debianize - echo "build/platform/${PLATFORM}/firmware/fw_payload.bin /usr/lib/opensbi/${MACHINE}/" > ${S}/debian/install -} - -do_deploy_firmware() { - dpkg --fsys-tarfile "${WORKDIR}/${PN}_${PV}_${DISTRO_ARCH}.deb" | \ - tar xOf - "./usr/lib/opensbi/${MACHINE}/fw_payload.bin" \ - > "${DEPLOYDIR_FIRMWARE}/fw_payload.bin" + echo "build/platform/generic/firmware/${OPENSBI_BIN} /usr/lib/opensbi/${MACHINE}/" > ${S}/debian/install }
Signature · 1 line
2.51.0
PATCH 4/5 Update isar revision
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Specifically brings simplified OpenSBI building, some small fix for initramfs-tee-ftpm-hook and fixes in the recipe dependency chain of cross-built kernels.
--- kas-cip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kas-cip.yml +1 -1
@@ -22,7 +22,7 @@ repos: isar: url: https://github.com/ilbers/isar.git - commit: fd711088bc7eb84fb040c0fad5059e79a765bc89 + commit: 5bb743ad0ae4e87ef5a14ce4897c14694b46d0c5 layers: meta:
Signature · 1 line
2.51.0
PATCH 5/5 opensbi-qemu-riscv64: Use the new class
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
This simplifies our own recipe for qemu.
--- recipes-bsp/opensbi/files/qemu-riscv64-rules | 12 ------------ .../opensbi/opensbi-qemu-riscv64_1.7.bb | 7 ++----- recipes-bsp/opensbi/opensbi.inc | 19 ------------------- recipes-bsp/opensbi/opensbi_1.7.inc | 11 +++++++++++ 4 files changed, 13 insertions(+), 36 deletions(-) delete mode 100644 recipes-bsp/opensbi/files/qemu-riscv64-rules delete mode 100644 recipes-bsp/opensbi/opensbi.inc create mode 100644 recipes-bsp/opensbi/opensbi_1.7.inc
recipes-bsp/opensbi/files/qemu-riscv64-rules deleted +0 -12
@@ -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/qemu-riscv64/u-boot.bin - -%: - dh $@
recipes-bsp/opensbi/opensbi-qemu-riscv64_1.7.bb +2 -5
@@ -3,18 +3,15 @@ # # SPDX-License-Identifier: MIT -include opensbi.inc +include opensbi_${PV}.inc inherit deploy-firmware -SRC_URI += "file://qemu-riscv64-rules" - -SRC_URI[opensbi.sha256sum] = "2cf856a4e5e2e052948ddb54ba48232b1f698b7f52e0374fc7d17d51e8c8f7ce" - DEPENDS += "u-boot-qemu-riscv64" DEBIAN_BUILD_DEPENDS .= ", u-boot-qemu-riscv64" OPENSBI_BIN = "fw_payload.bin" +OPENSBI_EXTRA_BUILDARGS = "FW_PAYLOAD_PATH=/usr/lib/u-boot/qemu-riscv64/u-boot.bin" do_deploy_firmware() { dpkg --fsys-tarfile "${WORKDIR}/${PN}_${PV}_${DISTRO_ARCH}.deb" | \
recipes-bsp/opensbi/opensbi.inc deleted +0 -19
@@ -1,19 +0,0 @@ -# -# Copyright (c) Siemens AG, 2023-2025 -# -# SPDX-License-Identifier: MIT - -inherit dpkg - -SRC_URI = " \ - https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz;name=opensbi" - -S = "${WORKDIR}/opensbi-${PV}" - -do_prepare_build[cleandirs] += "${S}/debian" -do_prepare_build() { - cp ${WORKDIR}/${MACHINE}-rules ${WORKDIR}/rules - deb_debianize - - echo "build/platform/generic/firmware/${OPENSBI_BIN} /usr/lib/opensbi/${MACHINE}/" > ${S}/debian/install -}
recipes-bsp/opensbi/opensbi_1.7.inc new file +11 -0
@@ -0,0 +1,11 @@ +# +# Copyright (c) Siemens AG, 2023-2025 +# +# SPDX-License-Identifier: MIT + +inherit opensbi + +SRC_URI += "https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz;name=opensbi" +SRC_URI[opensbi.sha256sum] = "2cf856a4e5e2e052948ddb54ba48232b1f698b7f52e0374fc7d17d51e8c8f7ce" + +S = "${WORKDIR}/opensbi-${PV}"
Signature · 1 line
2.51.0