Skip to content

Setting up a development environment

Panagiotis "Ivory" Vasilopoulos edited this page May 14, 2025 · 16 revisions

The following instructions will describe how to set up a development environment for testing Uhyve against an upstream version of the Hermit kernel beyond the example and test kernels that can be found in Uhyve's repository.

This guide assumes some familiarity with Git and basic skills with Unix shells (such as commands like cd or ln).

Cloning Hermit repositories

Using Git, we will clone two repositories: Uhyve and hermit-rs.

git clone https://github.com/hermit-os/uhyve.git
git clone https://github.com/hermit-os/hermit-rs --recursive-submodules -j8

hermit-rs and the kernel

The hermit-rs contains many examples of Rust application that can be compiled into a unikernel using Hermit. Although not all of them are guaranteed to work with Uhyve, many of them do - they may be useful on top of the kernels that Uhyve ships with in binary form (under data/x86_64) or in its own tests (under tests/test-kernels). The repository is also very easy to expand and serves as a good first stepping stone, particularly if you have never compiled an application using Hermit before.

These examples expect a copy of the kernel to be present in hermit-rs's repository root. hermit-rs ships with a submodule of the Hermit kernel. It is fetched alongside with hermit-rs thanks to the --recursive-submodules parameter used above, but, in case you forgot to use it earlier, it can also be fetched using git submodule update --init --recursive inside of the hermit-rs directory.

In Debugging Hermit applications with Uhyve, we outline how developers can build the repository's test-kernels against a locally cloned copy of the kernel.

Compiling kernels locally

The Uhyve repository ships with a couple of test kernels used for integration testing in tests/test-kernels.

The test kernels can be built using cargo test --no-run (or cargo test, but doing so will run the tests as well!).

Alternatively, you can try compiling them using the following command in tests/test-kernels:

cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit

The Cargo Book provides additional explanations on Cargo Targets and build-std.


The kernels can now be run using Uhyve (built using cargo build):

./target/debug/uhyve tests/test-kernels/target/x86_64-unknown-hermit/debug/create_file
./target/debug/uhyve tests/test-kernels/target/x86_64-unknown-hermit/debug/serial

Testing Hermit apps using cargo run

Instead of using cargo build, it is also possible to use cargo run directly.

cargo run -- data/x86_64/rusty_demo
cargo run -- data/x86_64/hello_world
cargo run -- data/x86_64/hello_c

Clone this wiki locally