ZVM is an experimental, educational, and just-for-fun minimal toy VMM. ZVM is entirely written in Zig language. ZVM is accelerated by KVM and Intel VT-x hardware virtualization extension. The implementation is minimal, but can boot Linux kernel v6.2.
Under development... 🚧
Subject | Status |
---|---|
initram /initrd support |
🌞 |
Boot init process |
🌞 |
Configurable memory size | 🌞 |
Keyboard interraction | 🌞 |
Networking support (virtio-net ) |
🌧 |
Support multi cores | ⛈ |
Switchable logging | â›… |
Not depend on external libc | 🌞 |
CI | â›… |
You need bzImage
kernel image that is configured properly.
The example config is available at /assets/config.linux.
You also need initrd
/initram
image that contains your init
process.
zig build run -- --kernel=<bzImage> --initrd=<initrd/initram>
It will automatically install dependency (ZVM uses ZON as a package manager),
build ZVM, and run it.
You can see all available options by zig build run -- --help
:
$ zig build run -- --help
-h, --help
Display this help and exit.
-k, --kernel <str>
Kenel bzImage path.
-i, --initrd <str>
initramfs or initrd path.
-m, --memory <str>
Memory size. (eg. 100MB, 1G, 2000B)
You can change the log level by editing std_options
variable in /src/main.zig.
Available log levels are .debug
, .info
, .warn
, and .err
.
You possibly need root privilege to run tests depending on the capabilities you have.
zig build test --summary all
- Intel x64 with VT-x enabled
- Host OS: Any modern version of Linux
- Guest OS: Linux v6.2
- Zig v0.11.0
- It might work on later versions until Zig introduces breaking changes. But it would happen soon, Zig is still not a mature language at all...
- DEVELOPMENT.md contains some notes that might help develop VMM.
- /hacks contains some pitfalls and hacks that I encountered during development.