diff --git a/test/cases/010_platforms/000_qemu/060_run_raw_efi/test.sh b/test/cases/010_platforms/000_qemu/060_run_raw_efi/test.sh new file mode 100644 index 000000000..ca8eccc29 --- /dev/null +++ b/test/cases/010_platforms/000_qemu/060_run_raw_efi/test.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# SUMMARY: Check that EFI BIOS ISO boots in qemu +# LABELS: + +set -e + +# Source libraries. Uncomment if needed/defined +#. "${RT_LIB}" +. "${RT_PROJECT_ROOT}/_lib/lib.sh" + +NAME=qemu-raw-efi + +clean_up() { + rm -rf ${NAME}-* +} +trap clean_up EXIT + +# see https://github.com/linuxkit/linuxkit/issues/1872 this is very flaky in qemu +# disabling for now until we fix a config that works +exit $RT_CANCEL + +if command -v qemu-system-x86_64; then + if [ ! -f /usr/share/ovmf/bios.bin ]; then + exit $RT_CANCEL + fi +fi + +linuxkit build --format raw-efi --name "${NAME}" test.yml +[ -f "${NAME}-efi.img" ] || exit 1 +linuxkit run qemu --uefi "${NAME}-efi.img" | grep -q "Welcome to LinuxKit" + +exit 0 diff --git a/test/cases/010_platforms/000_qemu/060_run_raw_efi/test.yml b/test/cases/010_platforms/000_qemu/060_run_raw_efi/test.yml new file mode 100644 index 000000000..5a5c7f495 --- /dev/null +++ b/test/cases/010_platforms/000_qemu/060_run_raw_efi/test.yml @@ -0,0 +1,10 @@ +kernel: + image: linuxkit/kernel:6.12.52 + cmdline: "console=ttyS0" +init: + - linuxkit/init:26e546e4ef2669bd44d8c46e3164eb5ba7ae1a5c + - linuxkit/runc:98ddef9b5b87cb44783566ed2a86cea95439a631 +onboot: + - name: poweroff + image: linuxkit/poweroff:4059858a555bed90c2280fa9b060b7a8f8de6d45 + command: ["/bin/sh", "/poweroff.sh", "10"] diff --git a/tools/mkimage-raw-efi/README.md b/tools/mkimage-raw-efi/README.md new file mode 100644 index 000000000..6d91d8651 --- /dev/null +++ b/tools/mkimage-raw-efi/README.md @@ -0,0 +1,20 @@ +# ESP Structure Overview + +The script initializes an EFI System Partition using `mkfs.vfat` and populates it with directories and files for **systemd-boot** and a Linux Unified Kernel Image (UKI). + +## Partition Layout + +```bash +ESP +├── EFI +│ ├── BOOT # contains exactly one of the bootloader binaries below for the respective architecture +│ │ ├── BOOTX64.EFI # amd64 +│ │ ├── BOOTAA64.EFI # arm64 +│ │ └── BOOTRISCV64.EFI # riscv64 +│ └── Linux +│ └── linuxkit.efi # LinuxKit Unified Kernel Image (UKI) +└── loader + └── loader.conf # systemd-boot configuration file +``` + +UKIs in `EFI/Linux` do not need an explicit entry in `loader/entries` but are automatically picked up by `systemd-boot`.