Skip to content

cargo run for Hermit applications

Panagiotis "Ivory" Vasilopoulos edited this page Aug 9, 2025 · 1 revision

In a manner that is reminiscent of binfmt_misc, it is also possible to configure Cargo to execute Hermit applications using Uhyve.

This can be done by modifying .cargo/config.toml in your home directory:

.cargo/config.toml:

[target.x86_64-unknown-hermit]
runner = "uhyve" # assumes uhyve has been installed

... or, alternatively, use a custom build of Uhyve:

.cargo/config.toml:

[target.x86_64-unknown-hermit]
runner = "/home/uhyvedev/uhyve/target/release/uhyve"

You can try this in tests/test-kernels using the following command:

cargo run --bin write_to_fd -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit

It is also possible to pass environment variables to the kernel.

$ HERMIT_LOG_LEVEL_FILTER=off cargo run --bin hello_world -Zbuild-std=std,panic_abort --target x86_64-unk
nown-hermit
Compiling hermit v0.11.0 (/home/uhyvedev/hermit-rs/hermit)
Compiling hello_world v0.0.0 (/home/uhyvedev/hermit-rs/examples/hello_world)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.83s
     Running `/home/uhyvedev/uhyve/target/release/uhyve target/x86_64-unknown-hermit/debug/hello_world`
> Hello, world!
Number of interrupts

Clone this wiki locally