Updating SPL and U-Boot of Flash

To update SPL and U-Boot of flash for VisionFive 2, two methods are provided:

Note: For instructions to create SPL and fw_payload (U-Boot) files, refer to Creating SPL File and Creating fw_payload File sections in the VisionFive 2 Single Board Computer Software Technical Reference Manual.
  1. Through the tftpboot command as described in Through tftpboot Command.
  2. Through the flashcp command as described in Through flashcp Command.
    Note: Method 2 only supports versions equal to or later than VF2_v2.5.0.

Through tftpboot Command

To update SPL and U-Boot through the tftpboot command, perform the following steps:

  1. Prepare the TFTP server. The following is an example command for Ubuntu distribution.
    sudo apt install tftpd-hpa
  2. Power on VisionFive 2 and wait until it enters the U-Boot command line interface.
  3. Configure the environment variables by executing:
    setenv ipaddr 192.168.120.222;setenv serverip 192.168.120.99
  4. Check the connectivity by pinging the host PC from VisionFive 2.
  5. Initialize SPI flash:
    sf probe
  6. Update SPL binary:
    tftpboot 0xa0000000 ${serverip}:u-boot-spl.bin.normal.out
    sf update 0xa0000000 0x0 $filesize
  7. Update U-Boot binary:
    tftpboot 0xa0000000 ${serverip}:visionfive2_fw_payload.img
    sf update 0xa0000000 0x100000 $filesize

Through flashcp Command

To update SPL and U-Boot through the flashcp command, perform the following steps:

Note: This method only supports versions equal to or later than VF2_v2.5.0.
  1. Install the mtd-utils package by executing the following command:
    apt install mtd-utils
  2. Transfer the latest u-boot-spl.bin.normal.out and visionfive2_fw_payload.img files to Debian system through SCP.
  3. Execute the following command to check the MTD partition:
    cat /proc/mtd
    Example Output:

    You will see the partition information in the QSPI flash:

    dev:    size   erasesize  name
    mtd0: 00020000 00001000 "spl"
    mtd1: 00300000 00001000 "uboot"
    mtd2: 00100000 00001000 "data"
    
  4. Update the SPL and U-Boot binaries according to different partitions:
    • Example command to update SPL:
      flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
    • Example command to update U-Boot:
      flashcp -v visionfive2_fw_payload.img  /dev/mtd1
    Example Command and Output:
    # flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
    Erasing blocks: 32/32 (100%)
    Writing data: 124k/124k (100%)
    Verifying data: 124k/124k (100%)
    
    # flashcp -v visionfive2_fw_payload.img  /dev/mtd1
    Erasing blocks: 682/682 (100%)
    Writing data: 2727k/2727k (100%)
    Verifying data: 2727k/2727k (100%)
    
  5. Restart the system to make the updates take effect.