Skip to content

Commit

Permalink
Merge pull request #1502 from crawfxrd/driver-link-arg
Browse files Browse the repository at this point in the history
book: Set driver link-arg in `build.rs`
  • Loading branch information
nicholasbishop authored Dec 18, 2024
2 parents 2aaa2fe + 92f9d79 commit 1e5380e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions book/src/how_to/building_drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ value to `efi_boot_service_driver` or `efi_runtime_driver`.

Example:

```toml
# In .cargo/config.toml:
[build]
rustflags = ["-C", "link-args=/subsystem:efi_runtime_driver"]
```rust
// In build.rs

fn main() {
let target = std::env::var("TARGET").unwrap();
if target.ends_with("-unknown-uefi") {
println!("cargo::rustc-link-arg=/subsystem:efi_runtime_driver");
}
}
```

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

0 comments on commit 1e5380e

Please sign in to comment.