Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 403c99e

Browse files
NathanRoyernicholasbishop
authored andcommitted
Allow uefi-services to work when the "logger" feature is disabled in uefi
1 parent c430f08 commit 403c99e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

‎uefi-services/Cargo.toml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ is-it-maintained-issue-resolution = { repository = "rust-osdev/uefi-rs" }
1515
is-it-maintained-open-issues = { repository = "rust-osdev/uefi-rs" }
1616

1717
[dependencies]
18-
uefi = { version = "0.17.0", features = ["alloc", "logger"] }
18+
uefi = { version = "0.17.0", features = ["alloc"] }
1919
log = { version = "0.4.5", default-features = false }
2020
cfg-if = "1.0.0"
2121
qemu-exit = { version = "3.0.1", optional = true }
2222

2323
[features]
24-
default = ["panic_handler"]
24+
default = ["panic_handler", "logger"]
2525
# Enable QEMU-specific functionality
2626
qemu = ["qemu-exit"]
2727
panic_handler = []
28+
logger = ["uefi/logger"]

‎uefi-services/src/lib.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use uefi::{Event, Result};
4343
static mut SYSTEM_TABLE: Option<SystemTable<Boot>> = None;
4444

4545
/// Global logger object
46+
#[cfg(feature = "logger")]
4647
static mut LOGGER: Option<uefi::logger::Logger> = None;
4748

4849
/// Obtains a pointer to the system table.
@@ -77,7 +78,10 @@ pub fn init(st: &mut SystemTable<Boot>) -> Result {
7778
SYSTEM_TABLE = Some(st.unsafe_clone());
7879

7980
// Setup logging and memory allocation
81+
82+
#[cfg(feature = "logger")]
8083
init_logger(st);
84+
8185
let boot_services = st.boot_services();
8286
uefi::alloc::init(boot_services);
8387

@@ -144,6 +148,7 @@ macro_rules! println {
144148
///
145149
/// This is unsafe because you must arrange for the logger to be reset with
146150
/// disable() on exit from UEFI boot services.
151+
#[cfg(feature = "logger")]
147152
unsafe fn init_logger(st: &mut SystemTable<Boot>) {
148153
let stdout = st.stdout();
149154

@@ -170,6 +175,8 @@ unsafe extern "efiapi" fn exit_boot_services(_e: Event, _ctx: Option<NonNull<c_v
170175
//
171176
// info!("Shutting down the UEFI utility library");
172177
SYSTEM_TABLE = None;
178+
179+
#[cfg(feature = "logger")]
173180
if let Some(ref mut logger) = LOGGER {
174181
logger.disable();
175182
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /