[3/7] starfive-visionfive2: package opensbi firmware

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

Commit Message

MOESSBAUER, Felix Jan. 29, 2023, 5:38 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 +++++++++++
 .../opensbi-starfive-visionfive2_2.8.0.bb     | 30 +++++++++++++++++++
 2 files changed, 47 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_2.8.0.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_2.8.0.bb b/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_2.8.0.bb
new file mode 100644
index 00000000..658d4b45
--- /dev/null
+++ b/meta-isar/recipes-bsp/opensbi/opensbi-starfive-visionfive2_2.8.0.bb
@@ -0,0 +1,30 @@ 
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+DESCRIPTION = "OpenSBI firmware for StarFive VisionFive 2"
+
+SRC_URI = " \
+    git://github.com/starfive-tech/opensbi.git;destsuffix=opensbi-${PV};branch=JH7110_VisionFive2_devel \
+    file://starfive-visionfive2-rules.tmpl"
+SRCREV = "7700244f4d334d765ee5d994c3849ade09fb6844"
+
+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
+}