mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 22:42:21 +00:00
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:
1 parent
27c2d32900
commit
4e10d57143
8 files changed
+72
-20
No files matched your search
@@ -68,6 +68,7 @@ impl BootloaderInterface {
|
||||
| LoaderFeatures::EntryPreferred
|
||||
| LoaderFeatures::SortKey
|
||||
| LoaderFeatures::DeviceTree
|
||||
| LoaderFeatures::MultiProfileUki
|
||||
}
|
||||
|
||||
/// Tell the system that Sprout was initialized at the current time.
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user