Skip to content

Commit 2768947

Browse files
committed
doc: add rust-std chapter to book
1 parent e54b8a2 commit 2768947

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

book/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [Using Protocols](how_to/protocols.md)
1111
- [Drawing to the Screen](how_to/drawing.md)
1212
- [Building drivers](how_to/building_drivers.md)
13+
- [Combining Rust `std` with `uefi`](how_to/rust-std.md)
1314
- [Concepts](concepts/introduction.md)
1415
- [Boot Stages](concepts/boot_stages.md)
1516
- [Tables](concepts/tables.md)

book/src/how_to/rust-std.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Combining Rust `std` with `uefi`
2+
3+
## TL;DR
4+
5+
In Mid-2024, we recommend to stick to our normal guide. Use this document as
6+
guide and outlook for the future of UEFI and Rust.
7+
8+
## About
9+
10+
In the `uefi` crate, we provide tooling to create a `no_std` + `no_main`
11+
binary, i.e., an UEFI image, in a convenient way by providing a `#[entry]`
12+
macro for the crate's main function. However, after ongoing efforts in upstream
13+
Rust, there is also the option to create a "standard" binary for UEFI. The
14+
result is the same, but the build process and the overall programming experience
15+
is much more similar to regular Rust applications written for Operating Systems,
16+
such as Linux, Windows, or macOS.
17+
18+
The `uefi` crate is suited to extend the functionality of these "standard
19+
binaries". Note that UEFI in `std` is work-in-progress, and some functionality
20+
only works with nightly toolchains.
21+
22+
## Code Example
23+
24+
Please refer to [`<repo>/uefi-std-example`](/uefi-std-example/README.md) to
25+
see a specific example. The relevant `main.rs` looks as follows:
26+
27+
```rust
28+
{{#include ../../../uefi-std-example/src/main.rs}}
29+
```

0 commit comments

Comments
 (0)