Building xemu

Prerequisites

  • Rust toolchain — auto-detected from rust-toolchain.toml (nightly).
  • C cross-compilerriscv64-unknown-linux-musl for building guest C programs. On macOS, install via brew or fetch from cross-tools/musl-cross.
  • axconfig-gencargo install axconfig-gen (cached in ~/.cargo/bin).
  • clang-format — system package, used by the fmt CI job.

Build modes

ModeInvocationNotes
Release (default)make runLTO + codegen-units = 1. Use for benchmarks.
DebugDEBUG=y make runFaster to compile; slower at runtime.
Difftest-enabledDIFFTEST=1 make runLinks the QEMU / Spike comparison backends.

Always set DEBUG=n before benchmarking.

Supported hosts

  • macOS (Apple Silicon, Intel) — primary development target.
  • Linux (x86_64, aarch64) — CI target. samply profiling works without entitlement on Linux.

Windows is not supported.

Cargo workspace

xemu is a single Cargo workspace at xemu/. Build the whole thing:

cd xemu
cargo build --release
cargo test --workspace

The resulting binary is xemu/target/release/xdb. In normal development you don't invoke xdb directly — make run from a kernel directory wires up the right X_FILE and launch flags.