fix(boot): tidy the devicetree, reboot and profile handling after review

Only warn about a devicetree under Secure Boot when the entry has one,
skip the fixup if its protocol can't be opened, and reject a devicetree
whose size is smaller than its header. Announce a reboot before the
delay, advertise the multi-profile UKI feature, and treat a Type 1 entry
with a profile after the first as an extra profile that is not picked as
the fallback default. A failure to read Sprout's own partition no longer
drops the entries of the XBOOTLDR partition, and the README lists every
initrd slot and describes the reboot behaviour more exactly.
This commit is contained in:
alex authored and Alex Zenla committed 2026-10-03 20:23:57 -07:00
1 parent 27c2d32900
commit 4e10d57143
8 files changed
+72 -20

No files matched your search

+7 -4
View File
@@ -67,8 +67,8 @@ impl DeviceTree {
if magic != FDT_MAGIC {
bail!("the file is not a flattened devicetree");
}
if total > dtb.len() {
bail!("the devicetree is truncated");
if total < FDT_HEADER_SIZE || total > dtb.len() {
bail!("the devicetree has an invalid size");
}
Ok(())
}
@@ -127,8 +127,11 @@ impl DeviceTree {
let Some(handle) = find_handle(&DT_FIXUP_GUID)? else {
return Ok(());
};
let mut protocol = uefi::boot::open_protocol_exclusive::<DtFixupProtocol>(handle)
.context("unable to open the devicetree fixup protocol")?;
// Without the protocol the devicetree is used as it is, as in systemd-boot.
let Ok(mut protocol) = crate::handle::open_shared::<DtFixupProtocol>(handle) else {
warn!("unable to open the devicetree fixup protocol, skipping the fixup");
return Ok(());
};
let fixup = protocol.fixup;
let this: *mut DtFixupProtocol = &mut *protocol;
let flags = DT_APPLY_FIXUPS | DT_RESERVE_MEMORY;