Overview
Starting with Ubuntu 22.04 a server install image is made available. This topic describes how to use the image for an installation on a virtual machine.
- The release image will be available at https://cdimage.ubuntu.com/releases/22.04/release/.
- Daily build images are provided at https://cdimage.ubuntu.com/ubuntu-server/daily-live/current/.
A general overview of the installation process is available at https://ubuntu.com/tutorials/install-ubuntu-server.
Prerequistites
To run the installation you will need the following packages:
- qemu-system-misc - QEMU is used to emulate a virtual RISC-V machine.
- opensbi - OpenSBI provides the Supervisor Execution Environment running in machine mode.
- u-boot-qemu - U-Boot is the firmware implementing the UEFI API and loads GRUB.
sudo apt-get install qemu-system-misc opensbi u-boot-qemu
Download the image either using your web browser or with
wget https://cdimage.ubuntu.com/ubuntu-server/daily-live/current/jammy-live-server-riscv64.img.gz
Installation
Extract the image.
gzip -d jammy-live-server-riscv64.img.gz
Create the disk image on which you will install Ubuntu. 16 GiB should be enough.
dd if=/dev/zero bs=1M of=disk count=1 seek=16383
Start the installer with:
/usr/bin/qemu-system-riscv64 -machine virt -m 4G -smp cpus=2 -nographic \ -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin \ -netdev user,id=net0 \ -device virtio-net-device,netdev=net0 \ -drive file=jammy-live-server-riscv64.img,format=raw,if=virtio \ -drive file=disk,format=raw,if=virtio \ -device virtio-rng-pci
Follow the installation steps in https://ubuntu.com/tutorials/install-ubuntu-server.
When rebooting we have to remove the installer image. Otherwise the installer will restart.
U-Boot gives you a 2 second time window to press the Enter key to reach the U-Boot console. In U-Boot’s console you can use the poweroff
command to stop QEMU. Another option to exit QEMU is pressing keys CTRL-a followed by key x.
Run Ubuntu
To run you installed Ubuntu image use
/usr/bin/qemu-system-riscv64 -machine virt -m 4G -smp cpus=2 -nographic \ -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.bin \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin \ -netdev user,id=net0 \ -device virtio-net-device,netdev=net0 \ -drive file=disk,format=raw,if=virtio \ -device virtio-rng-pci
In Ubuntu 22.04 the number of virtual CPUs is limited to 8 in QEMU and in the Linux kernel.