Jump to: navigation, search

Tips and Tricks for the VisionFive 2 board.

Downstream firmware construction


  • branch: JH7110_VisionFive2_devel
  • config: starfive_visionfive2_defconfig
    • Set CONFIG_DISTRO_DEFAULTS=y if you want to boot from the preload FDT.


  • branch: master, platform=generic


  • Required tools:
    • spl_tool/create_spl
    • uboot_its/visionfive2-uboot-fit-image.its

FW boot sequence:

  • BootROM -> u-boot SPL -> openSBI (PLATFORM: generic) -> u-boot (as openSBI FW_PAYLOAD)


# u-boot compile                                                                   
make -C u-boot -j8 ARCH=riscv CROSS_COMPILE=riscv64-suse-linux-                    
# opensbi compile                                                                   
make -C opensbi ARCH=riscv CROSS_COMPILE=riscv64-suse-linux- \                     
  PLATFORM=generic FW_PAYLOAD_PATH=../u-boot/u-boot.bin \                          
  FW_FDT_PATH=../u-boot/arch/riscv/dts/starfive_visionfive2.dtb FW_TEXT_START=0x40000000
# spl                                                                              
cd tools/spl_tool                                                                  
./create_sbl ../../u-boot/spl/u-boot-spl.bin 0x01010101                            
cd ../..                                                                           
# u-boot payload                                                                   
cd tools/uboot_its                                                                 
cp ../../opensbi/build/platform/generic/firmware/fw_payload.bin .                  
../../u-boot/tools/mkimage -f visionfive2-uboot-fit-image.its -A riscv -O u-boot \
  -T firmware visionfive2_fw_payload.img                                           
cd ../../                                                                          
rm -rf build                                                                       
mkdir build                                                                                                                                                                
cp tools/spl_tool/u-boot-spl.bin.normal.out build/                                 
cp tools/uboot_its/visionfive2_fw_payload.img build/

Firmware update to QSPI flash via u-boot

  • Select the boot mode switch to RGPIO_0 = 0'b, RGPIO_1 = 0'b. (1-bit QSPI Nor Flash)
  • Copy u-boot-spl.bin.normal.out and visionfive2_fw_payload.img to your tftp server.
  • set the u-boot IP and the tftp server IP, for example:
setenv ipaddr; setenv serverip
  • Run the following u-boot commands:
#SPI flash probe
sf probe
# Download and flash the u-boot SPL
tftpboot 0xa0000000 ${serverip}:u-boot-spl.bin.normal.out
sf update 0xa0000000 0x0 $filesize
# Download and flash opensbi+u-boot-payload
tftpboot 0xa0000000 ${serverip}:visionfive2_fw_payload.img
sf update 0xa0000000 0x100000 $filesize
  • Board reset

Firmware update via StarFive image

Boot the StarFive image and then flash firmware blobs through MTD devices. First determine the mtd target devices via

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00001000 "spl"
mtd1: 00010000 00001000 "uboot-env"
mtd2: 00400000 00001000 "uboot"
mtd3: 00a00000 00001000 "reserved-data"

Then run

sudo flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
sudo flashcp -v visionfive2_fw_payload.img /dev/mtd2

Flash firmware from openSUSE repo

  • Download the visionfive2-firmware rpm package from the repo
  • Unpack the package and use the same steps from the downstream approach to dump firmware blobs into the flash although the visionfive2_fw_payload.img is replaced by u-boot.itb.

Firmware recovery tool


payload won't fit into /dev/mtd1!

# flashcp -v visionfive2_fw_payload.img /dev/mtd1
visionfive2_fw_payload.img won't fit into /dev/mtd1!

Cause: You likely used the wrong mtd device. Check the mtd partition table:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00001000 "spl"
mtd1: 00010000 00001000 "uboot-env"
mtd2: 00400000 00001000 "uboot"
mtd3: 00a00000 00001000 "reserved-data"

You need to use the spl and uboot partitions.

See also

See also