Booting our RISC-V images

Blog post by kallisti5 on Sun, 2021-11-07 07:29

Thanks in large part to the hard work by X512 and everyone developing on Haiku, our nightly RISCV64 images are now functional.

RISC-V marks Haiku’s first functional non-Intel/x86 port!

What is RISC-V?

RISC-V is a modern, fully open CPU instruction set which can be implemented, customized, extended, and sold without royalties. Designs exist for a 32-bit, 64-bit, and even a 128-bit processor design.

You can emulate RISC-V in qemu, design your own CPU and synthesize it for an FPGA, or you can purchase a commercially built and designed computer with a RISC-V processor.

Why not ARM?

Haiku developers are continuing to work on ARM and ARM64 ports of Haiku, RISC-V just finished first :-)

Running nightly RISCV64 images in qemu

RISCV64 in qemu

Beware of bugs
There are multiple lingering bugs ([#17379](https://dev.haiku-os.org/ticket/17379), [#17380](https://dev.haiku-os.org/ticket/17380)) in RISCV64 Haiku running under QEMU. If you don't make it to the desktop, try again.

To boot Haiku in qemu (qemu-system-riscv64), you’ll need the following:

Once you have the above two items, then booting Haiku is as easy as running the following command:

qemu-system-riscv64 -M virt -m 1G -device ati-vga -kernel u-boot.bin \
	-drive file=haiku-mmc.image,format=raw,if=virtio \
	-usb -device usb-ehci,id=echi -device usb-kbd -device usb-tablet
  • You can watch technical serial output via view->serial0
  • The eventual Haiku desktop will be available via view->ati-vga

Running nightly RISCV64 images on the SiFive Unmatched

Update: Working versions
riscv64 was broken after our merge of GCC 11. hrev55697 is currently the last image to boot to a desktop until this regression is repaired.

To boot Haiku on the SiFive unmatched, you will need the following:

Serial Debugging
In the event of trouble, attaching a Micro-USB cable to the Unmatched allows you to see serial output during startup. (minicom, 115200 8N1, no flow control)

Once you have all of the requirements above, the following process will get you booted into Haiku:

  1. Plug the SD Card into the SiFive Unmatched
  2. Plug the USB Flash drive into the SiFive Unmatched
  3. Power on the SiFive Unmatched. You should be greeted with a desktop within a minute or two

Wrapup

Overall, RISC-V offers an exciting opportunity for us to grow our non-x86 architecture support. A lot of work still remains on RISC-V including support for SMP (multi-processor), however this is a massive first step.