Can Mirage be run directly on a raspberry pi?

I’m looking into options for running a web server on a raspberry pi zero (so very tight memory / performance constraints), and I thought mirage might be a cool option.
But all of the things I’m seeing talk about running mirage inside of qemu (like this repo here https://github.com/rudenoise/qemu-solo5-mirage-rpi3) – can mirage run directly on hardware, or can it only be used inside of an emulator?

(There are plenty of more qualified people who can give an answer on mirage). However, here is a quick answer. I can’t guarantee it will be fully correct :slight_smile:

I haven’t run mirage on ARM but looking at solo5, only the aarch64 (ARM 64 Bit) target is supported. So prima-facie RPI-3 cannot run Mirage without an emulator.

1 Like

Ah, that makes sense, thanks! The pi zero (which is what I have) is 32-bit, but it looks like the pi 3 A+ and pi 3 B+ are both 64 bit, so maybe they could run mirage/solo5 without emulation?

Yeah – it looks like you’re correct regarding pi 3B. See https://en.wikipedia.org/wiki/Raspberry_Pi . The CPU here seems to be https://en.wikipedia.org/wiki/ARM_Cortex-A53 which is 64 bit… so Mirage should run here…

Ultimately it would depend on which ARM processor you have. If it is aarch64 then it should be able to run Mirage.

As @sid said, Mirage/Solo5 currently only supports aarch64 on ARM, so you’d need a 64-bit CPU, which for the RPi means any RPi 3 model, or possibly the newer “v1.2” RPi2 model B. You’d also need a 64-bit Linux distribution. The upcoming Debian buster release will have out of the box support for the RPi 3, and a preview is available.

However, depending on what you’re thinking of when you write “run directly on a raspberry pi”, this may not be what you want. Mirage/Solo5 is designed to be run on “virtual hardware”, so it’s not a traditional setup where the (uni)kernel drives hardware devices directly, you still need a host system to serve as the “control plane” and “hypervisor” for your Mirage/Solo5 unikernels.

N.B. There is also a Mirage/Xen port which can run on some 32-bit ARM hardware, but as far as I know the RPis are explicitly not supported, and the setup involving Xen on ARM is more complicated for a new user than the Mirage/Solo5 equivalent.

1 Like

Side note: Rpi3 is aarch64, but it doesn’t have a GIC, it has a very old VIC and it’s a pain. I don’t know if mirage supports that but that might be an issue

thanks for the detailed response!

I would be very interesting in trying this out as well. I remember someone managed to run it on ESP embedded device last year https://toao.com/blog/getting-ocaml-running-on-the-esp32#getting-ocaml-running-on-the-esp32.

There are also other approaches for small devices without a full blown OS which i am also interested to see get more attention

Please let us know if you make some progress, or find something interesting for this to work.

1 Like