[v4,2/6] starfive-visionfive2: package opensbi firmware

Message ID 20230410094252.1151370-3-felix.moessbauer@siemens.com
State Accepted, archived
Headers show
Series Add BSP for StarFiveTech VisionFive2 Risc-V board | expand

Commit Message

MOESSBAUER, Felix April 10, 2023, 9:42 a.m. UTC
This patch adds the opensbi firmware for the starfive visionfive2 board,
based on the official BSP package.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 .../files/starfive-visionfive2-rules.tmpl     | 17 ++++++++++
 ...ensbi-starfive-visionfive2_1.2+20230310.bb | 31 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules.tmpl
 create mode 100644 meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.2+20230310.bb

Patch

diff --git a/meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules.tmpl b/meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules.tmpl
new file mode 100644
index 00000000..5f35c1c2
--- /dev/null
+++ b/meta-isar/recipes-bsp/opensbi/files/starfive-visionfive2-rules.tmpl
@@ -0,0 +1,17 @@ 
+#!/usr/bin/make -f
+
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
+UBOOT_DTB_FILE := /usr/share/u-boot/starfive-visionfive2/${DTB_UBOOT_JH7110_VF2}
+FW_TEXT_START := 0x40000000
+
+override_dh_auto_build:
+	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_MAKE) PLATFORM=generic \
+		FW_PAYLOAD_PATH=/usr/lib/u-boot/starfive-visionfive2/u-boot.bin \
+		FW_FDT_PATH=$(UBOOT_DTB_FILE) \
+		FW_TEXT_START=$(FW_TEXT_START)
+
+%:
+	dh $@
diff --git a/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.2+20230310.bb b/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.2+20230310.bb
new file mode 100644
index 00000000..86be2932
--- /dev/null
+++ b/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_1.2+20230310.bb
@@ -0,0 +1,31 @@ 
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+DESCRIPTION = "OpenSBI firmware for StarFive VisionFive 2"
+
+SRC_URI = " \
+    git://github.com/riscv-software-src/opensbi.git;destsuffix=opensbi-${PV};protocol=https;branch=master \
+    file://starfive-visionfive2-rules.tmpl"
+# required patches are not yet part of a release, but will be in 1.3
+SRCREV = "2868f26131308ff345382084681ea89c5b0159f1"
+
+S = "${WORKDIR}/opensbi-${PV}"
+TEMPLATE_FILES += "starfive-visionfive2-rules.tmpl"
+TEMPLATE_VARS += "DTB_UBOOT_JH7110_VF2"
+
+DEPENDS = "u-boot-starfive-visionfive2"
+DEBIAN_BUILD_DEPENDS = " \
+    u-boot-starfive-visionfive2, \
+    u-boot-starfive-visionfive2-dev"
+
+do_prepare_build[cleandirs] += "${S}/debian"
+do_prepare_build() {
+    cp ${WORKDIR}/starfive-visionfive2-rules ${WORKDIR}/rules
+    deb_debianize
+
+    echo "build/platform/generic/firmware/fw_payload.bin /usr/lib/opensbi/starfive-visionfive2/" > ${S}/debian/install
+}