Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make-disk-image: use OVMF efi always #643

Merged
merged 1 commit into from
May 21, 2024

Conversation

MatthewCroughan
Copy link
Contributor

@MatthewCroughan MatthewCroughan commented May 20, 2024

When building disk images, the VM used to perform partitioning/mkfs inherits the kernel from the nixosConfiguration we're trying to build for. This works fine, until you try to boot a kernel with zboot, and in that case you need UEFI to load the image, otherwise you end up with the following log from QEMU:

"unable to handle EFI zboot image with ... compression"

https://github.com/qemu/qemu/blob/master/hw/core/loader.c#L924

Loading OVMF allows us to bypass this issue, and boot the kernel successfully like this:

corpo-disko-images> UEFI firmware (version  built at 00:00:00 on Jan  1 1980)
corpo-disko-images> EFI stub: Decompressing Linux Kernel...
corpo-disko-images> EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
corpo-disko-images> EFI stub: Generating empty DTB
corpo-disko-images> EFI stub: Exiting boot services...
corpo-disko-images> loading kernel modules...

I think the architecture of inheriting the host kernel just to make a disk image from a nixosConfiguration might still be a bit wrong. But this PR fixes the issue for the time being.

@Lassulus Lassulus merged commit f1654e0 into nix-community:master May 21, 2024
40 checks passed
@MatthewCroughan MatthewCroughan deleted the mc/ovmf branch May 21, 2024 11:59
@Mic92
Copy link
Member

Mic92 commented Jun 3, 2024

I made an amendment and also made efi vars writable: #660

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.

3 participants