feat(bootloader-interface): identify ourselves as sprout

This commit is contained in:
2025-10-30 12:50:36 -04:00
parent cff55322fc
commit cc90199d61
2 changed files with 12 additions and 0 deletions

View File

@@ -5,6 +5,9 @@ use uefi::proto::device_path::DevicePath;
use uefi::{CString16, Guid, guid};
use uefi_raw::table::runtime::{VariableAttributes, VariableVendor};
/// The name of the bootloader to tell the system.
const LOADER_NAME: &str = "Sprout";
/// Bootloader Interface support.
pub struct BootloaderInterface;
@@ -30,6 +33,11 @@ impl BootloaderInterface {
Self::set_cstr16(key, &elapsed.as_micros().to_string())
}
/// Tell the system what loader is being used.
pub fn set_loader_info() -> Result<()> {
Self::set_cstr16("LoaderInfo", LOADER_NAME)
}
/// Tell the system the relative path to the partition root of the current bootloader.
pub fn set_loader_path(path: &DevicePath) -> Result<()> {
let subpath = device_path_subpath(path).context("unable to get loader path subpath")?;

View File

@@ -76,6 +76,10 @@ fn run() -> Result<()> {
BootloaderInterface::set_firmware_info()
.context("unable to set firmware info in bootloader interface")?;
// Tell the bootloader interface what loader is being used.
BootloaderInterface::set_loader_info()
.context("unable to set loader info in bootloader interface")?;
// Parse the options to the sprout executable.
let options = SproutOptions::parse().context("unable to parse options")?;