This repository offers a user space device model, implemented in the Rust programming language, enabling integration of various VirtIO device types within the Bao hypervisor across diverse Virtual Machines (VMs), ranging from common VirtIO devices to Vhost and Vhost-user backend devices.
This project can be built either standalone (using a system cross-toolchain) or as part of Buildroot.
The build system does not rely on a hardcoded .cargo/config.toml. Instead, the linker is selected via
environment variables, which allows full integration with external build systems such as Buildroot.
To begin utilizing VirtIO device support in Bao Hypervisor, follow these steps
- Rust (stable)
cargo- The appropriate Rust target installed via
rustup - A cross-compiler for the desired target architecture
Install the Rust targets corresponding to the architectures you want to build for:
rustup target add aarch64-unknown-linux-gnu
rustup target add riscv64gc-unknown-linux-gnu
rustup target add arm-unknown-linux-gnueabiInstall the appropriate cross-compilers for your host system.
sudo apt install \
gcc-aarch64-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-arm-linux-gnueabiCargo requires an explicit linker when cross-compiling.
Set the linker using the CARGO_TARGET_<TRIPLE>_LINKER environment variable.
- AArch64 (Linux GNU)
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gccRISC-V 64 (Linux GNU)
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-linux-gnu-gccARM 32-bit (Linux GNU EABI)
export CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gccClone the repository:
git clone git@github.com:bao-project/bao-virtio-dm.git
cd bao-virtio-dm- Build for AArch64 (64-bit ARM)
cargo build --target=aarch64-unknown-linux-gnu --releaseOutput binary:
target/aarch64-unknown-linux-gnu/release/bao-virtio-dm
2. Build for RISC-V 64-bit
```bash
cargo build --target=riscv64gc-unknown-linux-gnu --releaseOutput binary:
target/riscv64gc-unknown-linux-gnu/release/bao-virtio-dm- Build for ARM 32-bit (EABI)
cargo build --target=arm-unknown-linux-gnueabi --releaseOutput binary:
target/arm-unknown-linux-gnueabi/release/bao-virtio-dmThe full list of supported (and work in progress) devices is presented below:
| DEVICE | DATAPLANE | SUPPORTED | |
|---|---|---|---|
| Virtio-Block | Block | VirtIO | x |
| Vhost-User-Fs | Virtual File System | Vhost-user | x |
| Virtio-Net | Net | VirtIO | x |
| Vhost-Net | Net | Vhost | - |
| Virtio-Vsock | Vsock | VirtIO | - |
| Vhost-Vsock | Vsock | Vhost | x |
| Vhost-User-Vsock | Vsock | Vhost-user | x |
Contributions to enhance the functionality and features of Bao Hypervisor VirtIO Device Support are welcome. If you have suggestions, bug fixes, or new features to propose, feel free to open an issue or submit a pull request.