Skip to content

Commit cc90199

Browse files
committed
feat(bootloader-interface): identify ourselves as sprout
1 parent cff5532 commit cc90199

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/integrations/bootloader_interface.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use uefi::proto::device_path::DevicePath;
55
use uefi::{CString16, Guid, guid};
66
use uefi_raw::table::runtime::{VariableAttributes, VariableVendor};
77

8+
/// The name of the bootloader to tell the system.
9+
const LOADER_NAME: &str = "Sprout";
10+
811
/// Bootloader Interface support.
912
pub struct BootloaderInterface;
1013

@@ -30,6 +33,11 @@ impl BootloaderInterface {
3033
Self::set_cstr16(key, &elapsed.as_micros().to_string())
3134
}
3235

36+
/// Tell the system what loader is being used.
37+
pub fn set_loader_info() -> Result<()> {
38+
Self::set_cstr16("LoaderInfo", LOADER_NAME)
39+
}
40+
3341
/// Tell the system the relative path to the partition root of the current bootloader.
3442
pub fn set_loader_path(path: &DevicePath) -> Result<()> {
3543
let subpath = device_path_subpath(path).context("unable to get loader path subpath")?;

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ fn run() -> Result<()> {
7676
BootloaderInterface::set_firmware_info()
7777
.context("unable to set firmware info in bootloader interface")?;
7878

79+
// Tell the bootloader interface what loader is being used.
80+
BootloaderInterface::set_loader_info()
81+
.context("unable to set loader info in bootloader interface")?;
82+
7983
// Parse the options to the sprout executable.
8084
let options = SproutOptions::parse().context("unable to parse options")?;
8185

0 commit comments

Comments
 (0)