Setup
This chapter describes the environment required to develop Ymir hypervisor. These are the recommended environments, but you can develop on other environment as far as requirements are satisfied. Please read accordingly to your own environment.
Expected Environment
Development on the below environment is expected:
- x64 (Intel64) architecture with Intel VT-x support
- VMM that supports nested virtualization
- On Linux, QEMU/KVM supports nested virtualization and can pass-through CPU
- Zig 0.13.0
The author has tested in the following environment:.
- 12th Gen Intel(R) Core(TM) i9-12900
- Ubuntu 24.04 LTS (Linux 6.8.0-45-generic)
- QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.2)
As for CPUs, recent Intel Core series are almost certain to support VT-x. Since we write and test Ymir in a VM, nestd virtualization is required. Although VirtualBox or VMWare may work fine, we assume the use of QEMU/KVM in this series.
You can check if your CPU supports virtualization by VT-x with the following command. Note that even if the CPU itself supports VT-x, it may be disabled in the BIOS:
cat /proc/cpuinfo | grep vmx
Zig
This series uses Zig 0.13.0. Zig is a language that has not yet reached 1.0, so backward compatibility is not guaranteed. Versions after 0.13.0 may work with some modifications, but this series focuses only on 0.13.0, the latest version at the time of writing.
There is no official version manager for Zig. Please install Zig 0.13.0 in either of the following ways.
First, you can use a third-party version manager. I prefer using tristanisham/zvm. After installing zvm following the iREADME, install Zig 0.13.0 with the following command:
zvm install 0.13.0
zvm use 0.13.0
No need to stick with zvm. Use the version manager1 of your choice.
The second way is to use the official release page. Download the 0.13.0 binary from Zig's release page and place it in an arbitrary directory in PATH.
Language Server
We use ZLS, Zig's language server. There are extensions available for various editors, so follow the Zig's Tool Guide to set up for your environment.
warning
You have to make sure that the version of Zig and ZLS is same2。
OVMF
OVMF is a project3 that supports UEFI on VMs. QEMU uses a legacy BIOS called SeaBIOS by default, but the bootloader in this blog expects to run on UEFI. We use a X64
build of OVMF, that boots in 64-bit mode. This allows the bootloader to start running in Long Mode.
Ubuntu users can install it with the following command:
sudo apt install ovmf
If you are using another OS or package manager, please install using their appropriate methods. You can also build from source code. In that case, follow the instructions in TianoCore's GitHub Wiki.
Another example is zigup.
ZLS will not work properly when used with inconsistent version of Zig (e.g. [“ZLS not pulling in information from dependencies”](https://ziggit.dev/t/zls-not-pulling-in-information- from-dependencies/4179))