|
| 1 | +# uefi-rs |
| 2 | + |
| 3 | +[](https://crates.io/crates/uefi) |
| 4 | +[](https://docs.rs/uefi) |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +[UEFI] is the successor to the BIOS. It provides an early boot environment for |
| 10 | +OS loaders, hypervisors and other low-level applications. |
| 11 | + |
| 12 | +The `uefi` crate makes it easy to: |
| 13 | +- Write UEFI applications in Rust (for `i686`, `x86_64`, or `aarch64`) |
| 14 | +- Call UEFI functions from an OS (usually built with a [custom target][rustc-custom]) |
| 15 | + |
| 16 | +The objective is to provide **safe** and **performant** wrappers for UEFI interfaces, |
| 17 | +and allow developers to write idiomatic Rust code. |
| 18 | + |
| 19 | +Check out the [UEFI application template] for a quick start. |
| 20 | + |
| 21 | +[UEFI]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface |
| 22 | +[rustc-custom]: https://doc.rust-lang.org/rustc/targets/custom.html |
| 23 | +[UEFI application template]: https://github.com/rust-osdev/uefi-rs/tree/HEAD/template |
| 24 | + |
| 25 | +## Optional features |
| 26 | + |
| 27 | +- `alloc`: Enables functionality requiring the `alloc` crate from the Rust standard library. |
| 28 | + - For example, this allows many convenient `uefi-rs` functions to operate on heap data (`Box`). |
| 29 | + - It is up to the user to provide a `#[global_allocator]`. |
| 30 | +- `global_allocator`: implements a `#[global_allocator]` using UEFI functions. |
| 31 | + - This allows you to use all abstractions from the `alloc` crate from the Rust standard library |
| 32 | + during runtime. Hence, `Vec`, `Box`, etc. will be able to allocate memory. |
| 33 | + **This is optional**, so you can provide a custom `#[global_allocator]` as well. |
| 34 | + - There's no guarantee of the efficiency of UEFI's allocator. |
| 35 | +- `logger`: logging implementation for the standard [`log`] crate. |
| 36 | + - Prints output to UEFI console. |
| 37 | + - No buffering is done: this is not a high-performance logger. |
| 38 | + |
| 39 | +See also the [`uefi-services`] crate, which provides a panic handler and |
| 40 | +initializes the `global_allocator` and `logger` features. |
| 41 | + |
| 42 | +[`log`]: https://github.com/rust-lang-nursery/log |
| 43 | +[`uefi-services`]: https://crates.io/crates/uefi-services |
| 44 | + |
| 45 | +## Documentation |
| 46 | + |
| 47 | +The [uefi-rs book] contains a tutorial, how-tos, and overviews of some |
| 48 | +important UEFI concepts. |
| 49 | + |
| 50 | +Reference documentation can be found on docs.rs: |
| 51 | +- [docs.rs/uefi](https://docs.rs/uefi) |
| 52 | +- [docs.rs/uefi-macros](https://docs.rs/uefi-macros) |
| 53 | +- [docs.rs/uefi-services](https://docs.rs/uefi-services) |
| 54 | + |
| 55 | +For additional information, refer to the [UEFI specification][spec]. |
| 56 | + |
| 57 | +[spec]: http://www.uefi.org/specifications |
| 58 | +[uefi-rs book]: https://rust-osdev.github.io/uefi-rs/HEAD |
| 59 | + |
| 60 | +## Building UEFI programs |
| 61 | + |
| 62 | +For instructions on how to create your own UEFI apps, see [BUILDING.md]. |
| 63 | + |
| 64 | +The uefi-rs crates currently require some [unstable features]. |
| 65 | +The nightly MSRV is currently 2022-08-08. |
| 66 | + |
| 67 | +[unstable features]: https://github.com/rust-osdev/uefi-rs/issues/452 |
| 68 | +[BUILDING.md]: https://github.com/rust-osdev/uefi-rs/blob/HEAD/BUILDING.md |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +The code in this repository is licensed under the Mozilla Public License 2. |
| 73 | +This license allows you to use the crate in proprietary programs, but any modifications to the files must be open-sourced. |
| 74 | + |
| 75 | +The full text of the license is available in the [license file](LICENSE). |
0 commit comments