mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-05 00:12:20 +00:00
fix(initrd): pad each chained initrd to a 4-byte boundary
Chained initrds were concatenated back to back. Linux only finds a cpio archive at a 4-byte aligned offset when it unpacks concatenated initrds, so a compressed initramfs with an odd length followed by another archive, like a microcode or overlay cpio, failed to unpack. Pad each initrd with zeros to a 4-byte boundary, as GRUB and systemd-boot do.
This commit is contained in:
1 parent
cd38f0271d
commit
e96a5a64c9
3 files changed
+37
-4
No files matched your search
@@ -5,7 +5,7 @@ use alloc::rc::Rc;
|
||||
use alloc::vec::Vec;
|
||||
use anyhow::{Context, Result, bail};
|
||||
use edera_sprout_config::actions::chainload::ChainloadConfiguration;
|
||||
use edera_sprout_parsing::{combine_options, empty_is_none};
|
||||
use edera_sprout_parsing::{append_initrd, combine_options, empty_is_none};
|
||||
use eficore::bootloader_interface::BootloaderInterface;
|
||||
use eficore::loader::source::ImageSource;
|
||||
use eficore::loader::{ImageLoadRequest, ImageLoader};
|
||||
@@ -112,7 +112,7 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
continue;
|
||||
};
|
||||
match initrd.as_mut() {
|
||||
Some(initrd) => initrd.extend_from_slice(&content),
|
||||
Some(initrd) => append_initrd(initrd, &content),
|
||||
None => initrd = Some(content),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user