From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: daniel.bovensiepen@siemens.com, jan.kiszka@siemens.com,
florian.bezdeka@siemens.com,
Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 6/7] starfive-visionfive2: create u-boot firmware
Date: Sun, 29 Jan 2023 05:38:55 +0000 [thread overview]
Message-ID: <20230129053856.4014419-7-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20230129053856.4014419-1-felix.moessbauer@siemens.com>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
.../files/rules.tmpl | 12 ++++++
.../files/visionfive2-u-boot-firmware.install | 1 +
.../visionfive2-uboot-fit-image.its.tmpl | 41 +++++++++++++++++++
.../visionfive2-u-boot-firmware.bb | 36 ++++++++++++++++
4 files changed, 90 insertions(+)
create mode 100644 meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/rules.tmpl
create mode 100644 meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-u-boot-firmware.install
create mode 100644 meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-uboot-fit-image.its.tmpl
create mode 100644 meta-isar/recipes-bsp/visionfive2-u-boot-firmware/visionfive2-u-boot-firmware.bb
diff --git a/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/rules.tmpl b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/rules.tmpl
new file mode 100644
index 00000000..7af08044
--- /dev/null
+++ b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/rules.tmpl
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+
+KERNEL_VERSION=$(shell find /usr/lib/ -maxdepth 1 -type d -name 'linux-image-*' | head -1 | sed 's/.*linux-image-//g')
+
+override_dh_auto_configure:
+ sed -i 's|<KERNEL_VERSION>|$(KERNEL_VERSION)|g' visionfive2-uboot-fit-image.its
+
+override_dh_auto_build:
+ mkimage -A riscv -O u-boot -T multi -f ${IMAGE_ITS_FILE} visionfive2_fw_payload.img
+
+%:
+ dh $@
diff --git a/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-u-boot-firmware.install b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-u-boot-firmware.install
new file mode 100644
index 00000000..d1bdf6d6
--- /dev/null
+++ b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-u-boot-firmware.install
@@ -0,0 +1 @@
+visionfive2_fw_payload.img usr/share/visionfive2-u-boot-firmware
diff --git a/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-uboot-fit-image.its.tmpl b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-uboot-fit-image.its.tmpl
new file mode 100644
index 00000000..8b00288b
--- /dev/null
+++ b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/files/visionfive2-uboot-fit-image.its.tmpl
@@ -0,0 +1,41 @@
+/dts-v1/;
+
+/ {
+ description = "U-boot-spl FIT image for JH7110 VisionFive2";
+ #address-cells = <2>;
+
+ images {
+ firmware {
+ description = "u-boot";
+ data = /incbin/("/usr/lib/opensbi/starfive-visionfive2/fw_payload.bin");
+ type = "firmware";
+ arch = "riscv";
+ os = "u-boot";
+ load = <0x0 0x40000000>;
+ entry = <0x0 0x40000000>;
+ compression = "none";
+ };
+ fdt {
+ description = "DTB";
+ data = /incbin/("/usr/lib/linux-image-<KERNEL_VERSION>/${DTB_FILES}");
+ type = "flat_dt";
+ arch = "riscv64";
+ compression = "gzip";
+ load = <0x46000000>;
+ entry = <0x46000000>;
+ hash {
+ algo = "sha1";
+ };
+ };
+ };
+
+ configurations {
+ default = "config-1";
+
+ config-1 {
+ description = "U-boot-spl FIT config for JH7110 VisionFive2";
+ firmware = "firmware";
+ fdt = "fdt";
+ };
+ };
+};
diff --git a/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/visionfive2-u-boot-firmware.bb b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/visionfive2-u-boot-firmware.bb
new file mode 100644
index 00000000..b2303968
--- /dev/null
+++ b/meta-isar/recipes-bsp/visionfive2-u-boot-firmware/visionfive2-u-boot-firmware.bb
@@ -0,0 +1,36 @@
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+DESCRIPTION = "StarFive VisionFive 2 u-boot firmware"
+
+IMAGE_ITS_FILE = "visionfive2-uboot-fit-image.its"
+SRC_URI = " \
+ file://${IMAGE_ITS_FILE}.tmpl \
+ file://rules.tmpl \
+ file://visionfive2-u-boot-firmware.install"
+
+DEPENDS += "opensbi-starfive-visionfive2 linux-image-${KERNEL_NAME}"
+DEBIAN_BUILD_DEPENDS += "opensbi-starfive-visionfive2, u-boot-tools, device-tree-compiler, linux-image-${KERNEL_NAME}"
+
+TEMPLATE_FILES = "${IMAGE_ITS_FILE}.tmpl rules.tmpl"
+TEMPLATE_VARS = "IMAGE_ITS_FILE DTB_FILES"
+
+do_prepare_build[cleandirs] += "${S}/debian"
+do_prepare_build(){
+ cp ${WORKDIR}/${IMAGE_ITS_FILE} ${S}/
+ cp ${WORKDIR}/visionfive2-u-boot-firmware.install ${S}/debian/
+ deb_debianize
+}
+
+do_deploy() {
+ dpkg --fsys-tarfile ${WORKDIR}/visionfive2-u-boot-firmware_${PV}*.deb | \
+ tar xOf - "./usr/share/visionfive2-u-boot-firmware/visionfive2_fw_payload.img" \
+ > "${DEPLOY_DIR_IMAGE}/visionfive2_fw_payload.img"
+}
+
+addtask deploy after do_dpkg_build before do_build
+do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
--
2.34.1
next prev parent reply other threads:[~2023-01-29 5:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 5:38 [PATCH 0/7] Add BSP for StarFiveTech VisionFive2 Risc-V board Felix Moessbauer
2023-01-29 5:38 ` [PATCH 1/7] u-boot: inject debian multi-arch config Felix Moessbauer
2023-01-29 5:38 ` [PATCH 2/7] starfive-visionfive2: package u-boot Felix Moessbauer
2023-01-29 5:38 ` [PATCH 3/7] starfive-visionfive2: package opensbi firmware Felix Moessbauer
2023-01-29 5:38 ` [PATCH 4/7] starfive-visionfive2: add BSP kernel Felix Moessbauer
2023-01-29 5:38 ` [PATCH 5/7] starfive-visionfive2: create u-boot-spl firmware Felix Moessbauer
2023-01-29 5:38 ` Felix Moessbauer [this message]
2023-01-29 5:38 ` [PATCH 7/7] starfive-visionfive2: add machine Felix Moessbauer
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=20230129053856.4014419-7-felix.moessbauer@siemens.com \
--to=felix.moessbauer@siemens.com \
--cc=daniel.bovensiepen@siemens.com \
--cc=florian.bezdeka@siemens.com \
--cc=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