diff --git a/board/visionfive2/genimage_spi-nor.cfg b/board/visionfive2/genimage_spi-nor.cfg new file mode 100644 index 0000000000..8b1d13989a --- /dev/null +++ b/board/visionfive2/genimage_spi-nor.cfg @@ -0,0 +1,36 @@ +flash nor-16M-256 { + pebsize = 4K + minimum-io-unit-size = 256 + numpebs = 4096 +} + +image spi-nor.img { + size = 16M + + flash { + } + + flashtype = "nor-16M-256" + + partition spl { + image = "u-boot-spl.bin.normal.out" + offset = 0K + size = 512K + } + + partition uboot-env { + offset = 960K + size = 64K + } + + partition uboot { + image = "u-boot.itb" + offset = 1M + size = 4M + } + + partition reserved-data { + offset = 6M + size = 10M + } +} diff --git a/board/visionfive2/post-image.sh b/board/visionfive2/post-image.sh new file mode 100755 index 0000000000..3da106dc26 --- /dev/null +++ b/board/visionfive2/post-image.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +support/scripts/genimage.sh -c board/visionfive2/genimage.cfg +support/scripts/genimage.sh -c board/visionfive2/genimage_spi-nor.cfg diff --git a/board/visionfive2/readme.txt b/board/visionfive2/readme.txt index 85be1d5dfc..cc4fece6e9 100644 --- a/board/visionfive2/readme.txt +++ b/board/visionfive2/readme.txt @@ -12,12 +12,27 @@ How to build $ make visionfive2_defconfig $ make +Once the build process is finished you will have two images +in the output/images/ directory: +- sdcard.img +- spi-nor.img + +How to write the SPI NOR flash +============================= + +If you have a booting device use u-boot and tftp: + + # tftpboot 0x82000000 spi-nor.img + # sf probe + # sf update 0x82000000 0x0 {filesize} + +Otherwise, follow the recovery instruction: + +https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/recovering_bootloader%20-%20vf2.html + How to write the SD card ======================== -Once the build process is finished you will have an image called "sdcard.img" -in the output/images/ directory. - Copy the bootable "sdcard.img" onto an SD card with "dd": $ sudo dd if=output/images/sdcard.img of=/dev/sdX @@ -27,7 +42,12 @@ 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): +Use the correct mode for booting: +- SD card RGPIO_0=1, GRPIO_1=0 +- SPI NOR flash RGPIO_0=1, GRPIO_1=1 + +Note that Buildroot puts the bootloader both in SPI NOR and on the SD card, +so after flashing as instructed above, either boot mode should work. https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/boot_mode_settings.html diff --git a/configs/visionfive2_defconfig b/configs/visionfive2_defconfig index ff738cc3a3..69c44dfbdd 100644 --- a/configs/visionfive2_defconfig +++ b/configs/visionfive2_defconfig @@ -1,8 +1,7 @@ BR2_riscv=y BR2_SYSTEM_DHCP="eth0" BR2_ROOTFS_OVERLAY="board/visionfive2/overlay" -BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" -BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/visionfive2/genimage.cfg" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/visionfive2/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.8.2"