[v2,7/7] starfive-visionfive2: add machine

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

Commit Message

MOESSBAUER, Felix Feb. 11, 2023, 9:21 a.m. UTC
This patch adds the RISCV64 based StarFive VisionFive 2 machine.
The target still needs a custom kernel and also only works from debian
bookworm on.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta-isar/conf/local.conf.sample              |  1 +
 .../conf/machine/starfive-visionfive2.conf    | 29 +++++++++++++++++++
 .../starfive-visionfive2-sid-ports.conf       |  7 +++++
 .../canned-wks/starfive-visionfive2.wks.in    | 23 +++++++++++++++
 4 files changed, 60 insertions(+)
 create mode 100644 meta-isar/conf/machine/starfive-visionfive2.conf
 create mode 100644 meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf
 create mode 100644 meta-isar/scripts/lib/wic/canned-wks/starfive-visionfive2.wks.in

Patch

diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 7e0184e4..47f473a1 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -77,6 +77,7 @@  BBMULTICONFIG = " \
     rpi-arm-v7l-bullseye \
     rpi-arm64-v8-bullseye \
     sifive-fu540-sid-ports \
+    starfive-visionfive2-sid-ports \
     qemuarm64-focal \
     qemuamd64-focal \
 "
diff --git a/meta-isar/conf/machine/starfive-visionfive2.conf b/meta-isar/conf/machine/starfive-visionfive2.conf
new file mode 100644
index 00000000..a07b064f
--- /dev/null
+++ b/meta-isar/conf/machine/starfive-visionfive2.conf
@@ -0,0 +1,29 @@ 
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+DISTRO_ARCH = "riscv64"
+
+KERNEL_NAME ?= "starfive"
+
+PREFERRED_PROVIDER_u-boot-starfive-visionfive2 = "u-boot-starfive-visionfive2"
+
+IMAGE_FSTYPES ?= "wic"
+
+WKS_FILE ?= "starfive-visionfive2.wks.in"
+IMAGER_INSTALL += " \
+    jh7110-u-boot-spl-image \
+    visionfive2-u-boot-firmware \
+    ${SYSTEMD_BOOTLOADER_INSTALL}"
+IMAGER_BUILD_DEPS += " \
+    jh7110-u-boot-spl-image \
+    visionfive2-u-boot-firmware"
+
+IMAGE_INSTALL += "sshd-regen-keys"
+IMAGE_INSTALL += "expand-on-first-boot"
+
+# DTB file for OpenSBI
+DTB_UBOOT_JH7110_VF2 = "starfive_visionfive2.dtb"
+# DTB file for booting
+DTB_FILES = "starfive/jh7110-visionfive-v2.dtb"
diff --git a/meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf b/meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf
new file mode 100644
index 00000000..98c9534a
--- /dev/null
+++ b/meta-isar/conf/multiconfig/starfive-visionfive2-sid-ports.conf
@@ -0,0 +1,7 @@ 
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+MACHINE = "starfive-visionfive2"
+DISTRO = "debian-sid-ports"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/starfive-visionfive2.wks.in b/meta-isar/scripts/lib/wic/canned-wks/starfive-visionfive2.wks.in
new file mode 100644
index 00000000..0f3d76a9
--- /dev/null
+++ b/meta-isar/scripts/lib/wic/canned-wks/starfive-visionfive2.wks.in
@@ -0,0 +1,23 @@ 
+#
+# Copyright (c) Siemens AG, 2023
+#
+# SPDX-License-Identifier: MIT
+
+# The partition layout is based on the VisionFive2 example image:
+# https://github.com/starfive-tech/VisionFive2/blob/JH7110_VisionFive2_devel/Makefile#L394
+# However, instead of booting via ubootenv + fit, we boot fit + efi
+#
+# When booting from the SD card, make sure that the DIP switches are set to SD card.
+# By that, the board reads the u-boot firmware from the SD instead of the internal flash.
+# This is required to boot efi with the correct device tree, which is included in the fit image.
+
+# SPL
+part --source rawcopy --sourceparams "file=/usr/share/jh7110-uboot-spl-image/u-boot-spl.bin.normal.out" --ondisk mmcblk1 --fixed-size  2M --offset 2M --part-type 2E54B353-1271-4842-806F-E436D6AF6985
+# U-Boot FIT
+part --source rawcopy --sourceparams "file=/usr/share/visionfive2-u-boot-firmware/visionfive2_fw_payload.img" --ondisk mmcblk1 --fixed-size  4M --offset 4M --part-type 5B193300-FC78-40CD-8002-E86C45580B47
+# EFI
+part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --use-uuid --label efi --part-type EF00 --align 1024
+# rootfs
+part / --source rootfs --use-uuid --fstype ext4 --mkfs-extraopts "-T default" --label image --active --align 1024 --exclude-path=boot/
+
+bootloader --ptable gpt --timeout=0 --append "console=tty0 console=ttyS0,115200 earlycon rootwait"