You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
#![no_std]
|
|
#![no_main]
|
|
#![feature(alloc)]
|
|
|
|
extern crate uefi;
|
|
extern crate uefi_alloc;
|
|
extern crate uefi_exts;
|
|
extern crate uefi_logger;
|
|
extern crate uefi_services;
|
|
#[macro_use]
|
|
extern crate log;
|
|
extern crate alloc;
|
|
|
|
use uefi::prelude::*;
|
|
use uefi::proto::media::file::{FileAttribute, FileMode};
|
|
use uefi::proto::media::fs::SimpleFileSystem;
|
|
use uefi_exts::BootServicesExt;
|
|
|
|
#[no_mangle]
|
|
pub extern "win64" fn uefi_start(_image: uefi::Handle, table: SystemTable<Boot>) -> Status {
|
|
uefi_services::init(&table).expect_success("Failed to initialize utilities");
|
|
table
|
|
.stdout()
|
|
.reset(false)
|
|
.expect_success("Failed to reset stdout");
|
|
|
|
let fs = table
|
|
.boot_services()
|
|
.find_protocol::<SimpleFileSystem>()
|
|
.expect("Failed to resolve filesystem")
|
|
.get();
|
|
unsafe {
|
|
let mut file = (*fs).open_volume().expect("Failed to open root").unwrap();
|
|
let mut file = file
|
|
.open(
|
|
"\\EFI\\coonboot.efi",
|
|
FileMode::READ,
|
|
FileAttribute::empty(),
|
|
)
|
|
.unwrap()
|
|
.unwrap();
|
|
let mut buf: [u8; 3] = [0, 0, 0];
|
|
file.read(&mut buf).unwrap().unwrap();
|
|
info!("First three bytes of coonboot.efi: {:?}", buf);
|
|
}
|
|
|
|
Status::SUCCESS
|
|
}
|
|
|