QEMU

Differences between revisions 1 and 19 (spanning 18 versions)
Revision 1 as of 2023-04-17 09:17:46
Size: 2620
Editor: xypron
Comment:
Revision 19 as of 2025-02-07 13:07:38
Size: 197
Editor: adrianoco
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Ubuntu installation on a RISC-V virtual machine using a server install image and QEMU =

== Overview ==

Starting with Ubuntu 22.04 a server install image for QEMU is available. This topic describes how to use the image for an installation on a virtual machine.

The Jammy release image is available at https://cdimage.ubuntu.com/releases/22.04.2/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 61.

== Prerequistites ==

To run the installation you will need the following packages:

* qemu-system-misc - QEMU 18 is used to emulate a virtual RISC-V machine.
* u-boot-qemu - U-Boot is the firmware implementing the UEFI API and loads GRUB.

{{{
sudo apt-get update
sudo apt-get install qemu-system-misc 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 \
    -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 your installed Ubuntu image use

{{{
/usr/bin/qemu-system-riscv64 -machine virt -m 4G -smp cpus=2 -nographic \
    -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
}}}

= Limitations =

In Ubuntu 22.04 the number of virtual CPUs is limited to 8 in QEMU and in the Linux kernel.
#refresh 2 https://canonical-ubuntu-boards.readthedocs-hosted.com/en/latest/how-to/qemu-riscv/
This page has been moved to the Ubuntu Readthedocs Documentation Website. You are being redirected.

This page has been moved to the Ubuntu Readthedocs Documentation Website. You are being redirected.

RISC-V/QEMU (last edited 2025-02-07 13:07:38 by adrianoco)