RISC-V
|
Size: 1330
Comment:
|
Size: 4637
Comment: correct the text saying "any of the above" images for qemu
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = RISC-V = | Ubuntu provides the riscv64 architecture for the RISC-V platform since the release of Ubuntu 20.04 LTS. |
| Line 3: | Line 3: |
| Ubuntu provides riscv64 architecture for the RISC-V platform since Focal release. | == Images == |
| Line 5: | Line 5: |
| One can boot it on any system with qemu-system, or on bare-metal board such as those built by SiFive. | === Preinstalled Server Images === |
| Line 7: | Line 7: |
| == Booting with qemu == | * Ubuntu 22.04.1 preinstalled SD-card images for |
| Line 9: | Line 9: |
| * Machine type `virt` aka `-machine virt` * Bios is OpenSBI (`apt install opensbi`) `-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf` * "kernel" is qemu smode uboot (`apt install u-boot-qemu`) `-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf` * And just the cloud image from http://cloud-images.ubuntu.com/ |
* Allwinner Nezha D1 * SiFive HiFive Unmatched (also supports QEMU) * StarFive VisionFive are available at https://cdimage.ubuntu.com/releases/22.04.1/release/. * Ubuntu 20.04.4 preinstalled SD-card images for the * SiFive HiFive Unleashed * SiFive HiFive Unmatched (also supports QEMU) are available at https://cdimage.ubuntu.com/releases/20.04.4/release/. === Server Install Image === If you want to install Ubuntu on a disk drive, use the server install image. * A Ubuntu 22.04.1 server install image supporting the SiFive HiFive Unmatched board and QEMU is available at https://cdimage.ubuntu.com/releases/22.04.1/release/. A tutorial is available at https://ubuntu.com/tutorials/install-ubuntu-server. A description of the installation process is also available at https://discourse.ubuntu.com/t/ubuntu-installation-on-the-sifive-hifive-unmatched-board-using-a-server-install-image/27804. == Forums == You can discuss Ubuntu on RISC-V over at the [[https://discourse.ubuntu.com/c/server/17|Ubuntu Server forums]]. == Booting with QEMU == Prerequisites: * apt install qemu-system-misc opensbi u-boot-qemu qemu-utils '''For booting Ubuntu 22.04 (Jammy) or later images use u-boot-qemu from release Ubuntu 22.04 or later.''' After installing the above prerequisites, one can use the above preinstalled images for the HiFive Unmatched to boot a virtual machine. First unpack the image {{{ xz -dk ubuntu-22.04-preinstalled-server-riscv64+unmatched.img.xz }}} Optionally, if you want a larger disk, you can expand the disk (the filesystem will be automatically resized too). {{{ qemu-img resize -f raw ubuntu-22.04-preinstalled-server-riscv64+unmatched.img +5G }}} Next use OpenSBI bootloader & u-boot-qemu to boot the virtual machine |
| Line 16: | Line 62: |
| `` | {{{ |
| Line 18: | Line 64: |
| -machine virt -m 2048 -smp 4 \ -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ -device virtio-blk-device,drive=vda -drive file=livecd.ubuntu-cpc.img,id=vda -device virtio-net-device,netdev=eth0 -netdev user,id=eth0 ``` |
-machine virt -nographic -m 2048 -smp 4 \ -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ -device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \ -drive file=ubuntu-22.04-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio }}} |
| Line 23: | Line 71: |
| Adjust to taste as needed. The image has a fallback cloud-init datasource that configures sudo user `ubuntu` with password `ubuntu`. Alternatively, you can provide a config drive (or tweak the first partitions `/var/lib/cloud/seed/nocloud/*` files) to setup anything else using cloud-init. For example ssh keys, disabling interactive login, and so on. See https://cloudinit.readthedocs.io/en/latest | The important options to use are: * QEMU's generic virtual platform is selected by `-machine virt` * The first stage firmware booted by QEMU is OpenSBI: `-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf` * The second stage firmware U-Boot is loaded into memory via `-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf` One can use pass through networking, adjust memory (`-m`) & cpu counts (`-smp`) as needed. Switch to the serial console, wait for cloud-init to complete, then login using `ubuntu:ubuntu`. See the cloud-init section below to further customise the first boot behaviour with cloud-init. == Booting on SiFive HiFive Unmatched board == The preinstalled server image has U-Boot SPL loader as well as SiFive U-Boot to boot on the board. Set jumpers to boot from the microSD by setting `MSEL=1011` (MSEL2 to the outside of the board, the rest to the inside). You can then use "Gnome Disks" app to restore `img.xz` image onto the microSD card, plug it into the board and boot. You can also use cmdline to extract the image and dd it. {{{ xz -dk ubuntu-22.04-preinstalled-server-riscv64+unmatched.img.xz dd if=ubuntu-22.04-preinstalled-server-riscv64+unmatched.img of=/dev/disk/by-id/<TAB><TAB>complete-to-sdcard-device }}} Monitor serial console, wait for cloud-init to complete, then login using `ubuntu:ubuntu`. See the cloud-init section below to further customise the first boot behaviour with cloud-init. == cloud-init integration == The image has a fallback cloud-init datasource that configures sudo user `ubuntu` with password `ubuntu` and DHCP networking. You will be asked to change the password on first login. The image has `CIDATA` partition which can be used as a valid datasource to adjust cloud-config metadata. If you wish to customize user password, networking information, add ssh keys, etc. Please mount `CIDATA` partition rename `meta-data` and `user-data` files and adjust them to taste. You can use network-info to configure networking if something more sophisticated than just DHCP is desired. For example ssh keys, disabling interactive login, and so on. See https://cloudinit.readthedocs.io/en/latest |
Ubuntu provides the riscv64 architecture for the RISC-V platform since the release of Ubuntu 20.04 LTS.
Images
Preinstalled Server Images
- Ubuntu 22.04.1 preinstalled SD-card images for
- Allwinner Nezha D1
are available at https://cdimage.ubuntu.com/releases/22.04.1/release/.
- Ubuntu 20.04.4 preinstalled SD-card images for the
are available at https://cdimage.ubuntu.com/releases/20.04.4/release/.
Server Install Image
If you want to install Ubuntu on a disk drive, use the server install image.
A Ubuntu 22.04.1 server install image supporting the SiFive HiFive Unmatched board and QEMU is available at https://cdimage.ubuntu.com/releases/22.04.1/release/.
A tutorial is available at https://ubuntu.com/tutorials/install-ubuntu-server.
A description of the installation process is also available at https://discourse.ubuntu.com/t/ubuntu-installation-on-the-sifive-hifive-unmatched-board-using-a-server-install-image/27804.
Forums
You can discuss Ubuntu on RISC-V over at the Ubuntu Server forums.
Booting with QEMU
Prerequisites:
- apt install qemu-system-misc opensbi u-boot-qemu qemu-utils
For booting Ubuntu 22.04 (Jammy) or later images use u-boot-qemu from release Ubuntu 22.04 or later.
After installing the above prerequisites, one can use the above preinstalled images for the HiFive Unmatched to boot a virtual machine.
First unpack the image
xz -dk ubuntu-22.04-preinstalled-server-riscv64+unmatched.img.xz
Optionally, if you want a larger disk, you can expand the disk (the filesystem will be automatically resized too).
qemu-img resize -f raw ubuntu-22.04-preinstalled-server-riscv64+unmatched.img +5G
Next use OpenSBI bootloader & u-boot-qemu to boot the virtual machine
Working example with all the options is:
qemu-system-riscv64 \ -machine virt -nographic -m 2048 -smp 4 \ -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ -device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \ -drive file=ubuntu-22.04-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio
The important options to use are:
QEMU's generic virtual platform is selected by -machine virt
The first stage firmware booted by QEMU is OpenSBI: -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf
The second stage firmware U-Boot is loaded into memory via -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf
One can use pass through networking, adjust memory (-m) & cpu counts (-smp) as needed.
Switch to the serial console, wait for cloud-init to complete, then login using ubuntu:ubuntu. See the cloud-init section below to further customise the first boot behaviour with cloud-init.
Booting on SiFive HiFive Unmatched board
The preinstalled server image has U-Boot SPL loader as well as SiFive U-Boot to boot on the board.
Set jumpers to boot from the microSD by setting MSEL=1011 (MSEL2 to the outside of the board, the rest to the inside).
You can then use "Gnome Disks" app to restore img.xz image onto the microSD card, plug it into the board and boot.
You can also use cmdline to extract the image and dd it.
xz -dk ubuntu-22.04-preinstalled-server-riscv64+unmatched.img.xz dd if=ubuntu-22.04-preinstalled-server-riscv64+unmatched.img of=/dev/disk/by-id/<TAB><TAB>complete-to-sdcard-device
Monitor serial console, wait for cloud-init to complete, then login using ubuntu:ubuntu. See the cloud-init section below to further customise the first boot behaviour with cloud-init.
cloud-init integration
The image has a fallback cloud-init datasource that configures sudo user ubuntu with password ubuntu and DHCP networking. You will be asked to change the password on first login.
The image has CIDATA partition which can be used as a valid datasource to adjust cloud-config metadata. If you wish to customize user password, networking information, add ssh keys, etc. Please mount CIDATA partition rename meta-data and user-data files and adjust them to taste. You can use network-info to configure networking if something more sophisticated than just DHCP is desired.
For example ssh keys, disabling interactive login, and so on. See https://cloudinit.readthedocs.io/en/latest
RISC-V (last edited 2025-02-07 13:36:10 by adrianoco)