HiFive Unmatched

From ALT Linux Wiki
Revision as of 08:56, 24 December 2021 by Mari (talk | contribs) (translate of russian version from 2021-12-15.)
Stub.png
Under construction.
This page is not finished yet and may lack substantial information.


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

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

ALT Images

Regular builds currently are being collected weekly: Regular/riscv64. Images must be written via alt-rootfs-installer or manually.

Write-in with alt-rootfs-installer

It is required to install alt-roofs-installer version 0.5.2 or higher.

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

If a graphics adapter is not installed on the board and an image with graphics is recorded, then --vnc = 1 option must be added. For more details on this mode, 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 to write-in 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. U-Boot SPL (Secondary Program Loader) and U-Boot located in the root partition of the written image. Write them into sections 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. We can use the link riscv64 from the page 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

VNC

The image is designed to work with a video card by default. If there is no video card, we need to activate the mode vnc: Regular/riscv64#VNC .

Root на NVME

We can copy the file system to NVME and specify it as root = in /boot/extlinux/extlinux.conf.

Create a partition on NVME using fdisk, for example.

Format NVME 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 only rootfs content and not other supported 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 ...

Fix value UUID in the file /mnt/boot/extlinux/extlinux.conf:

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

Fix value UUID in the file /mnt/etc/fstab:

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

EFI на NVME

TBD.

Grub

TBD.