mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 22:10:17 +00:00
feat(bootloader-interface): add support for LoaderEntryDefault and LoaderEntryOneShot
This commit is contained in:
@@ -45,6 +45,8 @@ impl BootloaderInterface {
|
||||
| LoaderFeatures::ConfigTimeout
|
||||
| LoaderFeatures::ConfigTimeoutOneShot
|
||||
| LoaderFeatures::MenuDisable
|
||||
| LoaderFeatures::EntryDefault
|
||||
| LoaderFeatures::EntryOneShot
|
||||
}
|
||||
|
||||
/// Tell the system that Sprout was initialized at the current time.
|
||||
@@ -275,4 +277,32 @@ impl BootloaderInterface {
|
||||
// We provide the unspecified value instead.
|
||||
Ok(BootloaderInterfaceTimeout::Unspecified)
|
||||
}
|
||||
|
||||
/// Get the default entry set by the bootloader interface.
|
||||
pub fn get_default_entry() -> Result<Option<String>> {
|
||||
Self::VENDOR
|
||||
.get_cstr16("LoaderEntryDefault")
|
||||
.context("unable to get default entry from bootloader interface")
|
||||
}
|
||||
|
||||
/// Get the oneshot entry set by the bootloader interface.
|
||||
/// This should be the entry we boot.
|
||||
pub fn get_oneshot_entry() -> Result<Option<String>> {
|
||||
// Acquire the value of the LoaderEntryOneShot variable.
|
||||
// If it is not set, return None.
|
||||
let Some(value) = Self::VENDOR
|
||||
.get_cstr16("LoaderEntryOneShot")
|
||||
.context("unable to get oneshot entry from bootloader interface")?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
// Remove the oneshot entry from the bootloader interface.
|
||||
Self::VENDOR
|
||||
.remove("LoaderEntryOneShot")
|
||||
.context("unable to remove oneshot entry")?;
|
||||
|
||||
// Return the oneshot value.
|
||||
Ok(Some(value))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user