-
Notifications
You must be signed in to change notification settings - Fork 47
builder: add EFI-specific boot values #100
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
Conversation
e784b45
to
960069b
Compare
3a24d74
to
30e3193
Compare
30e3193
to
e86b659
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple of suggestions on the code but otherwise looks good.
// NOTE: when booting a UEFI machine with Secure Boot enabled, this has | ||
// to be a q35 derivative. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be some validation or warning in Prepare to let the user know that they have enabled EFI with a non-q35 derivative machine type?
I'm not sure if this is a simple check. So I would be cool if you tell me there are too many combinations to validate; its better for the user to see the failure 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EFI on a non-q35 machine is fine, the problem is Secure-Boot, which is only supported on q35 machines (can't fine the docs to refer to that, but other machine types AFAIK will result in a blank screen).
Not sure we can reliably validate that, maybe by checking the name for the OVMF_*fd, but that's a stretch as a user might rename them, and the check will not bump the error.
e86b659
to
67dd48e
Compare
BIOS and (U)EFI are two standard for booting machines. BIOS being legacy, which is still supported by several OSes, but is getting phased out little-by-little, in favour of EFI. EFI requires several components to boot a machine: a GPT-backed disk, a firmware to load the bootloaders, and efivars to keep persistent data in NVRAM between boots. This is translated in qemu as a collection of a code file that contains the firmware, and a vars file that holds a template efivars, which may have some keys or properties setup. This commit adds new configuration values to enable this. At its simplest, this might be just enabling `efi_enabled` to boot with EFI support. In practice, YMMV, as some protocols (typically Secure Boot) will require more setup before being able to get something to work as expected. The EFI CODE and VARS files are automatically loaded from /usr/share/OVMF if available, otherwise they need to be specified manually. The docs for Qemu are updated to reflect these changes.
67dd48e
to
e092632
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 1.0.7 - hashicorp/packer-plugin-qemu#100 version of the QEMU Packer plugin, it's possible to boot and build images in UEFI and with Secure Boot enabled Signed-off-by: Elkhan Mammadli <elkhan.mammadli@protonmail.com>
BIOS and (U)EFI are two standard for booting machines. BIOS being legacy, which is still supported by several OSes, but is getting phased out little-by-little, in favour of EFI.
EFI requires several components to boot a machine: a GPT-backed disk, a firmware to load the bootloaders, and efivars to keep persistent data in NVRAM between boots.
This is translated in qemu as a collection of a code file that contains the firmware, and a vars file that holds a template efivars, which may have some keys or properties setup.
This commit adds new configuration values to enable this. At its simplest, this might be just enabling
efi_enabled
to boot with EFI support.In practice, YMMV, as some protocols (typically Secure Boot) will require more setup before being able to get something to work as expected.
The EFI CODE and VARS files are automatically loaded from /usr/share/OVMF if available, otherwise they need to be specified manually.
The docs for Qemu are updated to reflect these changes.
Related to: #97