Method 2: Adding Startup Item

Prerequisite

Make sure you have executed the steps in Generating DTB.

Perform the following steps to replace the DTB file by adding startup item:

  1. Insert the micro-SD card to the PC with Ubuntu system, and execute the following command to check the SD card partition:
    sudo fdisk -l
    Example Output:
    Device      Start     End Sectors  Size Type
    /dev/sdc1    4096    8191    4096    2M unknown
    /dev/sdc2    8192   16383    8192    4M unknown
    /dev/sdc3   16384  221183  204800  100M EFI System
    /dev/sdc4  221184 4503518 4282335    2G Linux filesystem
    

    In this output, the /dev/sdc3 partition is the SD card partition.

  2. Mount the SD card partition under the mnt file path by executing:
    sudo mount /dev/sdc3 /mnt
  3. Execute the following commands under the Linux root directory:
    sudo cp arch/riscv/boot/dts/starfive/<DTB_File> /mnt/dtbs/starfive
    sudo umount /mnt
    Tip:
    Different boards use different dtb files:
    • jh7110-visionfive-v2.dtb: for version 1.2A and 1.3B board.
    • jh7110-visionfive-v2-ac108.dtb: for version 1.2A and 1.3B board with ac108 codec.
    • jh7110-visionfive-v2-wm8960.dtb: for version 1.2A and 1.3B board with wm8960 codec.
    Tip: You can refer to the silk print on the board for the version information.
    Example Command:
    sudo cp arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtb /mnt/dtbs/starfive
  4. Open extlinux.conf by executing:
    sudo vim /mnt/extlinux/extlinux.conf
  5. Added the following lines, save and exit:
    label l1
    	menu label Debian GNU/Linux bookworm/sid 5.15.0-starfive (customized)
    	linux /vmlinuz-5.15.0-starfive
    	initrd /initrd.img-5.15.0-starfive
    	fdt /dtbs/starfive/<DTB_File>
    	append  root=/dev/mmcblk1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0
    
    label l1r
    	menu label Debian GNU/Linux bookworm/sid 5.15.0-starfive (customized)(rescue target)
    	linux /vmlinuz-5.15.0-starfive
    	initrd /initrd.img-5.15.0-starfive
    	fdt /dtbs/starfive/<DTB_File>
    	append  root=/dev/mmcblk1p4 rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0 single
    
  6. Remove the micro-SD card from PC and insert it into VisionFive 2, and power on VisionFive 2.
  7. You will see the customized menu item, for example, Debian GNU/Linux bookworm/sid 5.15.0-starfive (customized), in the U-Boot startup menu. Select this item.