From 217ea254876e84fead5624780b4ecde40fe690df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 7 Aug 2022 12:23:00 +0100 Subject: [PATCH] Add a short README. --- Makefile | 5 ++++- README.md | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/Makefile b/Makefile index 65fc360..9e8aff8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -targets = kaem-minimal hex0 ESP_SIZE_MIB = 50 QEMU = qemu-system-x86_64 QEMU_KVM = -enable-kvm @@ -47,7 +46,11 @@ rootfs: mkdir -p $(rootfs_dir)/bootstrap-seeds/UEFI/ rsync -av bootstrap-seeds/UEFI/ $(rootfs_dir)/bootstrap-seeds/UEFI/ +ifndef MINIMAL mv $(rootfs_dir)/bootstrap-seeds/UEFI/amd64/kaem-optional-seed.efi $(boot_dir)/BOOTX64.efi +else + rm $(rootfs_dir)/bootstrap-seeds/UEFI/amd64/kaem-optional-seed.efi +endif clean: rm -rf $(build_dir) diff --git a/README.md b/README.md new file mode 100644 index 0000000..f17cc1e --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# stage0-uefi + +This is a port of stage0-posix (https://github.com/oriansj/stage0-posix) to UEFI. + +## Usage + +`make build/disk.img` will create bootable images with stage0-uefi. You can use `dd` to write them on bootable media. + +`make qemu` will create disk image and launch it in QEMU. To test this in QEMU, you need to provide some QEMU compatible UEFI implementation. In particular, you can use Tianocore's OVMF. `make qemu` is looking for it in a few paths where distros tend to install it. If not you can specify it via `make qemu OVMF_IMG=/path/to/OVMF_CODE.fd` + +## Minimal images + +It is possible to create images without `kaem-optional-seed.efi` that contain only `hex0-seed.efi`. Those are a bit less automated but if your UEFI implementation lets you to pass command line arguments, you can recreate kaem using just hex0. + +- `make MINIMAL=1 qemu`. +- Open UEFI settings (often F2 but it varies from system to system). +- Go to `Add Boot option` and pick appropriate boot volume that contains `hex0-seed.efi`. +- Pick `\bootstrap-seeds\UEFI\amd64\hex0-seed.efi`. +- Description can be anything, say `kaem-seed`. +- Optional Data has to be `hex0 amd64\kaem-minimal.hex0 EFI\BOOT\BOOTX64.efi`. +- Save boot entry and boot it. This will build kaem-minimal and exit. +- Now boot normally from bootable media.