Skip to content

doc: help with feature selection #1676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion uefi-test-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"

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

log.workspace = true

Expand Down
6 changes: 6 additions & 0 deletions uefi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
- `system::with_config_table`, `system::with_stdin`, `system::with_stdout` and `system::with_stderr`
now take mutably closure.
- **Breaking:** The MSRV is now 1.85.1 and the crate uses the Rust 2024 edition.
- The documentation in `lib.rs` now provides guidance on how to select features
tailored to your use case.
- Feature `log-debugcon` is no longer a default feature. You only need to add
it in case you are also using the `logger` feature and if you run your UEFI
image in QEMU or Cloud Hypervisor, when the debugcon/debug-console device is
available.

# uefi - 0.35.0 (2025-05-04)

Expand Down
11 changes: 5 additions & 6 deletions uefi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ license.workspace = true
repository.workspace = true
rust-version.workspace = true

# Feature documentation in uefi/lib.rs.
[features]
# KEEP this feature list in sync with doc in lib.rs!
default = [ "log-debugcon" ]
# KEEP this feature list in sync with doc in uefi/lib.rs!
default = [ ]
alloc = []

# Generic gate to code that uses unstable features of Rust. You usually need a nightly toolchain.
# Generic gate to code that uses unstable features of Rust, needing a nightly
# toolchain.
unstable = []

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

[dependencies]
Expand Down
19 changes: 18 additions & 1 deletion uefi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@
//!
//! ## Optional Cargo crate features
//!
//! A list of recommended default features follows below.
//!
//! ### Feature List
//!
//! - `alloc`: Enable functionality requiring the [`alloc`] crate from
//! the Rust standard library. For example, methods that return a
//! `Vec` rather than filling a statically-sized array. This requires
Expand All @@ -130,10 +134,13 @@
//! allocator. This is a simple allocator that relies on the UEFI pool
//! allocator. You can choose to provide your own allocator instead of
//! using this feature, or no allocator at all if you don't need to
//! dynamically allocate any memory.
//! dynamically allocate any memory. Note that even without that feature,
//! some code might use the internal UEFI allocator.
//! - `logger`: Logging implementation for the standard [`log`] crate
//! that prints output to the UEFI console. No buffering is done; this
//! is not a high-performance logger.
//! - `log-debugcon`: Whether the logger set up by `logger` should also log
//! to the debugcon device (available in QEMU or Cloud Hypervisor on x86).
//! - `panic_handler`: Add a default panic handler that logs to `stdout`.
//! - `unstable`: Enable functionality that depends on [unstable
//! features] in the nightly compiler.
Expand All @@ -147,6 +154,16 @@
//! only unfold their potential when you invoke `uefi::helpers::init` as soon
//! as possible in your application.
//!
//! ### Recommended Default Features
//!
//! In typical use-cases, the following features are useful for you:
//! - Building a UEFI image:
//! - Recommended: `alloc`, `global_allocator`, `logger`, `panic_handler`
//! - Optional: `log-debugcon`, `qemu`, `unstable`
//! - Building another application/library:
//! - Recommended: `alloc`
//! - Optional: `unstable`
//!
//! # Discuss and Contribute
//!
//! For general discussions, feel free to join us in our [Zulip] and ask
Expand Down