From df716e17d6e2a1e260a7f3f14a15fc53c997e678 Mon Sep 17 00:00:00 2001 From: Julian Stecklina Date: Thu, 24 Nov 2022 12:18:23 +0100 Subject: [PATCH] Add documentation to initrd loader --- rust/lanzaboote/src/linux_loader.rs | 9 ++++++++- rust/lanzaboote/src/main.rs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rust/lanzaboote/src/linux_loader.rs b/rust/lanzaboote/src/linux_loader.rs index ad00c85..95f9922 100644 --- a/rust/lanzaboote/src/linux_loader.rs +++ b/rust/lanzaboote/src/linux_loader.rs @@ -185,6 +185,10 @@ fn initrd_verify(boot_services: &BootServices, initrd_efi: &mut RegularFile) -> } impl InitrdLoader { + /// Create a new [`InitrdLoader`]. + /// + /// `handle` is the handle where the protocols are registered + /// on. `file` is the file that is served to Linux. pub fn new( boot_services: &BootServices, handle: Handle, @@ -199,8 +203,11 @@ impl InitrdLoader { range, }); + // Linux finds the right handle by looking for something that + // implements the device path protocol for the specific device + // path. unsafe { - let dp_proto: *mut u8 = &mut DEVICE_PATH_PROTOCOL[0]; + let dp_proto: *mut u8 = DEVICE_PATH_PROTOCOL.as_mut_ptr(); boot_services.install_protocol_interface( Some(handle), diff --git a/rust/lanzaboote/src/main.rs b/rust/lanzaboote/src/main.rs index b3bac6a..ae20e9a 100644 --- a/rust/lanzaboote/src/main.rs +++ b/rust/lanzaboote/src/main.rs @@ -13,7 +13,7 @@ use pe_section::pe_section_as_string; use uefi::{ prelude::*, proto::{ - console::text::{self, Output}, + console::text::Output, loaded_image::LoadedImage, media::file::{File, FileAttribute, FileMode, RegularFile}, },