From 6dfeb165ee9170920e9a0b1f021170a736ac4d73 Mon Sep 17 00:00:00 2001 From: Lukasz Tekieli Date: Thu, 8 Feb 2024 22:15:17 +0100 Subject: [PATCH] board/visionfive2: enable u-boot Enables U-Boot and required OpenSBI builds for the VisionFive2. Changes the sdcard.img to use GPT and adds the SPL and U-Boot to partitions specified in U-Boot's documentation for the board: https://docs.u-boot.org/en/v2024.01/board/starfive/visionfive2.html U-Boot config uses BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME with value "u-boot.itb". Using BR2_TARGET_UBOOT_FORMAT_ITB fails, because the build does not support u-boot.itb make target. Signed-off-by: Lukasz Tekieli [Peter: document boot mode setting, add U-Boot documentation link] Signed-off-by: Peter Korsgaard --- board/visionfive2/genimage.cfg | 16 +++++++++------- board/visionfive2/readme.txt | 4 ++++ configs/visionfive2_defconfig | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/board/visionfive2/genimage.cfg b/board/visionfive2/genimage.cfg index c221b49c7b..8133e740c0 100644 --- a/board/visionfive2/genimage.cfg +++ b/board/visionfive2/genimage.cfg @@ -2,20 +2,22 @@ image sdcard.img { hdimage { + partition-table-type = "gpt" } - # u-boot is hard coded to look at 3rd partition - partition dummy1 { - size = 512 + partition spl { + partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 + image = "u-boot-spl.bin.normal.out" } - partition dummy2 { - size = 512 + partition uboot { + partition-type-uuid = BC13C2FF-59E6-4262-A352-B275FD6F7172 + image = "u-boot.itb" } partition rootfs { - partition-type = 0x83 + partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + bootable = true image = "rootfs.ext4" - bootable = "true" } } diff --git a/board/visionfive2/readme.txt b/board/visionfive2/readme.txt index 1924cbc12b..85be1d5dfc 100644 --- a/board/visionfive2/readme.txt +++ b/board/visionfive2/readme.txt @@ -27,6 +27,10 @@ Preparing the board Connect a TTL UART cable to pin 6 (GND), 8 (TX) and 10 (RX). +Change the boot mode pins to SD card booting (RGPIO_0=1, GRPIO_1=0): + +https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/boot_mode_settings.html + Insert your SD card. Power-up the board using an USB-C cable. diff --git a/configs/visionfive2_defconfig b/configs/visionfive2_defconfig index 3a1a4f527c..c8576a35a7 100644 --- a/configs/visionfive2_defconfig +++ b/configs/visionfive2_defconfig @@ -15,4 +15,23 @@ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y # BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_OPENSBI=y +BR2_TARGET_OPENSBI_CUSTOM_VERSION=y +BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE="1.4" +BR2_TARGET_OPENSBI_PLAT="generic" +# BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG is not set +BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES="FW_TEXT_START=0x40000000 FW_OPTIONS=0" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.01" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="starfive_visionfive2" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y +BR2_TARGET_UBOOT_NEEDS_OPENSBI=y +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot.itb" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin.normal.out" BR2_PACKAGE_HOST_GENIMAGE=y