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

[WIP] EVE Custom EFI App to change UEFI setings #4318

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shjala
Copy link
Member

@shjala shjala commented Oct 4, 2024

The idea is to not have pre-cooked OVMF_VARS files for different UEFI settings, but to have EFI application to run and manipulate the settings to our liking before booting the guest VMs.

The EVE part is janky and hacky, I will fix that in time, right now I'm more interested to know if this is viable option or not, so @rene @eriknordmark @OhmSpectator @rucoder comments are welcomed.

This is how it works :

  1. Run qemu with only option to boot into the UEFI shell and run the EFI app, this is needed because I can't trust how UEFI is creating the boot order so we need a way to guarantee that our app gets a chance to run.
  2. Run the efi app, change the settings, we can feed custom config to the app as smbios OEM strings.
  3. Running the efi app will change the boot order in the OVMF_VARS.fd so when EVE is launching the VM (using the OVMF_VARS cooked in 2), it will continue to boot into the UEFI shell even if there is nothing to run (no efi.img passed to qemu)
  4. To fix this we run the qemu with the efi app present but this time efi app tries all the boot options until it finds an option that boots successfully.

Efi app is simple and uses gnu-efi.

Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
@shjala shjala marked this pull request as draft October 4, 2024 16:10
@shjala shjala added the enhancement New feature or request label Oct 4, 2024
@rucoder
Copy link
Contributor

rucoder commented Oct 8, 2024

@shjala I do not really understand how SMBIOS custom string may affect EFI variable. Could you point me to a spec?

}

CHAR8 *
GetSmbiosString(
Copy link
Member Author

@shjala shjala Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rucoder (1/2) here I get the OEM string aka type=11,value=BlahBlah, aka BlahBlah in the smbios string table.

CHAR16 *ConfigValue;
*TryBootOptios = FALSE;

Status = GetSmbiosConfigString(EVE_TRY_ALL_BOOT, &ConfigValue);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rucoder (2/2) here I convert the smbios OEM string to the a predefined config value and then apply it based on what it is.

@shjala
Copy link
Member Author

shjala commented Oct 8, 2024

@shjala I do not really understand how SMBIOS custom string may affect EFI variable. Could you point me to a spec?

It won't, I read the SMBIOS custom string in my EFI application, if it is one of the pre-defined config values I parse it and then apply it.

@shjala
Copy link
Member Author

shjala commented Nov 13, 2024

Reminder to add this too lf-edge/eve-api#71

{0x3583ff6, 0xcb36, 0x4940, {0x94, 0x7e, 0xb9, 0xb3, 0x9f, 0x4a, 0xfa, 0xf7}};

//
// Randmyly generated GUID, rolled a dice!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "Randmyly" -> Randomly

@rene
Copy link
Contributor

rene commented Dec 10, 2024

@shjala , I think the approach of having an EFI app is fine, I have only one concern: in case user enters in the BIOS setup and change the resolution manually to something different from the cloud config, it won't work, so we need to have a disclaimer about that in the docs.... Maybe as a long term solution, I would consider change OVMF to fetch the config directly from our API... what do you think? Too much efforts? Worth of it?

@rene
Copy link
Contributor

rene commented Dec 10, 2024

Also, please, keep in mind that eventually we will need to have this support for arm64 as well....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants