fix(bootloader-interface): report the correct firmware revision

This commit is contained in:
2025-10-30 23:25:48 -04:00
parent a2f017ba30
commit c1a672afcb
2 changed files with 8 additions and 5 deletions

View File

@@ -88,7 +88,7 @@ impl BootloaderInterface {
// Write the bytes into the data buffer. // Write the bytes into the data buffer.
data.extend_from_slice(&encoded); data.extend_from_slice(&encoded);
// Add a null terminator to the end of the entry. // Add a null terminator to the end of the entry.
data.push(0); data.extend_from_slice(&[0, 0]);
} }
Self::VENDOR.set( Self::VENDOR.set(
"LoaderEntries", "LoaderEntries",
@@ -117,12 +117,15 @@ impl BootloaderInterface {
/// Tell the system about the UEFI firmware we are running on. /// Tell the system about the UEFI firmware we are running on.
pub fn set_firmware_info() -> Result<()> { pub fn set_firmware_info() -> Result<()> {
// Access the firmware revision.
let revision = uefi::system::firmware_revision();
// Format the firmware information string into something human-readable. // Format the firmware information string into something human-readable.
let firmware_info = format!( let firmware_info = format!(
"{} {}.{:02}", "{} {}.{:02}",
uefi::system::firmware_vendor(), uefi::system::firmware_vendor(),
uefi::system::firmware_revision() >> 16, revision >> 16,
uefi::system::firmware_revision() & 0xFFFFF, revision & 0xffff,
); );
Self::VENDOR.set_cstr16( Self::VENDOR.set_cstr16(
"LoaderFirmwareInfo", "LoaderFirmwareInfo",
@@ -131,7 +134,7 @@ impl BootloaderInterface {
)?; )?;
// Format the firmware revision into something human-readable. // Format the firmware revision into something human-readable.
let firmware_type = format!("UEFI {:02}", uefi::system::firmware_revision()); let firmware_type = format!("UEFI {}.{:02}", revision >> 16, revision & 0xffff);
Self::VENDOR.set_cstr16( Self::VENDOR.set_cstr16(
"LoaderFirmwareType", "LoaderFirmwareType",
&firmware_type, &firmware_type,

View File

@@ -89,7 +89,7 @@ impl VariableController {
.flat_map(|c| c.to_le_bytes()) .flat_map(|c| c.to_le_bytes())
.collect::<Vec<u8>>(); .collect::<Vec<u8>>();
// Add a null terminator to the end of the value. // Add a null terminator to the end of the value.
encoded.push(0); encoded.extend_from_slice(&[0, 0]);
self.set(key, &encoded, class) self.set(key, &encoded, class)
} }