Add raw-efi test + documentation

Signed-off-by: Chris Irrgang <chris.irrgang@gmx.de>
This commit is contained in:
Chris Irrgang
2025-11-03 23:36:40 +00:00
committed by Avi Deitcher
parent 804d52374e
commit 56e37a842e
3 changed files with 62 additions and 0 deletions

View File

@@ -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

View File

@@ -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"]

View File

@@ -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`.