Regular/riscv64: Difference between revisions

From ALT Linux Wiki
(→‎Automatic install on ALT Sisyphus: Replace <tt> to <code>. Move to OpenSBI from BBL.)
(→‎Manual install: Replace <tt> to <code>. Move to OpenSBI from BBL.)
Line 119: Line 119:


== Manual install ==
== Manual install ==
'''Step 2.''' Untar the /boot directory from the archive from ''step 1''. For example, in the case of minimal system image with systemd:
'''Step 2.''' Untar two files from the archive from ''step 1''. For example, in the case of <code>regular-builder-latest-riscv64.tar.xz</code>:
<source lang="shell">
<source lang="shell">
$ tar -xf regular-jeos-latest-riscv64.tar.xz ./boot
$ tar -xJf regular-jeos-latest-riscv64.tar.xz ./usr/share/fu540_boot/fsbl.bin ./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin
</source>
</source>
The ./boot/vmlinuz will contain symlink to the Linux kernel.


'''Step 3.''' Create the GPT table with two partitions on the microSD card:
These two files <code>./usr/share/fu540_boot/fsbl.bin</code> и
* The first partition must contain specific GUID 2E54B353-1271-4842-806F-E436D6AF6985
<code>./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin</code>
* The second partition is a typical Linux Filesystem GUID 0FC63DAF-8483-4772-8E79-3D69D8477DE4
are [https://github.com/sifive/freedom-u540-c000-bootloader FSBL] and
The example command for <tt>/dev/sdX</tt>:
[https://github.com/riscv/opensbi OpenSBI] +
[https://www.denx.de/wiki/U-Boot/ U-Boot], acoordingly.
 
'''Step 3.''' Create the GPT table with three partitions on the microSD card:
* FSBL partition [https://github.com/sifive/freedom-u540-c000-bootloader/blob/master/gpt/gpt.c with GUID] 5B193300-FC78-40CD-8002-E86C45580B47
* OpenSBI partition [https://github.com/sifive/freedom-u540-c000-bootloader/blob/master/gpt/gpt.c with GUID] 2E54B353-1271-4842-806F-E436D6AF6985
* Linux Filesystem partition with GUID 0FC63DAF-8483-4772-8E79-3D69D8477DE4
The example command for <code>/dev/sdX</code>:
<source lang="shell">
<source lang="shell">
$ sgdisk -g --clear \
$ sgdisk -g --clear \
        --new=1:2048:67583 --change-name=1:bootloader --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985 \
 
        --new=2:264192:    --change-name=2:root      --typecode=2:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \
         "/dev/sdX"
         "/dev/sdX"
</source>
</source>


'''Step 4.''' Write the bbl+Linux kernel to the first partition of microSD:
'''Step 4.''' Write the FSBL to the partition with FSBL GUID (first partition in the example above):
<source lang="shell">
$ dd if=./usr/share/fu540_boot/fsbl.bin of=/dev/sdX1 bs=4M status=progress
</source>
 
'''Step 5.''' Write the OpenSBI + U-Boot to the partition with OpenSBI GUID (second partition in the example above):
<source lang="shell">
<source lang="shell">
$ dd if=boot/vmlinuz of=/dev/sdX1 bs=4M status=progress
$ dd if=./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin of=/dev/sdX2 bs=4M status=progress
</source>
</source>


'''Step 5.''' Create filesystem on second partition of microSD. Mount it and untar the archive with rootfs:
'''Step 6.''' Create a filesystem on the third partition of the microSD. Mount it and untar the archive with rootfs:
<source lang="shell">
<source lang="shell">
$ mkfs.ext4 /dev/sdX2
$ mkfs.ext4 /dev/sdX3
$ mount /dev/sdX2 /mnt
$ mount /dev/sdX3 /mnt
$ tar -xpvf regular-jeos-latest-riscv64.tar.xz -C /mnt/
$ tar -xpJvf regular-builder-latest-riscv64.tar.xz -C /mnt/
$ umount /dev/sdX2
$ sync; umount /dev/sdX3
</source>
</source>


Now, microSD is ready to use with HiFive Unleashed.
Now, the microSD is ready to use with HiFive Unleashed.


= '''VNC''' =
= '''VNC''' =

Revision as of 12:08, 29 January 2021

Regular image builds for SoC with RISC-V (rv64gc) CPU

Русский

Overview

Regular image builds are intended to test and develop the RISC-V (rv64gc) port of the Sisyphus repository.

To learn more about regular image builds one could refer to this article.

To make a bug report or discuss any suggestions please refer to the "Feedback" section on this page.

To enter the system, after the boot with one of the images listed below, please use the following username/password:
login: root
password: alt

The graphical image with XFCE does not provides a preset password for the root user. At the first boot the user will be asked to setup system manually through visual menu.

In the case of the developer image (builder) there is an another user:
login: altlinux
password: alt

Attention! It is recommended to change the password as soon as possible after the first log-in to the system.


HiFive Unleashed

Four types of the images for the SiFive's HiFive Unleashed board currently available:


The instructions on how to run these images on HiFive Unleashed in this section.

QEMU

The images for the QEMU listed below:


The instructions on how to run these images on QEMU in this section.

How to run on QEMU

In order to run the image on the QEMU system one need to follow these steps:

Step 1. Install QEMU with riscv64 support. For example, in the case of ALT x86_64 system: qemu-system-riscv-core.

Step 2.

ALT x86_64

Install or download and extract a package with OpenSBI and U-Boot. In the case of ALT x86_64 (if it is not the case, please see here) one could add noarch repository sisyphus-riscv64 to the system and install the package opensbi-firmware-generic:

$ apt-repo add 'rpm [sisyphus-riscv64] http://ftp.altlinux.org/pub/distributions/ALTLinux ports/riscv64/Sisyphus/noarch classic'
$ apt-get update
$ apt-get install opensbi-firmware-generic

After that, the firmware will be at the path /usr/share/opensbi/generic/firmware/fw_payload.elf.

Other system

In that case one could download a package opensbi-firmware-generic-.* from the sisyphus-riscv64 noarch repository sisyphus-riscv64. After that it is possible to install the package rpm -i or extract it rpm2cpio. Besides that it is possible to get the firmware from the qcow2c image with qemu-nbd.

Step 3. Download one of the images for QEMU listed (above) and just replace <IMAGE> to the path of just downloaded qcow2c image and <FIRMWARE> to the fw_payload.elf:

$ qemu-system-riscv64 -nographic -machine virt \
                      -bios <FIRMWARE> \
                      -m 2G -smp cpus=4 \
                      -drive file=<IMAGE>,id=hd0 -device virtio-blk-device,drive=hd0 \
                      -netdev user,id=eth0 -device virtio-net-device,netdev=eth0

In the case of the XFCE graphical image, the user needs to redirect incoming TCP connections to the host port 5900 (VNC) to the guest port. One could do it with the following command:

$ qemu-system-riscv64 -nographic -machine virt \
                      -bios <FIRMWARE> \
                      -m 2G -smp cpus=4 \
                      -drive file=<IMAGE>,id=hd0 -device virtio-blk-device,drive=hd0 \
                      -netdev user,id=eth0,hostfwd=tcp::5900-:5900 -device virtio-net-device,netdev=eth0

For information about how to connect to the VNC server please refer to the "VNC" section.

How to run on HiFive Unleashed

This instruction assumes that the user is working on the computer with ALT Sisyphus installed on it. In order to run the image on the HiFive Unleashed one need to follow these steps:

Step 1. Download minimal system image with systemd, which is a tar archive with rootfs. To install the system one could choose between two options: automatic install on ALT Sisyphus and manual.

Automatic install on ALT Sisyphus

Step 2. Install the alt-rootfs-installer.

Step 3. The alt-rootfs-installer will automatically install the system on microSD card. For example, to install regular-builder-latest-riscv64.tar.xz image on /dev/sdX with log output to /home/user/alt-rootfs-installer.log:

$ alt-rootfs-installer --rootfs=/home/user/images/regular-builder-latest-riscv64.tar.xz \
                       --media=/dev/sdX \
                       --target=HiFive-Unleashed-opensbi --log=/home/user/alt-rootfs-installer.log


After this procedure the /dev/sdX disk will contain two partitions:

  1. FSBL (First Stage Bootloader)
  2. OpenSBI + U-Boot
  3. rootfs

Now, microSD card is ready to use with HiFive Unleashed.

Manual install

Step 2. Untar two files from the archive from step 1. For example, in the case of regular-builder-latest-riscv64.tar.xz:

$ tar -xJf regular-jeos-latest-riscv64.tar.xz ./usr/share/fu540_boot/fsbl.bin ./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin

These two files ./usr/share/fu540_boot/fsbl.bin и ./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin are FSBL and OpenSBI + U-Boot, acoordingly.

Step 3. Create the GPT table with three partitions on the microSD card:

  • FSBL partition with GUID 5B193300-FC78-40CD-8002-E86C45580B47
  • OpenSBI partition with GUID 2E54B353-1271-4842-806F-E436D6AF6985
  • Linux Filesystem partition with GUID 0FC63DAF-8483-4772-8E79-3D69D8477DE4

The example command for /dev/sdX:

$ sgdisk -g --clear \

        "/dev/sdX"

Step 4. Write the FSBL to the partition with FSBL GUID (first partition in the example above):

$ dd if=./usr/share/fu540_boot/fsbl.bin of=/dev/sdX1 bs=4M status=progress

Step 5. Write the OpenSBI + U-Boot to the partition with OpenSBI GUID (second partition in the example above):

$ dd if=./usr/share/opensbi/sifive/fu540/firmware/fw_payload.bin of=/dev/sdX2 bs=4M status=progress

Step 6. Create a filesystem on the third partition of the microSD. Mount it and untar the archive with rootfs:

$ mkfs.ext4 /dev/sdX3
$ mount /dev/sdX3 /mnt
$ tar -xpJvf regular-builder-latest-riscv64.tar.xz -C /mnt/
$ sync; umount /dev/sdX3

Now, the microSD is ready to use with HiFive Unleashed.

VNC

At the first boot the user will be asked to setup system manually through visual menu. One could setup the timezone, root password, add a new user, setup VNC password, etc. In the case of QEMU the connection procedure to VNC is straightforward. For example, in the case of tigerVNC:

$ vncviewer 127.0.0.1

In the case of HiFive Unleashed one needs to find out what is the IP address of this machine. The HiFive Unleashed obtains an IP address from DHCP during boot time. One way to do this is to connect HiFive Unleashed and PC with a microUSB-USB cord. This allows one to connect to the serial console. To connect to the serial console (usually it is /dev/ttyUSB1) with GNU/screen, please use the following command:

$ screen /dev/ttyUSB1 115200

During first boot time the information about IPv4 and IPv6 addresses will be prompted to the console (e.g.):

[  128.084540] xinit[276]: ALTERATOR SETUP === Default device: "eth0"
[  128.084888] xinit[276]: ALTERATOR SETUP === IPv4: "192.168.88.216/24"
[  128.085110] xinit[276]: ALTERATOR SETUP === IPv6: "fe80::72b3:d5ff:fe92:f229/64"

To connect to the VNC server:

$ vncviewer 192.168.88.216

Feedback

• Bug reports submission form at bugzilla.

  • In the case of any issue with a package please choose Sisyphus.
  • In the case of an issue with the images please choose Regular.

Set riscv64 as a platform (drop-down list at the right). In the field "Assign to" set arei@altlinux.org.
• IRC channel #altlinux-riscv at freenode.
• Mailing list: riscv-devel@lists.altlinux.org