mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 17:42:20 +00:00
fix(chainload): don't register an empty initrd
An initrd file, or chain of initrd files, with no contents was still registered with the initrd media loader, which reports NOT_FOUND for empty data. The Linux EFI stub treats anything other than BUFFER_TOO_SMALL as a load error and fails to boot, rather than booting without an initrd. Skip registering an empty initrd, as the edera action already does.
This commit is contained in:
1 parent
a77803dfe8
commit
5dcfbdc8c5
1 file changed
+3
-1
@@ -116,8 +116,10 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If an initrd was read, register it with the EFI stack.
|
// If an initrd was read, register it with the EFI stack.
|
||||||
|
// An empty initrd is not registered, as Linux fails to boot if the initrd it is
|
||||||
|
// given can't be loaded, instead of booting without one.
|
||||||
let mut initrd_handle = None;
|
let mut initrd_handle = None;
|
||||||
if let Some(content) = initrd {
|
if let Some(content) = initrd.filter(|content| !content.is_empty()) {
|
||||||
let handle =
|
let handle =
|
||||||
MediaLoaderHandle::register(LINUX_EFI_INITRD_MEDIA_GUID, content.into_boxed_slice())
|
MediaLoaderHandle::register(LINUX_EFI_INITRD_MEDIA_GUID, content.into_boxed_slice())
|
||||||
.context("unable to register linux initrd")?;
|
.context("unable to register linux initrd")?;
|
||||||
|
|||||||
Reference in new issue
Block a user