2023-09-16
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
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
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.
DISK='/dev/mmcblk1'
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 \
${DISK}
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
#!/bin/sh
dev=$1
if [ -b $dev ]; then
echo "$dev exists"
else
echo "$dev doesn't exists"
exit
fi
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
#!/bin/sh
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
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
https://arvanta.net/alpine/alpine-on-visionfive/
to boot with this disk image boot switches must be set to boot from SDIO3.0 option according to this guide from starfive
https://doc-en.rvspace.org/VisionFive2/Quick_Start_Guide/VisionFive2_SDK_QSG/boot_mode_settings.html