Skip to content

Commit 368da9c

Browse files
committed
doc: help with feature selection
1 parent b171db7 commit 368da9c

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

uefi-test-runner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2024"
77

88
[dependencies]
99
uefi-raw = { path = "../uefi-raw" }
10-
uefi = { path = "../uefi", features = ["alloc", "global_allocator", "panic_handler", "logger", "qemu"] }
10+
uefi = { path = "../uefi", features = ["alloc", "global_allocator", "panic_handler", "logger", "qemu", "log-debugcon"] }
1111

1212
log.workspace = true
1313

uefi/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
- `system::with_config_table`, `system::with_stdin`, `system::with_stdout` and `system::with_stderr`
1010
now take mutably closure.
1111
- **Breaking:** The MSRV is now 1.85.1 and the crate uses the Rust 2024 edition.
12+
- The documentation in `lib.rs` now provides guidance on how to select features
13+
tailored to your use case.
14+
- Feature `log-debugcon` is now longer a default feature. You only need to add
15+
it in case you are also using the `logger` feature and if you run your UEFI
16+
image in QEMU or Cloud Hypervisor, when the debugcon/debug-console device is
17+
available.
1218

1319
# uefi - 0.35.0 (2025-05-04)
1420

uefi/Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ license.workspace = true
1515
repository.workspace = true
1616
rust-version.workspace = true
1717

18+
# Feature documentation in uefi/lib.rs.
1819
[features]
19-
# KEEP this feature list in sync with doc in lib.rs!
20-
default = [ "log-debugcon" ]
20+
# KEEP this feature list in sync with doc in uefi/lib.rs!
21+
default = [ ]
2122
alloc = []
2223

23-
# Generic gate to code that uses unstable features of Rust. You usually need a nightly toolchain.
24+
# Generic gate to code that uses unstable features of Rust, needing a nightly
25+
# toolchain.
2426
unstable = []
2527

2628
# Helper features:
@@ -31,9 +33,6 @@ panic_handler = []
3133
# - dependency log-debugcon: logical, not technical
3234
# - dependency panic_handler: logical, not technical
3335
qemu = ["dep:qemu-exit", "panic_handler", "log-debugcon"]
34-
# Whether the internal logger from the helpers module should also log to
35-
# the debugcon device (QEMU) and debug-console (cloud-hypervisor). Only works
36-
# on x86.
3736
log-debugcon = []
3837

3938
[dependencies]

uefi/src/lib.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
//!
121121
//! ## Optional Cargo crate features
122122
//!
123+
//! A list of recommended default features follows below.
124+
//!
125+
//! ### Feature List
126+
//!
123127
//! - `alloc`: Enable functionality requiring the [`alloc`] crate from
124128
//! the Rust standard library. For example, methods that return a
125129
//! `Vec` rather than filling a statically-sized array. This requires
@@ -130,10 +134,13 @@
130134
//! allocator. This is a simple allocator that relies on the UEFI pool
131135
//! allocator. You can choose to provide your own allocator instead of
132136
//! using this feature, or no allocator at all if you don't need to
133-
//! dynamically allocate any memory.
137+
//! dynamically allocate any memory. Note that even without that feature,
138+
//! some code might use the internal UEFI allocator.
134139
//! - `logger`: Logging implementation for the standard [`log`] crate
135140
//! that prints output to the UEFI console. No buffering is done; this
136141
//! is not a high-performance logger.
142+
//! - `log-debugcon`: Whether the logger set up by `logger` should also log
143+
//! to the debugcon device (available in QEMU or Cloud Hypervisor on x86).
137144
//! - `panic_handler`: Add a default panic handler that logs to `stdout`.
138145
//! - `unstable`: Enable functionality that depends on [unstable
139146
//! features] in the nightly compiler.
@@ -147,6 +154,16 @@
147154
//! only unfold their potential when you invoke `uefi::helpers::init` as soon
148155
//! as possible in your application.
149156
//!
157+
//! ### Recommended Default Features
158+
//!
159+
//! In typical use-cases, the following features are useful for you:
160+
//! - Building a UEFI image:
161+
//! - Recommended: `alloc`, `global_allocator`, `logger`, `panic_handler`
162+
//! - Optional: `log-debugcon`, `qemu`, `unstable`
163+
//! - Building another application/library:
164+
//! - Recommended: `alloc`
165+
//! - Optional: `unstable`
166+
//!
150167
//! # Discuss and Contribute
151168
//!
152169
//! For general discussions, feel free to join us in our [Zulip] and ask

0 commit comments

Comments
 (0)