mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 10:10:17 +00:00
swap to uefi logger
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -129,6 +129,7 @@ dependencies = [
|
||||
name = "sprout"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"toml",
|
||||
"uefi",
|
||||
|
||||
17
Cargo.toml
17
Cargo.toml
@@ -5,6 +5,7 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
toml = "0.9.7"
|
||||
log = "0.4.28"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0.228"
|
||||
@@ -12,4 +13,18 @@ features = ["derive"]
|
||||
|
||||
[dependencies.uefi]
|
||||
version = "0.35.0"
|
||||
features = ["alloc"]
|
||||
features = ["alloc", "logger"]
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
strip = "symbols"
|
||||
|
||||
[profile.release-debuginfo]
|
||||
inherits = "release"
|
||||
strip = "none"
|
||||
debug = 1
|
||||
|
||||
[profile.dev-fast]
|
||||
inherits = "dev"
|
||||
strip = "debuginfo"
|
||||
debug = 0
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::config::ChainloaderConfiguration;
|
||||
use log::info;
|
||||
use uefi::proto::loaded_image::LoadedImage;
|
||||
use uefi::{
|
||||
CString16,
|
||||
proto::device_path::{
|
||||
@@ -24,7 +26,7 @@ pub fn chainloader(configuration: ChainloaderConfiguration) {
|
||||
let sprout_image = uefi::boot::image_handle();
|
||||
let image_device_path_protocol =
|
||||
uefi::boot::open_protocol_exclusive::<LoadedImageDevicePath>(sprout_image)
|
||||
.expect("unable to open loaded image protocol");
|
||||
.expect("unable to open loaded image device path protocol");
|
||||
|
||||
let image_device_path: &DevicePath = &image_device_path_protocol;
|
||||
let mut full_path = image_device_path
|
||||
@@ -45,7 +47,7 @@ pub fn chainloader(configuration: ChainloaderConfiguration) {
|
||||
full_path.push('/');
|
||||
full_path.push_str(&configuration.path);
|
||||
|
||||
println!("chainloader: path={}", full_path);
|
||||
info!("path={}", full_path);
|
||||
|
||||
let device_path = text_to_device_path(&full_path);
|
||||
|
||||
@@ -57,5 +59,11 @@ pub fn chainloader(configuration: ChainloaderConfiguration) {
|
||||
},
|
||||
)
|
||||
.expect("failed to load image");
|
||||
|
||||
let image_device_path_protocol = uefi::boot::open_protocol_exclusive::<LoadedImage>(image)
|
||||
.expect("unable to open loaded image protocol");
|
||||
|
||||
let (base, size) = image_device_path_protocol.info();
|
||||
info!("loaded image base={:#x} size={:#x}", base.addr(), size);
|
||||
uefi::boot::start_image(image).expect("failed to start image");
|
||||
}
|
||||
|
||||
@@ -13,4 +13,6 @@ pub fn init() {
|
||||
.expect("unable to resolve image handle");
|
||||
uefi::boot::set_image_handle(handle);
|
||||
}
|
||||
|
||||
uefi::helpers::init().expect("failed to initialize uefi");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user