Skip to content

Commit 5f1613f

Browse files
committed
Update uefi crate to 0.36.1
Update from the custom Framework fork of uefi 0.20/uefi-services 0.17 to upstream uefi 0.36.1 from crates.io. Key changes: - Replace uefi-services with uefi's built-in global_allocator, panic_handler, and logger features - Add uefi-raw 0.13 for direct access to shell protocol FFI - Rewrite fw_uefi module to use the new boot:: global API instead of accessing BootServices through the system table - Rewrite shell file I/O to use raw ShellProtocol FFI - Simplify UEFI entry point (no more explicit Handle/SystemTable params) - Remove custom git patches from Cargo.toml Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 063fd1c commit 5f1613f

File tree

12 files changed

+228
-339
lines changed

12 files changed

+228
-339
lines changed

Cargo.lock

Lines changed: 48 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,5 @@ default-members = [
1919
"framework_tool",
2020
]
2121

22-
[patch.crates-io]
23-
uefi = { git = "https://github.com/FrameworkComputer/uefi-rs", branch = "merged" }
24-
uefi-services = { git = "https://github.com/FrameworkComputer/uefi-rs", branch = "merged" }
25-
2622
[profile.release]
2723
lto = true

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
gitDependencyHashes = {
8888
"redox_hwio-0.1.6" = "sha256-knLIZ7yp42SQYk32NGq3SUGvJFVumFhD64Njr5TRdFs=";
8989
"smbios-lib-0.9.1" = "sha256-3L8JaA75j9Aaqg1z9lVs61m6CvXDeQprEFRq+UDCHQo=";
90-
"uefi-0.20.0" = "sha256-2lUd2a+7NvS94LyAHE2BwGV4j6607mbPXE5htrwdz04=";
9190
};
9291

9392
# Build function for the CLI tool (Linux/macOS)

framework_lib/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ rusb = { version = "0.9.4", optional = true }
3737
guid-create = { version = "0.5.0", default-features = false }
3838

3939
[target.'cfg(target_os = "uefi")'.dependencies]
40-
uefi = { version = "0.20", features = ["alloc"] }
41-
uefi-services = "0.17"
40+
uefi = { version = "0.36.1", features = ["alloc", "global_allocator", "panic_handler", "logger"] }
41+
uefi-raw = "0.13"
4242
plain = "0.2.3"
4343
redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd", default-features = false }
4444
smbios-lib = { git = "https://github.com/FrameworkComputer/smbios-lib.git", branch = "no-std", default-features = false }

framework_lib/src/commandline/uefi.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ use alloc::vec::Vec;
44

55
#[allow(unused_imports)]
66
use log::{debug, error, info, trace};
7-
use uefi::prelude::BootServices;
8-
use uefi::proto::shell_params::*;
9-
use uefi::Handle;
7+
use uefi::boot;
8+
use uefi::proto::shell_params::ShellParameters;
109

1110
use crate::chromium_ec::commands::SetGpuSerialMagic;
1211
use crate::chromium_ec::{CrosEcDriverType, HardwareDeviceType};
@@ -15,13 +14,19 @@ use crate::commandline::{Cli, LogLevel};
1514
use super::{ConsoleArg, FpBrightnessArg, InputDeckModeArg, RebootEcArg, TabletModeArg};
1615

1716
/// Get commandline arguments from UEFI environment
18-
pub fn get_args(bs: &BootServices, image_handle: Handle) -> Vec<String> {
19-
if let Ok(shell_params) = bs.open_protocol_exclusive::<ShellParameters>(image_handle) {
20-
shell_params.get_args()
21-
} else {
22-
// No protocol found if the application wasn't executed by the shell
23-
vec![]
24-
}
17+
pub fn get_args() -> Vec<String> {
18+
let shell_params = uefi::boot::open_protocol_exclusive::<ShellParameters>(boot::image_handle());
19+
let shell_params = match shell_params {
20+
Ok(s) => s,
21+
Err(_e) => {
22+
error!("Failed to get ShellParameters protocol");
23+
// TODO: Return result
24+
// return e.status();
25+
return vec![];
26+
}
27+
};
28+
let args: Vec<String> = shell_params.args().map(|x| x.to_string()).collect();
29+
args
2530
}
2631

2732
pub fn parse(args: &[String]) -> Cli {

0 commit comments

Comments
 (0)