-
On all platforms:
- git
- VSCode (for class exercises)
- The
rust-analyzer
VSCode extension
-
On macOS
- Homebrew
- Xcode Command Line Tools
-
On Ubuntu
- build-essential
sudo apt install build-essential
- build-essential
-
On Windows
- WSL + build-essential
- The
Remote Development
VSCode extension - Note: all commands below should be executed within WSL unless otherwise stated. This includes VSCode. It must be started from the WSL shell, not from the Windows native command prompt. Workflow on native Windows is possible but not documented since WSL is still required.
-
On Arch Linux
- Run the command below to get all the dependencies and follow the build and test process for Ubuntu
sudo pacman -S seabios edk2-ovmf readline base-devel ; sudo cp /usr/share/ovmf/x64/OVMF.fd /usr/share/ovmf
- Install Rust, UEFI target support as well as other dependencies required for Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env" rustup +nightly target add x86_64-unknown-uefi
- (macOS-only) Change the default toolchain to
stable-x86_64-apple-darwin
.rustup default stable-x86_64-apple-darwin
- Clone the repo. It can be any location. This document uses
~
as an example.cd ~ git clone [email protected]:tandasat/Hypervisor-101-in-Rust.git
- Build the whole workspace.
cd Hypervisor-101-in-Rust cargo build
On VSCode, the cargo build
task is also available.
- Clone Bochs. It can be any location. This document uses
~
as an example.cd ~ git clone -b gcc [email protected]:tandasat/Bochs.git
- Configure, build and install Bochs.
- On macOS
cd Bochs/bochs sh .conf.macosx make sudo make install
- On Ubuntu and Windows
sudo apt install ovmf vgabios cd Bochs/bochs sh .conf.linux make sudo make install
- On macOS
- Build and run the hypervisor on Bochs
- On macOS
brew install p7zip brew install mtools cd ~/Hypervisor-101-in-Rust/ cargo xtask bochs-intel # or cargo xtask bochs-amd
- On Ubuntu and Windows
sudo apt install p7zip-full mtools cd ~/Hypervisor-101-in-Rust/ cargo xtask bochs-intel # or cargo xtask bochs-amd
- On macOS
On VSCode, the cargo xtask bochs-intel
and cargo xtask bochs-amd
tasks are also available.
Prerequisite software:
- On macOS
- VMware Fusion Pro
- On Windows and Ubuntu
- VMware Workstation Pro
- (Windows-only) Hyper-V needs to be disabled to run the VMware VM. See #7 for the details.
- Install dependencies.
- On macOS
brew install cdrtools
- On Ubuntu and Windows
sudo apt install genisoimage
- On macOS
- Build and run the hypervisor on VMware.
cd ~/Hypervisor-101-in-Rust/ cargo xtask vmware
- When VMware starts and shows a boot option, select "EFI Internal Shell (Unsupported option)".
On VSCode, the cargo xtask vmware
task is also available.
To test on bare metal, have a device with serial output. Copy rhv.efi
, the snapshot, patch, and corpus files into a FAT32 formatted USB thumb drive. Then, boot the test device, start the UEFI shell, and start the rhv.efi
.