get_boot_label

Function get_boot_label 

Source
pub fn get_boot_label(image: &[u8]) -> Result<String, UkiError>
Expand description

Gets an appropriate label for display in the boot menu for the given UKI image, according to the “Type #2 EFI Unified Kernel Images” section in the Boot Loader Specification. This will be based on the “PRETTY_NAME” and “VERSION_ID” fields found in the os-release file (falling back to “ID” and/or “VERSION” if they are not present).

For more information, see:

§Arguments

  • image: the complete UKI image as a byte slice

§Return value

If we could successfully parse the provided UKI as a Portable Executable file and find an “.osrel” section in it, return a string to use as the boootloader entry. If we were unable to find any meaningful content in the os-release information this will be “Unknown 0”.

If we couldn’t parse the PE file or couldn’t find an “.osrel” section then an error will be returned.