HiFive Unmatched: Difference between revisions

From ALT Linux Wiki
(translate of russian version from 2021-12-15.)
mNo edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Stub}}
{{Stub}}


[https://www.sifive.com/boards/hifive-unmatched HiFive Unmatched] from [https://www.sifive.com SiFive] is a Mini-ITX form factor board powered by the SiFive Freedom U740 RISC-V RV64GC SoC. It is supported with [[Ports/riscv64|Sisyphus risc64 port]]. The board serves as build nodes in this port.
[https://www.sifive.com/boards/hifive-unmatched HiFive Unmatched] from [https://www.sifive.com SiFive] is a Mini-ITX board powered by SiFive Freedom U740 SoC. It is supported by [[Ports/riscv64|Sisyphus riscv64 port]]. HiFive Umatched boards are used as build nodes for 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.
The board is supported by un-def distribution kernel since 5.12.18-alt1.rv64 and u-boot since 2021.07-alt1.


== ALT Images ==
== ALT Images ==


Regular builds currently are being collected weekly: [[Regular/riscv64]]. Images must be written via alt-rootfs-installer or manually.
HiFive Unmatched is supported by weekly regular builds: [[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 ===
=== Write-in with alt-rootfs-installer ===


It is required to install alt-roofs-installer version 0.5.2 or higher.
HiFive Unmatched target is supported by alt-roofs-installer 0.5.2 or newer.


<source lang="shell">
<source lang="shell">
Line 17: Line 21:
</source>
</source>


If a graphics adapter is not installed on the board and an image with graphics is recorded, then --vnc = 1 option must be added.
You can add <tt>--vnc=1</tt> parameter here to enable the VNC server (e.g. if you don't have a video card installed). See  [[ Regular/riscv64#VNC ]].
For more details on this mode, see: [[ Regular/riscv64#VNC ]].  


== Installing images manually  ==
== Installing images manually  ==
Line 31: Line 34:
The root partition will be mounted in /run/media/root/<UUID>
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 :
'''Step 1.''' Adding partitions for  U-Boot SPL (Secondary Program Loader) and U-Boot :


<source lang="shell">
<source lang="shell">
Line 40: Line 43:
</source>
</source>


'''Step 2.''' U-Boot SPL (Secondary Program Loader) and U-Boot located in the root partition of the written image.
'''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 sections 3 and 4, respectively:
Write them into partitions 3 and 4, respectively:


<source lang="shell">
<source lang="shell">
Line 49: Line 52:
</source>
</source>


'''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.
'''Step 2.b.''' Alternative: download the latest version of the package u-boot-sifive. You can use the link from https://packages.altlinux.org/en/sisyphus_riscv64/srpms/u-boot-sifive/rpms/.


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


<source lang="shell">
<source lang="shell">
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-*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
user$ rpm2cpio u-boot-sifive-*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-spl.bin of=/dev/sdX3 bs=1M
root$ dd if=u-boot.itb of=/dev/sdX4 bs=1M
root$ dd if=u-boot.itb of=/dev/sdX4 bs=1M
Line 66: Line 69:
</source>
</source>


=== VNC ===
=== Root on NVME ===
 
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 <tt>/boot/extlinux/extlinux.conf</tt>.
The file system can be copied to NVME and used as system root. For that, you can do the following.


Create a partition on NVME using fdisk, for example.  
'''Create a partition on NVME using fdisk.''' For example.  


Format NVME partition:
'''Format the partition''':


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


Mount the partition:
'''Mount the partition''':


  mount /dev/nvme0n1p1 /mnt
  mount /dev/nvme0n1p1 /mnt


Copy rootfs content to the NVME partition:
'''Copy rootfs content to the NVME partition''':


  rsync -ax / /mnt
  rsync -ax / /mnt


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


Line 98: Line 97:
  └─nvme0n1p1 ext4  1.0  ROOT  dc155086-4ee4-42f6-87be-bcc67b2b93e6 ...
  └─nvme0n1p1 ext4  1.0  ROOT  dc155086-4ee4-42f6-87be-bcc67b2b93e6 ...


Fix value UUID in the file /mnt/boot/extlinux/extlinux.conf:
Put this UUID value into <tt>/mnt/boot/extlinux/extlinux.conf</tt>:


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


Fix value UUID in the file /mnt/etc/fstab:
Also, update the root partition UUID in <tt>/mnt/etc/fstab</tt>:


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


=== EFI на NVME ===
=== EFI on NVME ===


TBD.
TBD.

Latest revision as of 10:37, 21 January 2022

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 SoC. It is supported by Sisyphus riscv64 port. HiFive Umatched boards are used as build nodes for this port.

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

ALT Images

HiFive Unmatched is supported by weekly regular builds: 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. You can use the link from https://packages.altlinux.org/en/sisyphus_riscv64/srpms/u-boot-sifive/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-*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-*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 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.