diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61c0f70a..0f5604d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,13 +77,17 @@ jobs: run: rustup show - name: Build UEFI application (no ESP) - run: make -C framework_uefi build/x86_64-unknown-uefi/boot.efi + run: | + make -C framework_uefi build/x86_64-unknown-uefi/boot.efi + mv framework_uefi/build/x86_64-unknown-uefi/boot.efi framework_tool_full.efi + make -C framework_uefi FEATURES=readonly build/x86_64-unknown-uefi/boot.efi + cp framework_uefi/build/x86_64-unknown-uefi/boot.efi framework_tool.efi - name: Upload UEFI App uses: actions/upload-artifact@v4 with: - name: framework.efi - path: framework_uefi/build/x86_64-unknown-uefi/boot.efi + name: framework_efi.zip + path: ./*.efi - name: Install mtools to build ESP and ISO (Linux) run: sudo apt-get install -y mtools genisoimage diff --git a/Cargo.lock b/Cargo.lock index f6c79ef6..8bac5086 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -408,7 +408,7 @@ dependencies = [ [[package]] name = "framework_lib" -version = "0.4.3" +version = "0.4.4" dependencies = [ "built", "clap", @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "framework_tool" -version = "0.4.3" +version = "0.4.4" dependencies = [ "embed-resource", "framework_lib", @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "framework_uefi" -version = "0.4.3" +version = "0.4.4" dependencies = [ "framework_lib", "log", diff --git a/EXAMPLES.md b/EXAMPLES.md index 61b4aac8..2361b196 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -234,6 +234,7 @@ Input Deck Chassis Closed: true Input Deck State: On Touchpad present: true +SLEEP# GPIO high: true Positions: Pos 0: GenericC Pos 1: KeyboardA diff --git a/EXAMPLES_ADVANCED.md b/EXAMPLES_ADVANCED.md index f8fb2172..0ece899d 100644 --- a/EXAMPLES_ADVANCED.md +++ b/EXAMPLES_ADVANCED.md @@ -100,3 +100,68 @@ Wrote 153 bytes to foo.bin # Update everything from a file > framework_tool --flash-gpu-descriptor-file pcie_4x2.bin ``` + +## Analyzing binaries + +### EC + +Note that only since Framework 13 Intel Core Ultra (and later) the version number embedded in the ED binary is meaningful. As you can see below, in this example on Intel Core 12th/13th Gen (hx30) it's always 0.0.1. +The commit hash though is accurate and reflects the git commit it was built from. + +``` +> framework-tool --ec--bin ec.bin +File + Size: 524288 B + Size: 512 KB +EC + Version: hx30_v0.0.1-7a61a89 + RollbackVer: 0 + Platform: hx30 + Version: 0.0.1 + Commit: 7a61a89 + Size: 2868 B + Size: 2 KB +``` + +### PD + +``` +> framework_tool --pd-bin pd-0.1.14.bin +File + Size: 65536 B + Size: 64 KB +FW 1 + Silicon ID: 0x3000 + Version: 0.1.14 + Row size: 128 B + Start Row: 22 + Rows: 95 + Size: 12160 B + Size: 11 KB +FW 2 + Silicon ID: 0x3000 + Version: 0.1.14 + Row size: 128 B + Start Row: 118 + Rows: 381 + Size: 48768 B + Size: 47 KB +``` + +### UEFI Capsule + +``` +> framework_tool --capsule retimer23.cap +File + Size: 2232676 B + Size: 2180 KB +Capsule Header + Capsule GUID: (ba2e4e6e, 3b0c, 4f25, [8a,59,4c,55,3f,c8,6e,a2]) + Header size: 28 B + Flags: 0x50000 + Persist across reset (0x10000) + Initiate reset (0x40000) + Capsule Size: 2232676 B + Capsule Size: 2180 KB + Type: Framework Retimer23 (Right) +``` diff --git a/README.md b/README.md index fc913e21..c40160a5 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,32 @@ see the [Support Matrices](support-matrices.md). ###### Operating System Support -- [x] OS Tool (`framework_tool`) - - [x] Tested on Linux - - [x] Tested on Windows - - [x] Tested on FreeBSD -- [x] UEFI Shell tool (`framework_uefi`) +The following operating environments are supported. + +- Linux +- Windows +- UEFI +- FreeBSD + +Most functionality depends communication with the EC. +For Linux and Windows there are dedicated drivers. +On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a fallback, if the driver is not available or not working. + +| | Port I/O | Linux | Windows | +|---------------------|----------| ------|---------| +| Framework 12 | | | | +| Intel Core 12th Gen | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | +| Framework 13 | | | | +| Intel Core 11th Gen | Yes | [6.11](https://github.com/torvalds/linux/commit/04ca0a51f1e63bd553fd4af8e9af0fe094fa4f0a) | Not yet | +| Intel Core 12th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | +| Intel Core 13th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | +| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | Soon | +| Intel Core Ultra 1S | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Soon | +| AMD Ryzen AI 300 | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | +| Framework 16 | | | | +| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | Soon | +| Framework Desktop | | | | +| AMD Ryzen AI Max | Yes | [6.15](https://github.com/torvalds/linux/commit/d83c45aeec9b223fe6db4175e9d1c4f5699cc37a) | Yes | ###### Firmware Information @@ -205,61 +226,6 @@ Many actions require root. First build with cargo and then run the binary with s cargo build && sudo ./target/debug/framework_tool ``` -Dumping version information from firmware binaries: - -``` -# Dumping PD FW Binary Information: -> cargo run -q -- --pd-bin pd-0.1.14.bin -File - Size: 65536 B - Size: 64 KB -FW 1 - Silicon ID: 0x3000 - Version: 0.1.14 - Row size: 128 B - Start Row: 22 - Rows: 95 - Size: 12160 B - Size: 11 KB -FW 2 - Silicon ID: 0x3000 - Version: 0.1.14 - Row size: 128 B - Start Row: 118 - Rows: 381 - Size: 48768 B - Size: 47 KB - -# Dumping EC FW Binary Information -> cargo run -q -- --ec--bin ec.bin -File - Size: 524288 B - Size: 512 KB -EC - Version: hx30_v0.0.1-7a61a89 - RollbackVer: 0 - Platform: hx30 - Version: 0.0.1 - Commit: 7a61a89 - Size: 2868 B - Size: 2 KB - -# Dumping Capsule Binary Information: -> cargo run -q -- --capsule retimer23.cap -File - Size: 2232676 B - Size: 2180 KB -Capsule Header - Capsule GUID: (ba2e4e6e, 3b0c, 4f25, [8a,59,4c,55,3f,c8,6e,a2]) - Header size: 28 B - Flags: 0x50000 - Persist across reset (0x10000) - Initiate reset (0x40000) - Capsule Size: 2232676 B - Capsule Size: 2180 KB - Type: Framework Retimer23 (Right) -``` - ###### Running on Windows On newly released systems since 2025 the Framework driver installer includes the EC driver. diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index b3af9f25..001dbcc8 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_lib" -version = "0.4.3" +version = "0.4.4" description = "Library to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" @@ -14,6 +14,7 @@ build = "build.rs" [features] default = ["hidapi", "rusb"] +readonly = [ ] rusb = ["dep:rusb"] hidapi = ["dep:hidapi"] uefi = [ "lazy_static/spin_no_std" ] diff --git a/framework_lib/src/ccgx/mod.rs b/framework_lib/src/ccgx/mod.rs index f7269b90..4495cc7d 100644 --- a/framework_lib/src/ccgx/mod.rs +++ b/framework_lib/src/ccgx/mod.rs @@ -110,7 +110,7 @@ pub enum SiliconId { Ccg8 = 0x3580, } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub struct BaseVersion { /// Major part of the version. X of X.Y.Z.BB pub major: u8, @@ -154,7 +154,7 @@ impl From for BaseVersion { } } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub enum Application { Notebook, Monitor, @@ -162,7 +162,7 @@ pub enum Application { Invalid, } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub struct AppVersion { pub application: Application, /// Major part of the version. X of X.Y.Z @@ -309,3 +309,42 @@ fn parse_metadata_cyacd2(buffer: &[u8]) -> Option<(u32, u32)> { None } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + // Make sure deriving does what I expect, properly comparing with multiple fields + fn derive_ord() { + let v0_0_0 = AppVersion { + application: Application::Notebook, + major: 0, + minor: 0, + circuit: 0, + }; + let v1_0_1 = AppVersion { + application: Application::Notebook, + major: 1, + minor: 0, + circuit: 1, + }; + let v0_1_0 = AppVersion { + application: Application::Notebook, + major: 0, + minor: 1, + circuit: 0, + }; + let v1_1_1 = AppVersion { + application: Application::Notebook, + major: 1, + minor: 1, + circuit: 1, + }; + assert_eq!(v0_0_0, v0_0_0.clone()); + assert!(v0_0_0 < v1_0_1); + assert!(v0_1_0 < v1_0_1); + assert!(v1_0_1 < v1_1_1); + assert!(v1_1_1 > v1_0_1); + } +} diff --git a/framework_lib/src/chromium_ec/command.rs b/framework_lib/src/chromium_ec/command.rs index e009a9ec..608f29bc 100644 --- a/framework_lib/src/chromium_ec/command.rs +++ b/framework_lib/src/chromium_ec/command.rs @@ -53,6 +53,9 @@ pub enum EcCommands { /// Get information about PD controller power UsbPdPowerInfo = 0x0103, AdcRead = 0x0123, + ApReset = 0x0125, + LocateChip = 0x0126, + RebootApOnG3 = 0x0127, RgbKbdSetColor = 0x013A, RgbKbd = 0x013B, diff --git a/framework_lib/src/chromium_ec/commands.rs b/framework_lib/src/chromium_ec/commands.rs index 0a367ab3..48763c06 100644 --- a/framework_lib/src/chromium_ec/commands.rs +++ b/framework_lib/src/chromium_ec/commands.rs @@ -879,6 +879,42 @@ impl EcRequest for EcRequestAdcRead { } } +#[repr(C)] +pub struct EcRequestApReset {} + +impl EcRequest<()> for EcRequestApReset { + fn command_id() -> EcCommands { + EcCommands::ApReset + } +} + +#[repr(C)] +pub struct EcRequestRebootApOnG3V0 {} + +impl EcRequest<()> for EcRequestRebootApOnG3V0 { + fn command_id() -> EcCommands { + EcCommands::RebootApOnG3 + } + fn command_version() -> u8 { + 0 + } +} + +#[repr(C)] +pub struct EcRequestRebootApOnG3V1 { + /// Delay in seconds after entering G3 state + pub delay: u32, +} + +impl EcRequest<()> for EcRequestRebootApOnG3V1 { + fn command_id() -> EcCommands { + EcCommands::RebootApOnG3 + } + fn command_version() -> u8 { + 1 + } +} + // TODO: Actually 128, but if we go above ~80 EC returns REQUEST_TRUNCATED // At least when I use the portio driver pub const EC_RGBKBD_MAX_KEY_COUNT: usize = 64; diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index 0adba41b..ed1210e6 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -603,9 +603,11 @@ impl CrosEc { pub fn print_fw16_inputdeck_status(&self) -> EcResult<()> { let intrusion = self.get_intrusion_status()?; let status = self.get_input_deck_status()?; + let sleep_l = self.get_gpio("sleep_l")?; println!("Chassis Closed: {}", !intrusion.currently_open); println!("Input Deck State: {:?}", status.state); println!("Touchpad present: {}", status.touchpad_present); + println!("SLEEP# GPIO high: {}", sleep_l); println!("Positions:"); println!(" Pos 0: {:?}", status.top_row.pos0); println!(" Pos 1: {:?}", status.top_row.pos1); diff --git a/framework_lib/src/commandline/clap_std.rs b/framework_lib/src/commandline/clap_std.rs index 6d7f50ea..a26aa4ba 100644 --- a/framework_lib/src/commandline/clap_std.rs +++ b/framework_lib/src/commandline/clap_std.rs @@ -9,7 +9,7 @@ use clap_num::maybe_hex; use crate::chromium_ec::commands::SetGpuSerialMagic; use crate::chromium_ec::CrosEcDriverType; use crate::commandline::{ - Cli, ConsoleArg, FpBrightnessArg, HardwareDeviceType, InputDeckModeArg, RebootEcArg, + Cli, ConsoleArg, FpBrightnessArg, HardwareDeviceType, InputDeckModeArg, LogLevel, RebootEcArg, TabletModeArg, }; @@ -167,14 +167,14 @@ struct ClapCli { #[arg(long)] charge_limit: Option>, - /// Get or set max charge current limit + /// Set max charge current limit #[arg(long)] - #[clap(num_args = ..=2)] + #[clap(num_args = 1..=2)] charge_current_limit: Vec, - /// Get or set max charge current limit + /// Set max charge current limit #[arg(long)] - #[clap(num_args = ..=2)] + #[clap(num_args = 1..=2)] charge_rate_limit: Vec, /// Get GPIO value by name or all, if no name provided @@ -381,7 +381,7 @@ pub fn parse(args: &[String]) -> Cli { }; Cli { - verbosity: args.verbosity.log_level_filter(), + verbosity: LogLevel(args.verbosity.log_level_filter()), versions: args.versions, version: args.version, features: args.features, diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 602ca09e..94475583 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -134,13 +134,22 @@ impl From for DeckStateMode { } } +#[derive(Debug)] +pub struct LogLevel(log::LevelFilter); + +impl Default for LogLevel { + fn default() -> Self { + LogLevel(log::LevelFilter::Error) + } +} + /// Shadows `clap_std::ClapCli` with extras for UEFI /// /// The UEFI commandline currently doesn't use clap, so we need to shadow the struct. /// Also it has extra options. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Cli { - pub verbosity: log::LevelFilter, + pub verbosity: LogLevel, pub versions: bool, pub version: bool, pub features: bool, @@ -212,9 +221,73 @@ pub struct Cli { pub fn parse(args: &[String]) -> Cli { #[cfg(feature = "uefi")] - return uefi::parse(args); + let cli = uefi::parse(args); #[cfg(not(feature = "uefi"))] - return clap_std::parse(args); + let cli = clap_std::parse(args); + + if cfg!(feature = "readonly") { + // Initialize a new Cli with no arguments + // Set all arguments that are readonly/safe + // We explicitly only cope the safe ones so that if we add new arguments in the future, + // which might be unsafe, we can't forget to exclude them from the safe set. + // TODO: Instead of silently ignoring blocked command, we should remind the user + Cli { + verbosity: cli.verbosity, + versions: cli.versions, + version: cli.version, + esrt: cli.esrt, + device: cli.device, + power: cli.power, + thermal: cli.thermal, + sensors: cli.sensors, + // fansetduty + // fansetrpm + // autofanctrl + privacy: cli.privacy, + pd_info: cli.version, + dp_hdmi_info: cli.dp_hdmi_info, + // dp_hdmi_update + audio_card_info: cli.audio_card_info, + pd_bin: cli.pd_bin, + ec_bin: cli.ec_bin, + capsule: cli.capsule, + dump: cli.dump, + h2o_capsule: cli.h2o_capsule, + // dump_ec_flash + // flash_ec + // flash_ro_ec + driver: cli.driver, + test: cli.test, + intrusion: cli.intrusion, + inputdeck: cli.inputdeck, + inputdeck_mode: cli.inputdeck_mode, + expansion_bay: cli.expansion_bay, + // charge_limit + // charge_current_limit + get_gpio: cli.get_gpio, + fp_led_level: cli.fp_led_level, + fp_brightness: cli.fp_brightness, + kblight: cli.kblight, + rgbkbd: cli.rgbkbd, + // tablet_mode + // touchscreen_enable + stylus_battery: cli.stylus_battery, + console: cli.console, + reboot_ec: cli.reboot_ec, + // ec_hib_delay + hash: cli.hash, + pd_addrs: cli.pd_addrs, + pd_ports: cli.pd_ports, + help: cli.help, + info: cli.info, + // allupdate + paginate: cli.paginate, + // raw_command + ..Default::default() + } + } else { + cli + } } fn print_single_pd_details(pd: &PdController) { @@ -815,7 +888,7 @@ fn compare_version(device: Option, version: String, ec: &Cro pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 { #[cfg(feature = "uefi")] { - log::set_max_level(args.verbosity); + log::set_max_level(args.verbosity.0); } #[cfg(not(feature = "uefi"))] { @@ -824,7 +897,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 { // .filter("FRAMEWORK_COMPUTER_LOG") // .write_style("FRAMEWORK_COMPUTER_LOG_STYLE"); - let level = args.verbosity.as_str(); + let level = args.verbosity.0.as_str(); env_logger::Builder::from_env(env_logger::Env::default().default_filter_or(level)) .format_target(false) .format_timestamp(None) diff --git a/framework_lib/src/commandline/uefi.rs b/framework_lib/src/commandline/uefi.rs index 82d6c253..2a18cabd 100644 --- a/framework_lib/src/commandline/uefi.rs +++ b/framework_lib/src/commandline/uefi.rs @@ -6,55 +6,27 @@ use alloc::vec::Vec; use log::{debug, error, info, trace}; use uefi::prelude::BootServices; use uefi::proto::shell_params::*; -use uefi::table::boot::{OpenProtocolAttributes, OpenProtocolParams, SearchType}; -use uefi::Identify; +use uefi::Handle; use crate::chromium_ec::commands::SetGpuSerialMagic; use crate::chromium_ec::{CrosEcDriverType, HardwareDeviceType}; -use crate::commandline::Cli; +use crate::commandline::{Cli, LogLevel}; use super::{ConsoleArg, FpBrightnessArg, InputDeckModeArg, RebootEcArg, TabletModeArg}; /// Get commandline arguments from UEFI environment -pub fn get_args(boot_services: &BootServices) -> Vec { - // TODO: I think i should open this from the ImageHandle? - let shell_params_h = - boot_services.locate_handle_buffer(SearchType::ByProtocol(&ShellParameters::GUID)); - let shell_params_h = if let Ok(shell_params_h) = shell_params_h { - shell_params_h +pub fn get_args(bs: &BootServices, image_handle: Handle) -> Vec { + if let Ok(shell_params) = bs.open_protocol_exclusive::(image_handle) { + shell_params.get_args() } else { - error!("ShellParameters protocol not found"); - return vec![]; - }; - - for handle in &*shell_params_h { - let params_handle = unsafe { - boot_services - .open_protocol::( - OpenProtocolParams { - handle: *handle, - agent: boot_services.image_handle(), - controller: None, - }, - OpenProtocolAttributes::GetProtocol, - ) - .expect("Failed to open ShellParameters handle") - }; - - // Ehm why are there two and one has no args? - // Maybe one is the shell itself? - if params_handle.argc == 0 { - continue; - } - - return params_handle.get_args(); + // No protocol found if the application wasn't executed by the shell + vec![] } - vec![] } pub fn parse(args: &[String]) -> Cli { let mut cli = Cli { - verbosity: log::LevelFilter::Error, + verbosity: LogLevel(log::LevelFilter::Error), paginate: false, versions: false, version: false, @@ -131,15 +103,15 @@ pub fn parse(args: &[String]) -> Cli { for (i, arg) in args.iter().enumerate() { if arg == "-q" { - cli.verbosity = log::LevelFilter::Off; + cli.verbosity = LogLevel(log::LevelFilter::Off); } else if arg == "-v" { - cli.verbosity = log::LevelFilter::Warn; + cli.verbosity = LogLevel(log::LevelFilter::Warn); } else if arg == "-vv" { - cli.verbosity = log::LevelFilter::Info; + cli.verbosity = LogLevel(log::LevelFilter::Info); } else if arg == "-vvv" { - cli.verbosity = log::LevelFilter::Debug; + cli.verbosity = LogLevel(log::LevelFilter::Debug); } else if arg == "-vvvv" { - cli.verbosity = log::LevelFilter::Trace; + cli.verbosity = LogLevel(log::LevelFilter::Trace); } else if arg == "--versions" { cli.versions = true; found_an_option = true; diff --git a/framework_lib/src/lib.rs b/framework_lib/src/lib.rs index 93d91e2b..05adf8fb 100644 --- a/framework_lib/src/lib.rs +++ b/framework_lib/src/lib.rs @@ -1,6 +1,7 @@ //! A library to interact with [Framework Computer](https://frame.work) hardware and building tools to do so. #![cfg_attr(feature = "uefi", no_std)] +#![allow(clippy::uninlined_format_args)] extern crate alloc; #[cfg(feature = "uefi")] diff --git a/framework_tool/Cargo.toml b/framework_tool/Cargo.toml index cdd90a2a..fa240e3d 100644 --- a/framework_tool/Cargo.toml +++ b/framework_tool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_tool" -version = "0.4.3" +version = "0.4.4" description = "Tool to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" @@ -12,6 +12,10 @@ edition = "2021" name = "framework_tool" path = "src/main.rs" +[features] +default = [ ] +readonly = [ "framework_lib/readonly" ] + [dependencies.framework_lib] path = "../framework_lib" diff --git a/framework_uefi/Cargo.toml b/framework_uefi/Cargo.toml index adc8b14b..6c73a81e 100644 --- a/framework_uefi/Cargo.toml +++ b/framework_uefi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_uefi" -version = "0.4.3" +version = "0.4.4" description = "UEFI Tool to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" @@ -14,6 +14,10 @@ rust-version = "1.74" name = "uefitool" path = "src/main.rs" +[features] +default = [ ] +readonly = [ "framework_lib/readonly" ] + [dependencies] uefi = { version = "0.20", features = ["alloc"] } uefi-services = "0.17" diff --git a/framework_uefi/Makefile b/framework_uefi/Makefile index a571ba17..0814ff42 100644 --- a/framework_uefi/Makefile +++ b/framework_uefi/Makefile @@ -1,5 +1,6 @@ TARGET?=x86_64-unknown-uefi BUILD=build/$(TARGET) +FEATURES?='' SRC_DIR=. @@ -18,7 +19,7 @@ all: $(BUILD)/boot.img iso: $(BUILD)/UEFI-Shell-fwk.iso clean: - rm -r $(BUILD) + rm -rf $(BUILD) qemu: $(BUILD)/boot.img $(QEMU) $(QEMU_FLAGS) $< @@ -38,6 +39,9 @@ $(BUILD)/efi.img: $(BUILD)/boot.efi mkfs.vfat $@.tmp mmd -i $@.tmp efi mmd -i $@.tmp efi/boot + echo 'efi\boot\bootx64.efi --version' > startup.nsh + mcopy -i $@.tmp startup.nsh ::efi/boot/startup.nsh + rm -f startup.nsh mcopy -i $@.tmp $< ::efi/boot/bootx64.efi mv $@.tmp $@ @@ -58,6 +62,7 @@ $(BUILD)/boot.efi: ../Cargo.lock $(SRC_DIR)/Cargo.toml $(SRC_DIR)/src/* mkdir -p $(BUILD) cargo rustc \ --target $(TARGET) \ + --features $(FEATURES) \ --release \ -- \ --emit link=framework_uefi/$@ diff --git a/framework_uefi/src/main.rs b/framework_uefi/src/main.rs index b81cbe63..caeeee2e 100644 --- a/framework_uefi/src/main.rs +++ b/framework_uefi/src/main.rs @@ -12,11 +12,11 @@ extern crate alloc; use framework_lib::commandline; #[entry] -fn main(_handle: Handle, mut system_table: SystemTable) -> Status { +fn main(image_handle: Handle, mut system_table: SystemTable) -> Status { uefi_services::init(&mut system_table).unwrap(); let bs = system_table.boot_services(); - let args = commandline::uefi::get_args(bs); + let args = commandline::uefi::get_args(bs, image_handle); let args = commandline::parse(&args); if commandline::run_with_args(&args, false) == 0 { return Status::SUCCESS; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy