Skip to content

sarahspberrypi/hermit-rs-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hermit-rs-template

An application template for Hermit for Rust.

Requirements

Transform your application into a Hermit image:

(this is already done in this repo)

  • Add the hermit dependency for hermit targets in Cargo.toml.

    [target.'cfg(target_os = "hermit")'.dependencies]
    hermit = "<version>"
  • Use the exact Rust version required by hermit in rust-toolchain.toml.

    [toolchain]
    channel = "<version>"
  • Make sure we link against hermit in main.rs:

    #[cfg(target_os = "hermit")]
    use hermit as _;

Usage

Install the Rust Standard Library for Hermit

See rust-std-hermit.

Build the Hermit Application

$ cargo build --target x86_64-unknown-hermit

Run the Application in Uhyve

$ uhyve target/x86_64-unknown-hermit/debug/hermit-rs-template

For more details, see uhyve's README.

Run the Application in QEMU

Download the loader binary from its releases page.

$ qemu-system-x86_64 \
    -cpu qemu64,apic,fsgsbase,fxsr,rdrand,rdtscp,xsave,xsaveopt \
    -smp 1 -m 64M \
    -device isa-debug-exit,iobase=0xf4,iosize=0x04 \
    -display none -serial stdio \
    -kernel rusty-loader-x86_64 \
    -initrd target/x86_64-unknown-hermit/debug/hermit-rs-template

For more details, see the loader's README.

About

HelloWorld with RustyHermit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%