mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 18:42:21 +00:00
feat(eficore): advertise the sort key and preferred entry features
This commit is contained in:
1 parent
6ea9fa9dbf
commit
a26a5f1639
2 files changed
+25
-3
No files matched your search
@@ -13,8 +13,8 @@ use uefi_raw::table::runtime::VariableVendor;
|
|||||||
/// bitflags: LoaderFeatures bitflags.
|
/// bitflags: LoaderFeatures bitflags.
|
||||||
mod bitflags;
|
mod bitflags;
|
||||||
|
|
||||||
/// The name of the bootloader to tell the system.
|
/// The name and version of the bootloader to tell the system.
|
||||||
const LOADER_NAME: &str = "Sprout";
|
const LOADER_NAME: &str = concat!("Sprout ", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
/// Represents the configured timeout for the bootloader interface.
|
/// Represents the configured timeout for the bootloader interface.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@@ -56,7 +56,6 @@ impl BootloaderInterface {
|
|||||||
/// The feature we support in Sprout.
|
/// The feature we support in Sprout.
|
||||||
fn features() -> LoaderFeatures {
|
fn features() -> LoaderFeatures {
|
||||||
LoaderFeatures::Xbootldr
|
LoaderFeatures::Xbootldr
|
||||||
| LoaderFeatures::LoadDriver
|
|
||||||
| LoaderFeatures::Tpm2ActivePcrBanks
|
| LoaderFeatures::Tpm2ActivePcrBanks
|
||||||
| LoaderFeatures::RetainShim
|
| LoaderFeatures::RetainShim
|
||||||
| LoaderFeatures::ConfigTimeout
|
| LoaderFeatures::ConfigTimeout
|
||||||
@@ -66,6 +65,8 @@ impl BootloaderInterface {
|
|||||||
| LoaderFeatures::EntryOneShot
|
| LoaderFeatures::EntryOneShot
|
||||||
| LoaderFeatures::BootCounting
|
| LoaderFeatures::BootCounting
|
||||||
| LoaderFeatures::SavedEntry
|
| LoaderFeatures::SavedEntry
|
||||||
|
| LoaderFeatures::EntryPreferred
|
||||||
|
| LoaderFeatures::SortKey
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tell the system that Sprout was initialized at the current time.
|
/// Tell the system that Sprout was initialized at the current time.
|
||||||
@@ -347,6 +348,21 @@ impl BootloaderInterface {
|
|||||||
.filter(|value| !value.is_empty()))
|
.filter(|value| !value.is_empty()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the preferred entry set by the bootloader interface.
|
||||||
|
/// Unlike the default entry, an entry with no boot counter tries left is not used.
|
||||||
|
pub fn get_preferred_entry() -> Result<Option<String>> {
|
||||||
|
// An empty value is treated as if the preferred entry was not set.
|
||||||
|
Ok(Self::VENDOR
|
||||||
|
.get_cstr16("LoaderEntryPreferred")
|
||||||
|
.context("unable to get preferred entry from bootloader interface")?
|
||||||
|
.filter(|value| !value.is_empty()))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Remove the entry that was saved by a previous boot.
|
||||||
|
pub fn remove_last_booted_entry() -> Result<()> {
|
||||||
|
Self::VENDOR.remove("LoaderEntryLastBooted")
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the oneshot entry set by the bootloader interface.
|
/// Get the oneshot entry set by the bootloader interface.
|
||||||
/// This should be the entry we boot.
|
/// This should be the entry we boot.
|
||||||
pub fn get_oneshot_entry() -> Result<Option<String>> {
|
pub fn get_oneshot_entry() -> Result<Option<String>> {
|
||||||
|
|||||||
@@ -42,5 +42,11 @@ bitflags! {
|
|||||||
const Type1UkiUrl = 1 << 17;
|
const Type1UkiUrl = 1 << 17;
|
||||||
/// Bootloader indicates TPM2 active PCR banks.
|
/// Bootloader indicates TPM2 active PCR banks.
|
||||||
const Tpm2ActivePcrBanks = 1 << 18;
|
const Tpm2ActivePcrBanks = 1 << 18;
|
||||||
|
/// Bootloader supports LoaderEntryPreferred.
|
||||||
|
const EntryPreferred = 1 << 19;
|
||||||
|
/// Bootloader supports the keyboard layout.
|
||||||
|
const KeyboardLayout = 1 << 20;
|
||||||
|
/// Bootloader measures SMBIOS data.
|
||||||
|
const SmbiosMeasured = 1 << 21;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user