Skip to content

Running HermitOS

Stefan Lankes edited this page Jun 23, 2024 · 3 revisions

HermitOS binaries can be run on either uhyve or qemu.

Using uhyve as Hypervisor

RustyHermit can run within our own hypervisor uhyve, which requires KVM to create a virtual machine. Please install the hypervisor as follows:

cargo +nightly install uhyve --locked

Afterwards, your are able to start HermitOS applications within our hypervisor:

uhyve target/x86_64-unknown-hermit/debug/hello_world

More details can be found in the uhyve README.

Using Qemu as Hypervisor

It is also possible to run RustyHermit within Qemu. HermitOS produces 64-bit binaries, but Qemu's x86 emulation cannot boot them directly. Therefore, the loader is required to boot the application. Download the loader binary from its releases page. As final step, the unikernel application app can be booted with following command:

$ qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio  -kernel path_to_loader/hermit-loader-x86_64 -initrd path_to_app/app -cpu qemu64,apic,fsgsbase,rdtscp,xsave,fxsr -device isa-debug-exit,iobase=0xf4,iosize=0x04 -enable-kvm

It is important to enable the processor features fsgsbase and rdtscp because it is a prerequisite to boot RustyHermit.

You can provide arguments to the application via the kernel commandline, which you can set with qemu's -append option. Since both the kernel and the application can have parameters, they are separated with --:

qemu-system-x86_64 ... -append "kernel-arguments -- application-arguments"