Skip to content

feat: add a way to boot UEFI with -kernel and -initrd QEMU args#615

Open
zyuiop wants to merge 4 commits into
hermit-os:mainfrom
zyuiop:feat/efi-direct-boot
Open

feat: add a way to boot UEFI with -kernel and -initrd QEMU args#615
zyuiop wants to merge 4 commits into
hermit-os:mainfrom
zyuiop:feat/efi-direct-boot

Conversation

@zyuiop

@zyuiop zyuiop commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

In order for a -kernel argument to be valid for UEFI boot with AMD SEV-SNP, it needs to "look" like a Linux Kernel, and specifically bits at positions 0x202 must be set to the LinuxBoot magic value, with version at least 0x202.
This requires "patching" the image, for which I provide an additional step in the xtask build scripts.

In addition, I modify the uefi entrypoint to parse OVMF provided command line arguments, which include the initrd= path for the -initrd arguments, as well as any provided -append arguments, and use those instead of the default hermit-app and hermit-args files.

This is particularly useful for AMD SEV-SNP because it allows us to use "Measured Direct Boot" (a feature of QEMU which takes the kernel/initrd/append arguments and puts their hashes directly in OVMF, ensuring they are verified before boot, and therefore guaranteeing integrity of the files) with Hermit, without relying on Secure Boot (which we were doing up until now in a non-published patch)

@zyuiop zyuiop force-pushed the feat/efi-direct-boot branch from 67109f8 to 9098036 Compare June 7, 2026 12:50
@zyuiop

zyuiop commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Re. the funky build script: I was planning to use linker scripts for that initially, but it seems we cannot add a linker script with *-unknown-uefi targets (I was getting a "unknown argument -Tlink.ld" warning at compilation).

In any case I don't know how to write linker scripts so this is probably the easiest way.

We can potentially split the PR in two, one with the rust code changes, and one with the README + funky script.

@zyuiop zyuiop force-pushed the feat/efi-direct-boot branch from 9098036 to c76dcaf Compare June 7, 2026 14:14
@zyuiop zyuiop force-pushed the feat/efi-direct-boot branch from c76dcaf to 22dd6a2 Compare June 7, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant