Skip to content

Commit 1e5380e

Browse files
Merge pull request #1502 from crawfxrd/driver-link-arg
book: Set driver link-arg in `build.rs`
2 parents 2aaa2fe + 92f9d79 commit 1e5380e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

book/src/how_to/building_drivers.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ value to `efi_boot_service_driver` or `efi_runtime_driver`.
1111

1212
Example:
1313

14-
```toml
15-
# In .cargo/config.toml:
16-
[build]
17-
rustflags = ["-C", "link-args=/subsystem:efi_runtime_driver"]
14+
```rust
15+
// In build.rs
16+
17+
fn main() {
18+
let target = std::env::var("TARGET").unwrap();
19+
if target.ends_with("-unknown-uefi") {
20+
println!("cargo::rustc-link-arg=/subsystem:efi_runtime_driver");
21+
}
22+
}
1823
```
1924

2025
[spec-images]: https://uefi.org/specs/UEFI/2.10/02_Overview.html#uefi-images

0 commit comments

Comments
 (0)