[v4,1/6] starfive-visionfive2: package u-boot

Message ID 20230410094252.1151370-2-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 u-boot firmware for the starfive visionfive2 board.
As the image is signed at build time, but verified at runtime, we get a
rather complex cross dependency chain around openssl. To not diverge
from the official visionfive2 BSP example, we keep the image signing.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 ...five-visionfive2_2022.01-rc4+VF2-2.11.5.bb | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb

Comments

Jan Kiszka June 4, 2023, 9:26 a.m. UTC | #1
On 10.04.23 11:42, Felix Moessbauer wrote:
> This patch adds the u-boot firmware for the starfive visionfive2 board.
> As the image is signed at build time, but verified at runtime, we get a
> rather complex cross dependency chain around openssl. To not diverge
> from the official visionfive2 BSP example, we keep the image signing.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  ...five-visionfive2_2022.01-rc4+VF2-2.11.5.bb | 31 +++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb
> 
> diff --git a/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb b/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb
> new file mode 100644
> index 00000000..0eeedc1a
> --- /dev/null
> +++ b/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb
> @@ -0,0 +1,31 @@
> +#
> +# Copyright (c) Siemens AG, 2023
> +#
> +# SPDX-License-Identifier: MIT
> +
> +require recipes-bsp/u-boot/u-boot-custom.inc
> +
> +SRC_URI += "git://github.com/starfive-tech/u-boot.git;branch=JH7110_VisionFive2_devel;protocol=https;destsuffix=u-boot-${PV}"
> +SRCREV = "ac0ac696256abf412826d74ee918dd417e207d7b"

This is not a stable reference: JH7110_VisionFive2_devel is rebasing,
and now it left ac0ac696 orphaned behind [1].

Looking at u-boot master, upcoming 2023.07 will support the chip with
theses drivers:

1. ns16550 UART Driver.
2. StarFive JH7110 clock Driver.
3. StarFive JH7110 reset Driver.
4. Cadence QSPI controller Driver.
5. MMC SPI Driver for MMC/SD support.

Wouldn't that be enough for now? USB is missing which might be nice if
booting from an emulated stick but the standard scenarios should work -
and using some U-Boot 2023.07-rcX will not break CI again.

Jan

PS: Your recipe claims to be 2022.01-rc4-something but the U-Boot
baseline is actually 2021.10. Maybe selected the wrong sha?

[1]
https://github.com/starfive-tech/u-boot/commit/ac0ac696256abf412826d74ee918dd417e207d7b

Patch

diff --git a/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb b/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb
new file mode 100644
index 00000000..0eeedc1a
--- /dev/null
+++ b/meta-isar/recipes-bsp/u-boot/u-boot-starfive-visionfive2_2022.01-rc4+VF2-2.11.5.bb
@@ -0,0 +1,31 @@ 
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+require recipes-bsp/u-boot/u-boot-custom.inc
+
+SRC_URI += "git://github.com/starfive-tech/u-boot.git;branch=JH7110_VisionFive2_devel;protocol=https;destsuffix=u-boot-${PV}"
+SRCREV = "ac0ac696256abf412826d74ee918dd417e207d7b"
+
+DEBIAN_BUILD_DEPENDS .= ", libssl-dev:${DISTRO_ARCH}"
+# when cross compiling, we need the library on the host as well, as the signature computation is done locally
+DEBIAN_BUILD_DEPENDS .= "${@ ', libssl-dev:${HOST_ARCH}' if d.getVar('ISAR_CROSS_COMPILE') == '1' else '' }"
+
+U_BOOT_CONFIG = "starfive_visionfive2_defconfig"
+U_BOOT_BIN = "u-boot.bin"
+U_BOOT_SPL_BIN = "spl/u-boot-spl.bin"
+
+S = "${WORKDIR}/u-boot-${PV}"
+
+# install dtb files for opensbi
+do_prepare_build[cleandirs] += "${S}/debian"
+do_prepare_build:append() {
+    # also build and install spl component
+    sed -i 's|${U_BOOT_BIN}|${U_BOOT_BIN} ${U_BOOT_SPL_BIN}|g' ${S}/debian/rules
+    echo "${U_BOOT_SPL_BIN} usr/lib/u-boot/${MACHINE}/" \
+        >> ${S}/debian/u-boot-${MACHINE}.install
+    # install device tree
+    echo "arch/riscv/dts/*.dtb usr/share/u-boot/${MACHINE}/" \
+        >> ${S}/debian/u-boot-${MACHINE}-dev.install
+}