Important
This approach is deprecated and will not work on current Unikraft versions.
See *-unikraft-linux-musl
—The rustc book for running Rust apps on current versions of Unikraft.
This crate builds and links against Unikraft.
- KraftKit
- Rust
- Either Rust for Unikraft (
x86_64-unikraft
) - Or Rust nightly (
x86_64-unknown-linux-gnu
,no-std
only)
- Either Rust for Unikraft (
kvm
linuxu
You can compile the examples like this:
cargo build \
--example <EXAMPLE> \
--features <PLATFORM> \
--target <TRIPLE>
You can only build no-std
applications using the x86_64-unknown-linux-gnu
target.
This target requires additional RUSTFLAGS
:
-Crelocation-model=static
-Clink-arg=-Wl,-T,unikraft_linker_script.ld
-Clink-arg=-Wl,-dT,default_unikraft_linker_script.ld
-Clink-arg=-Wl,-e,_unikraft_rs_start
-Cpanic=abort
See Cargo configuration build.rustflags
and cargo-rustc for more information on how to set them.
You also need to provide stubs for eh_personality
and _Unwind_Resume
as seen in the example.
unikraft-rs is part of the Unikraft OSS Project and licensed under BSD-3-Clause
.