From fa2f35f124a942755ec2df67e3426f656f296102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Tue, 14 May 2024 14:29:10 +0200 Subject: [PATCH] docs(readme): document UEFI setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 358dbe84..81752882 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ This project is a bootloader to run the [Hermit kernel](https://github.com/hermi * [`rustup`](https://www.rust-lang.org/tools/install) +### UEFI Boot in x86-64 QEMU + +As QEMU does not include a UEFI implementation, you have to download the Open Virtual Machine Firmware (OVMF) UEFI implementation separately. +You can download prebuilt OVMF images from [rust-osdev/ovmf-prebuilt](https://github.com/rust-osdev/ovmf-prebuilt). + ## Building ```bash @@ -34,6 +39,34 @@ qemu-system-x86_64 \ -initrd ``` +#### UEFI Boot + +For booting from UEFI, we have to set up an EFI system partition (ESP). +OVMF will automatically load and execute the loader if placed at `\efi\boot\bootx64.efi` in the ESP. +The Hermit application has to be next to the loader with the filename `hermit-app`. +You can set the ESP up with the following commands: + +```bash +$ mkdir -p esp/efi/boot +$ cp esp/efi/boot/bootx64.efi +$ cp esp/efi/boot/hermit-app +``` + +Then, you can boot Hermit like this: + +```bash +qemu-system-x86_64 \ + -enable-kvm \ + -cpu host \ + -smp 1 \ + -m 512M \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ + -display none -serial stdio \ + -drive if=pflash,format=raw,readonly=on,file= \ + -drive if=pflash,format=raw,readonly=on,file= \ + -drive format=raw,file=fat:rw:esp +``` + #### No KVM If you want to emulate x86-64 instead of using KVM, omit `-enable-kvm` and set the CPU explicitly to a model of your choice, for example `-cpu Skylake-Client`.