HiFive Unleashed

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

SiFive HiFive Unleashed is a RISC‑V development board featuring the Freedom U540 SoC. Its production is discontinued, but it's still supported by Sisyphus riscv64 port.

Regular Images and Simply Linux 10 were released for this board.

Quick start


Setup with alt-rootfs-installer

Regular images starting from 20220120 cannot be written with the following command because they use U-Boot 2022.01. You can use the version of alt-rootfs-installer from the branch devel by specifying --target=sifive_unleashed, or install manually.

You need alt-roofs-installer version 0.5.2 or higher.

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

In case of problems with older images, try using --target=HiFive-Unleashed-opensbi.

Manual setup

Starting with U-Boot 2022.01, a U-Boot SPL for Unleashed has been made (file /usr/share/u-boot/sifive_unleashed/u-boot-spl.bin), which is recommended to be used instead of FSBL.

When using this U-Boot, installing an image for Unleashed is similar to Unmatched and can be done as described in HiFive_Unmatched#Installing_images_manually.

All references to the usr/share/u-boot/sifive_unmatched directory should be replaced with usr/share/u-boot/sifive_unleashed.

Disk image

To run images on SiFive HiFive Unleashed (FU540) SoC, follow these steps:

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 First Stage BootLoader (FSBL) and U-Boot :

root# sgdisk -a 1 \
        --new=3::+32K    --change-name=3:'fsbl'          --typecode=3:5B193300-FC78-40CD-8002-E86C45580B47 \
        --new=4::+8M:    --change-name=4:'opensbi-uboot' --typecode=4:2E54B353-1271-4842-806F-E436D6AF6985 \

Step 2.a. First Stage BootLoader (FSBL) and OpenSBI 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/fu540_boot/fsbl.bin of=/dev/sdX3 bs=1M
root# dd if=/run/media/root/<UUID>/usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin of=/dev/sdX4 bs=1M
root# sync

Step 2.b. Alternative: download and install packages with FSBL and OpenSBI, then write down in partitions 3 and 4. For example, like this:

root# curl -O http://ftp.altlinux.org/pub/distributions/ALTLinux/ports/riscv64/Sisyphus/noarch/RPMS.classic/fu540-bootloaders-0-alt1.git54bfc90.noarch.rpm
root# curl -O http://ftp.altlinux.org/pub/distributions/ALTLinux/ports/riscv64/Sisyphus/noarch/RPMS.classic/opensbi-firmware-fu540-0.6-alt1.noarch.rpm
root# rpm -i fu540-bootloaders-0-alt1.git54bfc90.noarch.rpm
root# rpm -i opensbi-firmware-fu540-0.6-alt1.noarch.rpm
root# dd if=/usr/share/fu540_boot/fsbl.bin of=/dev/sdX3 bs=1M
root# dd if=/usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin 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 filesystem image

To run the SiFive HiFive Unleashed (FU540) SoC with one of the rootfs images one could proceed through the following steps:

Step 0. Through this manual it is assumed that microSD card is at /dev/sdb. Let us create file systems at the microSD:

root$ sgdisk -g --clear \
        --new=2::+32K    --change-name=2:'fsbl'          --typecode=2:5B193300-FC78-40CD-8002-E86C45580B47 \
        --new=3::+8M:    --change-name=3:'opensbi-uboot' --typecode=3:2E54B353-1271-4842-806F-E436D6AF6985 \
        --new=1::-0      --change-name=1:'root'          --typecode=1:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
root$ mkfs.ext4 /dev/sdb1
root$ mount /dev/sdb1 /mnt
root$ tar -xpvf hifive-unleashed-riscv64.tar.xz -C /mnt

Step 1.a. The First Stage BootLoader (FSBL) and OpenSBI are placed inside the unpacked /mnt tree. Let us write them to the 2 and 3 partitions respectively, and then unmount /mnt partition.

root$ dd if=/mnt/usr/share/fu540_boot/fsbl.bin of=/dev/sdb2 bs=1M
root$ dd if=/mnt/usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin of=/dev/sdb3 bs=1M
root$ sync; umount /mnt

Step 1.b. Alternative option: download and install the First Stage BootLoader (FSBL) and OpenSBI for FU540.

For example:

root$ curl -O http://ftp.altlinux.org/pub/distributions/ALTLinux/ports/riscv64/Sisyphus/noarch/RPMS.classic/fu540-bootloaders-0-alt1.git54bfc90.noarch.rpm
root$ curl -O http://ftp.altlinux.org/pub/distributions/ALTLinux/ports/riscv64/Sisyphus/noarch/RPMS.classic/opensbi-firmware-fu540-0.6-alt1.noarch.rpm
root$ rpm -i fu540-bootloaders-0-alt1.git54bfc90.noarch.rpm
root$ rpm -i opensbi-firmware-fu540-0.6-alt1.noarch.rpm
root$ dd if=/usr/share/fu540_boot/fsbl.bin of=/dev/sdb2 bs=1M
root$ dd if=/usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin of=/dev/sdb3 bs=1M
root$ sync; umount /mnt

Step 3. System at microSD is ready to boot. For a graphical system, the system setup is performed through VNC.