mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 18:40:18 +00:00
implement support for filesystem extractor mechanism
This commit is contained in:
@@ -20,22 +20,20 @@ pub struct ChainloadConfiguration {
|
||||
|
||||
pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfiguration) -> Result<()> {
|
||||
let sprout_image = uefi::boot::image_handle();
|
||||
let image_device_path_protocol =
|
||||
let _image_device_path_protocol =
|
||||
uefi::boot::open_protocol_exclusive::<LoadedImageDevicePath>(sprout_image)
|
||||
.context("unable to open loaded image device path protocol")?;
|
||||
|
||||
let mut full_path = utils::device_path_root(&image_device_path_protocol)?;
|
||||
|
||||
full_path.push_str(&context.stamp(&configuration.path));
|
||||
|
||||
info!("path: {}", full_path);
|
||||
|
||||
let device_path = utils::text_to_device_path(&full_path)?;
|
||||
let resolved = utils::resolve_path(
|
||||
context.root().loaded_image_path()?,
|
||||
&context.stamp(&configuration.path),
|
||||
)
|
||||
.context("failed to resolve chainload path")?;
|
||||
|
||||
let image = uefi::boot::load_image(
|
||||
sprout_image,
|
||||
uefi::boot::LoadImageSource::FromDevicePath {
|
||||
device_path: &device_path,
|
||||
device_path: &resolved.full_path,
|
||||
boot_policy: uefi::proto::BootPolicy::ExactMatch,
|
||||
},
|
||||
)
|
||||
@@ -77,8 +75,8 @@ pub fn chainload(context: Rc<SproutContext>, configuration: &ChainloadConfigurat
|
||||
let mut initrd_handle = None;
|
||||
if let Some(ref linux_initrd) = configuration.linux_initrd {
|
||||
let initrd_path = context.stamp(linux_initrd);
|
||||
let content =
|
||||
utils::read_file_contents(&initrd_path).context("failed to read linux initrd")?;
|
||||
let content = utils::read_file_contents(context.root().loaded_image_path()?, &initrd_path)
|
||||
.context("failed to read linux initrd")?;
|
||||
initrd_handle = Some(
|
||||
register_linux_initrd(content.into_boxed_slice())
|
||||
.context("failed to register linux initrd")?,
|
||||
|
||||
@@ -96,7 +96,7 @@ fn draw(image: DynamicImage) -> Result<()> {
|
||||
|
||||
pub fn splash(context: Rc<SproutContext>, configuration: &SplashConfiguration) -> Result<()> {
|
||||
let image = context.stamp(&configuration.image);
|
||||
let image = read_file_contents(&image)?;
|
||||
let image = read_file_contents(context.root().loaded_image_path()?, &image)?;
|
||||
let image = ImageReader::with_format(Cursor::new(image), ImageFormat::Png)
|
||||
.decode()
|
||||
.context("failed to decode splash image")?;
|
||||
|
||||
Reference in New Issue
Block a user