#uefi #firmware #specification #efi #boot

no-std r-efi

UEFI Reference Specification Protocol Constants and Definitions

15 stable releases (5 major)

5.1.0 Sep 1, 2024
5.0.0 Jul 30, 2024
4.5.0 May 23, 2024
4.4.0 Mar 27, 2024
0.1.1 Dec 10, 2018

#27 in Hardware support

Download history 10572/week @ 2024-08-18 11571/week @ 2024-08-25 13146/week @ 2024-09-01 13536/week @ 2024-09-08 12175/week @ 2024-09-15 14221/week @ 2024-09-22 12757/week @ 2024-09-29 12025/week @ 2024-10-06 12863/week @ 2024-10-13 12379/week @ 2024-10-20 13005/week @ 2024-10-27 12710/week @ 2024-11-03 12856/week @ 2024-11-10 12604/week @ 2024-11-17 12434/week @ 2024-11-24 14223/week @ 2024-12-01

53,691 downloads per month
Used in 3 crates

MIT OR Apache-2.0 OR LGPL-2.1-or-later

260KB
6.5K SLoC

r-efi

UEFI Reference Specification Protocol Constants and Definitions

The r-efi project provides the protocol constants and definitions of the UEFI Reference Specification as native rust code. The scope of this project is limited to those protocol definitions. The protocols are not actually implemented. As such, this project serves as base for any UEFI application that needs to interact with UEFI, or implement (parts of) the UEFI specification.

Project

Requirements

The requirements for this project are:

  • rustc >= 1.68.0

Build

To build this project, run:

cargo build

Available configuration options are:

  • native: This feature-selector enables compilation of modules and examples that require native UEFI targets. Those will not compile on foreign targets and thus are guarded by this flag.
Build via: official toolchains

Starting with rust-version 1.68, rustup distributes pre-compiled toolchains for many UEFI targets. You can enumerate and install them via rustup. This example shows how to enumerate all available targets for your stable toolchain and then install the UEFI target for the x86_64 architecture:

rustup target list --toolchain=stable
rustup target add --toolchain=stable x86_64-unknown-uefi

This project can then be compiled directly for the selected target:

cargo +stable build \
    --examples \
    --features native \
    --lib \
    --target x86_64-unknown-uefi
Build via: cargo/rustc nightly with -Zbuild-std

If no pre-compiled toolchains are available for your selected target, you can compile the project and the required parts of the standard library via the experimental -Zbuild-std feature of rustc. This requires a nightly compiler:

cargo +nightly build \
    -Zbuild-std=core,compiler_builtins,alloc \
    -Zbuild-std-features=compiler-builtins-mem \
    --examples \
    --features native \
    --lib \
    --target x86_64-unknown-uefi
Build via: foreign target

The project can be built for non-UEFI targets via the standard rust toolchains. This allows non-UEFI targets to interact with UEFI systems or otherwise host UEFI operations. Furthermore, this allows running the foreign test-suite of this project as long as the target supports the full standard library:

cargo +stable build --all-targets
cargo +stable test --all-targets

Note that the native feature must not be enabled for foreign targets as it will not compile on non-UEFI systems.

Repository:

License:

  • MIT OR Apache-2.0 OR LGPL-2.1-or-later
  • See AUTHORS file for details.

Dependencies

~205KB