HiFive Unmatched

From ALT Linux Wiki
Stub.png
Under construction.
This page is not finished yet and may lack substantial information.


HiFive Unmatched from SiFive is a Mini-ITX board powered by SiFive Freedom U740 RISC-V RV64GC SoC. It is supported by Sisyphus risc64 port. The board serves as build nodes for this port.

HiFive Unmatched is supported with un-def distribution kernel since 5.12.18-alt1.rv64 and u-boot since 2021.07-alt1.

ALT Images

Regular builds are produced weekly: Regular/riscv64.

Images can be written via alt-rootfs-installer or manually.

Graphical images (e.g. Xfce, MATE) are designed to work with a video card by default. If there is no video card, you can access the graphics via VNC: Regular/riscv64#VNC .


Write-in with alt-rootfs-installer

HiFive Unmatched target is supported by alt-roofs-installer 0.5.2 or newer.

root# alt-rootfs-installer --target=HiFive-Unmatched --image-in=/path/to/<image>-riscv64.img.xz --media=/dev/sdX

You can add --vnc=1 parameter here to enable the VNC server (e.g. if you don't have a video card installed). See Regular/riscv64#VNC .

Installing images manually

Step 0. Image write-in and mounting:

root$ xzcat /path/to/<image>-riscv64.img.xz | dd of=/dev/sdx bs=4M status=progress 
root$ udiskctl mount /dev/sdX2

The root partition will be mounted in /run/media/root/<UUID>

Step 1. Adding partitions for U-Boot SPL (Secondary Program Loader) and U-Boot :

root$ sgdisk -a 1 \
 --new=3:34:2081         --change-name=3:'spl' --typecode=3:5B193300-FC78-40CD-8002-E86C45580B47 \
 --new=4:2082:10273      --change-name=4:'uboot'  --typecode=4:2E54B353-1271-4842-806F-E436D6AF6985 \
/dev/sdX

Step 2.a. U-Boot SPL (Secondary Program Loader) and U-Boot binaries are located on the root partition of the image. Write them into partitions 3 and 4, respectively:

root$ dd if=/run/media/root/<UUID>/usr/share/u-boot/sifive_unmatched/u-boot-spl.bin of=/dev/sdX3 bs=1M
root$ dd if=/run/media/root/<UUID>/usr/share/u-boot/sifive_unmatched/u-boot.itb of=/dev/sdX4 bs=1M
root$ sync

Step 2.b. Alternative: download the latest version of the package u-boot-sifive-fu740. You can use the link from https://packages.altlinux.org/ru/sisyphus/srpms/u-boot-sifive-fu740/rpms.

Extract files u-boot-spl.bin and u-boot.itb from the package and write them into partitions 2 и 3, respectively:

user$ rpm2cpio u-boot-sifive-fu740-*riscv64.rpm | cpio -vi --to-stdout './usr/share/u-boot/sifive_unmatched/u-boot-spl.bin' > u-boot-spl.bin
user$ rpm2cpio u-boot-sifive-fu740-*riscv64.rpm | cpio -vi --to-stdout './usr/share/u-boot/sifive_unmatched/u-boot.itb' > u-boot.itb
root$ dd if=u-boot-spl.bin of=/dev/sdX3 bs=1M
root$ dd if=u-boot.itb of=/dev/sdX4 bs=1M
root$ sync

Step 3. Switch boot mode from EFI to extlinux.conf. To do this, we need to remove the boot toggle from the fat32 partition:

root$ parted /dev/sdX set 1 boot off

Root on NVME

The file system can be copied to NVME and and used as system root. For that, you can do the following.

Create a partition on NVME using fdisk. For example.

Format the partition:

mkfs.ext4 -m1 -L ROOT /dev/nvme0n1p1

Mount the partition:

mount /dev/nvme0n1p1 /mnt

Copy rootfs content to the NVME partition:

rsync -ax / /mnt

The -x option allows to copy rootfs content only, and ignore other mounted file systems. Copying can take a long time.

Have a look at UUID of NVME partition, for example, this way:

lsblk -f
NAME        FSTYPE       LABEL UUID                                 ...
...
└─nvme0n1p1 ext4   1.0   ROOT  dc155086-4ee4-42f6-87be-bcc67b2b93e6 ...

Put this UUID value into /mnt/boot/extlinux/extlinux.conf:

append root=UUID=dc155086-4ee4-42f6-87be-bcc67b2b93e6 ...

Also, update the root partition UUID in /mnt/etc/fstab:

UUID=dc155086-4ee4-42f6-87be-bcc67b2b93e6       /       ext4 ...

EFI on NVME

TBD.

Grub

TBD.