Regular/riscv64: Difference between revisions

From ALT Linux Wiki
(→‎How to run on QEMU: Update instruction to use OpenSBI)
(→‎Automatic install on ALT Sisyphus: Replace <tt> to <code>. Move to OpenSBI from BBL.)
Line 102: Line 102:
'''Step 2.''' Install the [http://sisyphus.ru/en/srpm/Sisyphus/alt-rootfs-installer alt-rootfs-installer].
'''Step 2.''' Install the [http://sisyphus.ru/en/srpm/Sisyphus/alt-rootfs-installer alt-rootfs-installer].


'''Step 3.''' Run the <tt>alt-rootfs-installer</tt>. This script will automatically install the system on microSD card. For example, to install <tt>regular-builder-alpha20190329-riscv64.tar.xz</tt> image on <tt>/dev/sdX</tt> with log output to <tt>/home/user/alt-rootfs-installer.log</tt>:
'''Step 3.''' The <code>alt-rootfs-installer</code> will automatically install the system on microSD card. For example, to install <code>regular-builder-latest-riscv64.tar.xz</code> image on <code>/dev/sdX</code> with log output to <code>/home/user/alt-rootfs-installer.log</code>:
<source lang="shell">
<source lang="shell">
$ alt-rootfs-installer --rootfs=/home/user/images/regular-builder-alpha20190329-riscv64.tar.xz \
$ alt-rootfs-installer --rootfs=/home/user/images/regular-builder-latest-riscv64.tar.xz \
                       --media=/dev/sdX \
                       --media=/dev/sdX \
                       --target=HiFive-Unleashed-bbl --log /home/user/alt-rootfs-installer.log
                       --target=HiFive-Unleashed-opensbi --log=/home/user/alt-rootfs-installer.log
</source>
</source>
<br>
<br>
After this procedure the /dev/sdX disk will contain two partitions. The first partition will contain bbl bootloader with Linux kernel, which is statically linked with bbl. The second partition will contain root file system.
After this procedure the <code>/dev/sdX</code> disk will contain two partitions:
<ol>
<li>[https://github.com/sifive/freedom-u540-c000-bootloader FSBL (First Stage Bootloader)]</li>
<li>[https://github.com/riscv/opensbi OpenSBI] + [https://www.denx.de/wiki/U-Boot/ U-Boot]</li>
<li>rootfs</li>
</ol>


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

Revision as of 08:47, 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 the /boot directory from the archive from step 1. For example, in the case of minimal system image with systemd:

$ tar -xf regular-jeos-latest-riscv64.tar.xz ./boot

The ./boot/vmlinuz will contain symlink to the Linux kernel.

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

  • The first partition must contain specific GUID 2E54B353-1271-4842-806F-E436D6AF6985
  • The second partition is a typical Linux Filesystem GUID 0FC63DAF-8483-4772-8E79-3D69D8477DE4

The example command for /dev/sdX:

$ 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"

Step 4. Write the bbl+Linux kernel to the first partition of microSD:

$ dd if=boot/vmlinuz of=/dev/sdX1 bs=4M status=progress

Step 5. Create filesystem on second partition of microSD. Mount it and untar the archive with rootfs:

$ mkfs.ext4 /dev/sdX2
$ mount /dev/sdX2 /mnt
$ tar -xpvf regular-jeos-latest-riscv64.tar.xz -C /mnt/
$ umount /dev/sdX2

Now, 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