Booting Arch Linux on the VisionFive 2 SBC with 16GB Intel Optane M10
cwt provides an Arch Linux image for the VisionFive 2 RISC-V single-board computer. In this image, U-Boot uses the mainline version, which, compared to the version provided by StarFive, cannot recognize the 16GB Optane M10 (MEMPEK1J016GAL) at boot. Here is the method to boot Arch Linux with 16GB Optane on the VisionFive 2 using the U-Boot provided by StarFive.
Preparation
Download the image ArchLinux-VF2_6.12_v6.0.0-cwt25.img.zst here,burn it to a micro SD card.
Download the SPL (u-boot-spl.bin.normal.out) and U-Boot (visionfive2_fw_payload.img) provided by StarFive here.
Boot the VisionFive 2
Insert the Optane and the micro SD card, set the RGPIO_0 switch to H (left side), connect Ethernet and power. The system should boot into Linux, login with ssh.
- Default user name:
user; password:user rootpassword:archriscv- hostname:
ArchVF2
If the /dev/mmcblk1p4 partition has not been expanded, expand it (refer to the “Extend the System Partition” section later, but change /dev/nvme0n1 to /dev/mmcblk1, or directly refer here and here) for the large image file.
Use scp to copy the image ArchLinux-VF2_6.12_v6.0.0-cwt25.img.zst, the StarFive version of u-boot-spl.bin.normal.out, and visionfive2_fw_payload.img into the card.
Burn the StarFive Version of U-Boot
sudo flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
sudo flashcp -v visionfive2_fw_payload.img /dev/mtd2
Install Arch Linux on the Optane
sudo blkdiscard /dev/nvme0n1 -f # Caution: will purge data on Optane
zstd -c -T0 -d ArchLinux-VF2_6.12_v6.0.0-cwt25.img.zst \
| sudo dd of=/dev/nvme0n1 bs=32M \
iflag=fullblock oflag=direct \
status=progress
Note: If restart at this point, even if the SD card is still inserted, the /home partition will be the version on the Optane rather than the version on the card.
Modify uEnv.txt
Mount the /boot partition on the Optane:
sudo mkdir /mnt/optaneboot
sudo mount /dev/nvme0n1p3 /mnt/optaneboot
Add the following content to the end of uEnv.txt (with root permissions):
# Fix wrong fdtfile name
fdtfile=starfive/jh7110-starfive-visionfive-2-v1.3b.dtb
Unmount the /boot partition on the Optane, then power off:
sudo umount /dev/nvme0n1p3
sudo poweroff
Reboot
Remove the SD card, set the RGPIO_0 switch to L (right side), then repower or press the RESET switch.
The system will boot into Arch Linux on the Optane (heartbeat LED blinking).
If it fails to boot normally, connect the TTL serial port, enter U-Boot, and restore the env to its default state:
env default -f -a
env save
Extend the System Partition
sudo fdisk /dev/nvme0n1
View the partition table with p:
Command (m for help): p
Disk /dev/nvme0n1: 13.41 GiB, 14403239936 bytes, 28131328 sectors
Disk model: INTEL MEMPEK1J016GAL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 57A4CE7A-AB9C-4AA5-9B07-5FD3BA412477
Device Start End Sectors Size Type
/dev/nvme0n1p1 4096 8191 4096 2M HiFive BBL
/dev/nvme0n1p2 8192 16383 8192 4M HiFive FSBL
/dev/nvme0n1p3 16384 221183 204800 100M EFI System
/dev/nvme0n1p4 221184 4605951 4384768 2.1G Linux filesystem
Delete the system partition 4 with d:
Command (m for help): d
Partition number (1-4, default 4): 4
Partition 4 has been deleted.
Re-create the partition 4 with n:
Command (m for help): n
Partition number (4-128, default 4): # Press Enter
First sector (221184-28131294, default 221184): # Press Enter
Last sector, +/-sectors or +/-size{K,M,G,T,P} (221184-28131294, default 28129279): # Press Enter
Created a new partition 4 of type 'Linux filesystem' and of size 13.3 GiB.
Partition #4 contains a btrfs signature.
Do you want to remove the signature? [Y]es/[N]o: n # Input `n` and press Enter
Review and write changes:
Command (m for help): p
Disk /dev/nvme0n1: 13.41 GiB, 14403239936 bytes, 28131328 sectors
Disk model: INTEL MEMPEK1J016GAL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 57A4CE7A-AB9C-4AA5-9B07-5FD3BA412477
Device Start End Sectors Size Type
/dev/nvme0n1p1 4096 8191 4096 2M HiFive BBL
/dev/nvme0n1p2 8192 16383 8192 4M HiFive FSBL
/dev/nvme0n1p3 16384 221183 204800 100M EFI System
/dev/nvme0n1p4 221184 28129279 27908096 13.3G Linux filesystem
Command (m for help): w
The partition table has been altered.
Syncing disks.
Extend the file system:
sudo btrfs filesystem resize max /
Review with df -h:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p4 14G 1.6G 12G 12% /
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 1.6G 1.8M 1.6G 1% /run
none 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service
tmpfs 3.9G 0 3.9G 0% /tmp
tmpfs 3.9G 0 3.9G 0% /var/tmp
/dev/nvme0n1p3 100M 22M 79M 22% /boot
/dev/nvme0n1p4 14G 1.6G 12G 12% /.snapshots
/dev/nvme0n1p4 14G 1.6G 12G 12% /home
/dev/nvme0n1p4 14G 1.6G 12G 12% /var/cache/pacman/pkg
/dev/nvme0n1p4 14G 1.6G 12G 12% /var/log
none 1.0M 0 1.0M 0% /run/credentials/serial-getty@ttyS0.service
none 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service
tmpfs 790M 4.0K 790M 1% /run/user/1000