feat(bootloader-interface): implement support for UEFI firmware information

This commit is contained in:
2025-10-30 11:47:35 -04:00
parent a77be3c282
commit 37ab0406bb
2 changed files with 20 additions and 0 deletions

View File

@@ -58,6 +58,22 @@ impl BootloaderInterface {
Self::set_cstr16("LoaderEntrySelected", &entry)
}
/// Tell the system about the UEFI firmware we are running on.
pub fn set_firmware_info() -> Result<()> {
// Format the firmware information string into something human-readable.
let firmware_info = format!(
"{} {}.{:02}",
uefi::system::firmware_vendor(),
uefi::system::firmware_revision() >> 16,
uefi::system::firmware_revision() & 0xFFFFF,
);
Self::set_cstr16("LoaderFirmwareInfo", &firmware_info)?;
// Format the firmware revision into something human-readable.
let firmware_type = format!("UEFI {:02}", uefi::system::firmware_revision());
Self::set_cstr16("LoaderFirmwareType", &firmware_type)
}
/// The [VariableAttributes] for bootloader interface variables.
fn attributes() -> VariableAttributes {
VariableAttributes::BOOTSERVICE_ACCESS | VariableAttributes::RUNTIME_ACCESS

View File

@@ -72,6 +72,10 @@ fn run() -> Result<()> {
BootloaderInterface::mark_init(&timer)
.context("unable to mark initialization in bootloader interface")?;
// Tell the bootloader interface what firmware we are running on.
BootloaderInterface::set_firmware_info()
.context("unable to set firmware info in bootloader interface")?;
// Parse the options to the sprout executable.
let options = SproutOptions::parse().context("unable to parse options")?;