mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 15:40:16 +00:00
feat(bootloader-interface): implement support for UEFI firmware information
This commit is contained in:
@@ -58,6 +58,22 @@ impl BootloaderInterface {
|
|||||||
Self::set_cstr16("LoaderEntrySelected", &entry)
|
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.
|
/// The [VariableAttributes] for bootloader interface variables.
|
||||||
fn attributes() -> VariableAttributes {
|
fn attributes() -> VariableAttributes {
|
||||||
VariableAttributes::BOOTSERVICE_ACCESS | VariableAttributes::RUNTIME_ACCESS
|
VariableAttributes::BOOTSERVICE_ACCESS | VariableAttributes::RUNTIME_ACCESS
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ fn run() -> Result<()> {
|
|||||||
BootloaderInterface::mark_init(&timer)
|
BootloaderInterface::mark_init(&timer)
|
||||||
.context("unable to mark initialization in bootloader interface")?;
|
.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.
|
// Parse the options to the sprout executable.
|
||||||
let options = SproutOptions::parse().context("unable to parse options")?;
|
let options = SproutOptions::parse().context("unable to parse options")?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user