Boot a Linux kernel

This commit is contained in:
Julian Stecklina 2022-11-22 01:39:05 +01:00
parent 3990557849
commit 381f73e0a6
1 changed files with 14 additions and 5 deletions

View File

@ -110,17 +110,26 @@ fn main(handle: Handle, mut system_table: SystemTable<Boot>) -> Status {
debug!("Found root"); debug!("Found root");
let mut file = root let mut file = root
.open(cstr16!("foo.txt"), FileMode::Read, FileAttribute::empty()) .open(cstr16!("linux.efi"), FileMode::Read, FileAttribute::empty())
.unwrap() .unwrap()
.into_regular_file() .into_regular_file()
.unwrap(); .unwrap();
debug!("Opened file"); debug!("Opened file");
debug!( let kernel = read_all(&mut file).unwrap();
"Data: {}",
alloc::str::from_utf8(&read_all(&mut file).unwrap()).unwrap() let kernel_image = boot_services
); .load_image(
handle,
uefi::table::boot::LoadImageSource::FromBuffer {
buffer: &kernel,
file_path: None,
},
)
.unwrap();
boot_services.start_image(kernel_image).unwrap();
Status::SUCCESS Status::SUCCESS
} }