u-boot Starfive VisionFive V2 SBC with Alpine Linux


usual disclaimer: no one is responsible for any damage/loss by using this

note: Alpine repository for VisionFive is here https://gitlab.alpinelinux.org/nmeum/alpine-visionfive

kernel APKBUILD and config is here https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/tree/main/starfive/linux-starfive

u-boot APKBUILD and patches are here https://gitlab.alpinelinux.org/nmeum/alpine-visionfive/-/tree/main/starfive/u-boot-jh7110

Also there is IRC channel #alpine-riscv64 on OFTC for discussion about development and help

u-boot and opensbi (so called firmware) for Visionfive V2 could be installed to SPI flash or to MMC card or to EMMC card

this version of u-boot automatically detect RAM size and pass it to kernel.

also it detects board version and set proper DTB file name so extlinux.conf can use

fdtdir /boot-starfive/

instead of full file name (for example)

fdt /dtbs-starfive/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb

tools needed can be installed by:
apk add sgdisk mtd-utils-flash

current Alpine Linux u-boot for this SBC could be downloaded from http://starfive.infra.alpinelinux.org/starfive/riscv64/u-boot-jh7110-0_git20231016-r0.apk and installed by command

apk add --allow-untrusted u-boot-jh7110-0_git20231016-r0.apk

Installing it to E/MMC requires to create specific partition schemes with specifying partitions type codes.


sgdisk --clear \
  --set-alignment=2 \
  --new=1:4096:+2MiB: --change-name=1:spl --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985\
  --new=2::+4MiB: --change-name=2:uboot --typecode=2:BC13C2FF-59E6-4262-A352-B275FD6F7172  \
  --new=3::+128MiB: --change-name=3:boot --typecode=3:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 \
  --new 4::: -c 4:root \

sgdisk --attributes=3:set:2 ${DISK}
# change DISK variable for device name where partitions should be created

and flashing firmware/u-boot with script adding device name:

for example flash.sh /dev/mmcblk1

if [ -b $dev ]; then
  echo "$dev exists"
  echo "$dev doesn't exists"
dd if=/usr/share/u-boot-jh7110/u-boot-spl.bin.normal.out of=${dev}p1
dd if=/usr/share/u-boot-jh7110/u-boot.itb of=${dev}p2

flashing to SPI flash need mtd-utils-flash package installed

flashcp -v /usr/share/u-boot-jh7110/u-boot-spl.bin.normal.out /dev/mtd0
flashcp -v /usr/share/u-boot-jh7110/u-boot.itb /dev/mtd3

after reboot u-boot will try to boot from MMC, EMMC and NVME, in this order

forced boot can be done by breaking u-boot (press any key while it counting timeout) and run:

run bootcmd_nvme0

to boot from nvme even when mmc and/or emmc are plugged in

there is ready made alpine disk image which could be copied to MMC with `dd` command and how to prepare it is described here:


to boot with this disk image boot switches must be set to boot from SDIO3.0 option according to this guide from starfive