mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 12:30:17 +00:00
feat(bootloader-interface): identify ourselves as sprout
This commit is contained in:
@@ -5,6 +5,9 @@ use uefi::proto::device_path::DevicePath;
|
|||||||
use uefi::{CString16, Guid, guid};
|
use uefi::{CString16, Guid, guid};
|
||||||
use uefi_raw::table::runtime::{VariableAttributes, VariableVendor};
|
use uefi_raw::table::runtime::{VariableAttributes, VariableVendor};
|
||||||
|
|
||||||
|
/// The name of the bootloader to tell the system.
|
||||||
|
const LOADER_NAME: &str = "Sprout";
|
||||||
|
|
||||||
/// Bootloader Interface support.
|
/// Bootloader Interface support.
|
||||||
pub struct BootloaderInterface;
|
pub struct BootloaderInterface;
|
||||||
|
|
||||||
@@ -30,6 +33,11 @@ impl BootloaderInterface {
|
|||||||
Self::set_cstr16(key, &elapsed.as_micros().to_string())
|
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.
|
/// Tell the system the relative path to the partition root of the current bootloader.
|
||||||
pub fn set_loader_path(path: &DevicePath) -> Result<()> {
|
pub fn set_loader_path(path: &DevicePath) -> Result<()> {
|
||||||
let subpath = device_path_subpath(path).context("unable to get loader path subpath")?;
|
let subpath = device_path_subpath(path).context("unable to get loader path subpath")?;
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ fn run() -> Result<()> {
|
|||||||
BootloaderInterface::set_firmware_info()
|
BootloaderInterface::set_firmware_info()
|
||||||
.context("unable to set firmware info in bootloader interface")?;
|
.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.
|
// 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