Skip to content

Commit 9f8946a

Browse files
authored
Merge pull request #1047 from nicholasbishop/bishop-build-opts
book: Add a page on building drivers
2 parents 92b4c21 + 3c2c5a9 commit 9f8946a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

book/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [How-to](how_to/introduction.md)
1010
- [Using Protocols](how_to/protocols.md)
1111
- [Drawing to the Screen](how_to/drawing.md)
12+
- [Building drivers](how_to/building_drivers.md)
1213
- [Concepts](concepts/introduction.md)
1314
- [Boot Stages](concepts/boot_stages.md)
1415
- [Tables](concepts/tables.md)

book/src/how_to/building_drivers.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Building drivers
2+
3+
There are [three types][spec-images] of UEFI images:
4+
* Application
5+
* Boot service driver
6+
* Runtime driver
7+
8+
[By default][target-flag], Rust's UEFI targets produce applications. This can be
9+
changed by passing a [`subsystem`] linker flag in `rustflags` and setting the
10+
value to `efi_boot_service_driver` or `efi_runtime_driver`.
11+
12+
Example:
13+
14+
```toml
15+
# In .cargo/config.toml:
16+
[build]
17+
rustflags = ["-C", "link-args=/subsystem:efi_runtime_driver"]
18+
```
19+
20+
[spec-images]: https://uefi.org/specs/UEFI/2.10/02_Overview.html#uefi-images
21+
[target-flag]: https://github.com/rust-lang/rust/blob/f4d794ea0b845413344621d89f6c945062748485/compiler/rustc_target/src/spec/base/uefi_msvc.rs#L33
22+
[`subsystem`]: https://learn.microsoft.com/en-us/cpp/build/reference/subsystem?view=msvc-170

0 commit comments

Comments
 (0)