Ubuntu 20.04 LTS images for HiFive Unleashed & QEMU VMs

Ubuntu 20.04.2 LTS point release is out, and it adds a supported RISC-V preinstalled server image.

See the link for it at
https://cdimage.ubuntu.com/releases/20.04.2/release/

There are a few further documentation notes on

https://wiki.ubuntu.com/RISC-V

It is a raw xz compressed image, which you can uncompress and DD onto sd-card and boot on the Unleashed board. It will also auto-resize to fill up the whole sd-card on first boot.

You can also uncompress it and run with QEMU on any Ubuntu install. Instructions are provided in the wiki page above. You might want to also use qemu-img resize first to add a bit more disk space for yourself.

Otherwise, it is just a fully functional preinstalled Ubuntu Server for RISC-V. It defaults to “ubuntu” login, with password “ubuntu” which one will be asked to reset on first login. And it defaults to dhcp networking.

The username and password are setup with cloud-init. Note that the image has CIDATA partition, which sample disabled cloud-config user-data/meta-data/network-info. One can modify those to fully customize first boot with custom SSH keys, networking information, packages to install etc. Just like one can use cloud-config when launching any Linux in any Public Cloud.

Anything about Ubuntu Server can also be asked and discussed at the Ubuntu Discourse Server section, linked in the wiki page above.

I would be very interested for you to try the official Ubuntu images for RISC-V on either the Unleashed board or QEMU. I’m here to answer any questions.

4 Likes

Awesome!

1 Like

I installed it on my board at home and am trying a toolchain build to test it. It is working well so far.

2 Likes

Hii there,

I want to know, what are the devices(e.g., networking, UART, flash, etc?) qemu support for the platform sifive risc-v hifive unleashed board .Also if you can share any document related to this will be a big help.

Actually I am new to embedded systems and this is for my project where I have to add support for a few of these devices in the bsp.

Thanks in advance

This thread is for Ubuntu, and your question doesn’t appear to have anything to do with Ubuntu. Please start new threads for new questions.

Hi Ubuntu images target the virtualized qemu platform only & the physical / real hardware board. We do not target emulating unleashed board in qemu.

I.e. RISC-V - Ubuntu Wiki notice that when launching QEMU i pass -machine virt thus when booted in qemu the generic opensbi, generic uboot, and qemu provided dtb is used. Thus unleashed board is not emulated.

Plus i’m not sure that one can emulate unleashed board correctly in qemu, for example I don’t think it runs zsbl the same way, or can emulate the unleashed board hardwared the right way. etc.

Hi,
Can you enable microsemi pcie in kernel for the expansion board?
Thank you.

Yes it is in progress. There will be v5.11 kernel for RISCV soon in hirsute, and then eventually it will have the hwe backport to focal too.

I will let you know when it’s available on the hirsute daily image.

Okay thank you I will be waiting for it.

I don’t have a Microsemi expansion board to test on, but I have been successfully using PCIe with a patched Ubuntu kernel on the PolarFire SoC Icicle Kit, which should have the same PCIe controller. If you can verify that my test kernel works on the expansion board too, that would be helpful for supporting everything in upcoming official kernels and images.

Try installing linux-riscv 5.8.0-18.20+mpfs1 from my RISC-V PPA (you’ll probably want linux-image-5.8.0-18–generic, linux-modules-5.8.0-18–generic and linux-modules-extra-5.8.0-18–generic). Then drop https://people.ubuntu.com/~wgrant/riscv64/hifive-unleashed-a00-microsemi.dtb into /boot, and edit the first entry in /boot/extlinux/extlinux.conf to include fdt /boot/hifive-unleashed-a00-microsemi.dtb to override the base dtb provided by our u-boot.

William, thanks for the test kernel etc. I’d love to try it once my Icicle arrives … it got through customs this morning, so hopefully I’ll have that by Tuesday or Wednesday.

Could I just suggest that instead of a paragraph of English prose that makes all kinds of aI’m sure in at least some cases invalid assumptions about shared context – starting with with a PPA is and what you do with it – it would be REALLY helpful to provide a few lines of shell script that can be copied and pasted to perform the task.

That would probably take you an extra 10 or 15 minutes, but might well save come other people an hour or more each.

I know it’s a hassle, but I always try to do it myself. For example Missing Bootloader on HiFive1 but Instructions for Repair Outdated / No Longer Exist - #4 by bruce

Hi William,
I tried your instructions and I’m getting empty lspci output for the expansion pcie board.

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 5.8.0-18–generic #20+mpfs1-Ubuntu SMP Thu Feb 25 23:37:27 UTC 2021 riscv64 riscv64 riscv64 GNU/Linux
ubuntu@ubuntu:~$ lspci -v
ubuntu@ubuntu:~$ sudo lspci
ubuntu@ubuntu:~$ sudo lspci -v

Thanks.

Thanks for trying. Can you post the whole output of dmesg from a fresh boot?

Hi,
No problem. Thank you for the help. Here is the dmesg output: dmesg_riscv - Pastebin.com

I see the following error:

  1. [ 14.282251] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4

  2. [ 14.282753] microchip-pcie 2030000000.pcie: failed to get clock resources, error -2

  3. [ 14.282819] microchip-pcie 2030000000.pcie: parsing devicetree failed, ret ffffffed

Thanks.

Ubuntu 21.04 is now out, and it has riscv64+unleashed image for SiFive HiFive Unleashed it features newer U-Boot and v5.11 kernel.

Get it from

http://cdimage.ubuntu.com/releases/21.04/release/

2 Likes

Hello xnox,
Were you able to add microsemi expansion board support to the ubuntu 21.04 image?
I’m able to use microsemi expansion board on the open embeeded images on github.
Thank you.

Hi,
Can you give me a dts compiled file with higher clock like 1.45 GHz? Board is slow on default speeds.

Thanks.

There is some discussion of this in this thread.
https://forums.sifive.com/t/changing-clock-rate-on-new-linux-kernels/2989

The file name of the patch has changed.
https://github.com/sifive/meta-sifive/blob/master/recipes-kernel/linux/files/0006-riscv-sifive-unleashed-define-opp-table-cpufreq.patch

I don’t know if Ubuntu includes this patch or not. If you do have this patch, then you can change frequency with the cpupower command.

Thanks for your quick reply. I’m getting no cpufreq driver error running cpupower command and modprobe cpufreq says no module.

ubuntu@ubuntu:~$ sudo cpupower frequency-set -f 1.4GHz
Setting cpu: 0
Error setting new values. Common errors:

  • Do you have proper administration rights? (super-user?)
  • Is the governor you requested available and modprobed?
  • Trying to set an invalid policy?
  • Trying to set a specific frequency, but userspace governor is not available,
    for example because of hardware which cannot be set to a specific frequency
    or because the userspace governor isn’t loaded?

ubuntu@ubuntu:~$ sudo cpupower frequency-info
analyzing CPU 0:
no or unknown cpufreq driver is active on this CPU
CPUs which run at the same hardware frequency: Not Available
CPUs which need to have their frequency coordinated by software: Not Available
maximum transition latency: Cannot determine or is not supported.
Not Available
available cpufreq governors: Not Available
Unable to determine current policy
current CPU frequency: Unable to call hardware
current CPU frequency: Unable to call to kernel

cpupower works in the SiFive OpenEmbedded builds. I’m not a kernel expert, so I don’t know what is necessary to enable it in Ubuntu.