#uefi #efi

nightly no-std uefi

Safe and easy-to-use wrapper for building UEFI apps

23 releases (12 breaking)

0.14.0 Jan 15, 2022
0.13.0 Dec 12, 2021
0.12.0 Aug 23, 2021
0.11.0 May 20, 2021
0.1.2 Feb 15, 2016

#18 in Embedded development

Download history 628/week @ 2021-10-06 662/week @ 2021-10-13 821/week @ 2021-10-20 670/week @ 2021-10-27 840/week @ 2021-11-03 841/week @ 2021-11-10 394/week @ 2021-11-17 492/week @ 2021-11-24 488/week @ 2021-12-01 1147/week @ 2021-12-08 527/week @ 2021-12-15 464/week @ 2021-12-22 474/week @ 2021-12-29 544/week @ 2022-01-05 523/week @ 2022-01-12 499/week @ 2022-01-19

2,143 downloads per month
Used in 5 crates

MPL-2.0 license

5.5K SLoC


Crates.io Docs.rs Stars License Build status


UEFI is the successor to the BIOS. It provides an early boot environment for OS loaders, hypervisors and other low-level applications. While it started out as x86-specific, it has been adopted on other platforms, such as ARM.

This crate makes it easy to both:

  • Write UEFI applications in Rust (for i686, x86_64, or aarch64)
  • Call UEFI functions from an OS (usually built with a custom target)

The objective is to provide safe and performant wrappers for UEFI interfaces, and allow developers to write idiomatic Rust code.

Check out the UEFI application template for a quick start.

Note: this crate currently has only been tested with 64-bit UEFI on x86/ARM.

uefi-rs running in QEMU

Project structure

This project contains multiple sub-crates:

  • uefi (top directory): defines the standard UEFI tables / interfaces. The objective is to stay unopionated and safely wrap most interfaces.

    Optional features:

    • alloc: implements a global allocator using UEFI functions.
      • This allows you to allocate objects on the heap.
      • There's no guarantee of the efficiency of UEFI's allocator.
    • logger: logging implementation for the standard log crate.
      • Prints output to console.
      • No buffering is done: this is not a high-performance logger.
    • exts: extensions providing utility functions for common patterns.
      • Requires the alloc crate (either enable the alloc optional feature or your own custom allocator).
  • uefi-macros: procedural macros that are used to derive some traits in uefi.

  • uefi-services: provides a panic handler, and initializes the alloc / logger features.

  • uefi-test-runner: a UEFI application that runs unit / integration tests.


The docs for the latest published crate version can be found at docs.rs/uefi/

This crate's documentation is fairly minimal, and you are encouraged to refer to the UEFI specification for detailed information.

Building and testing uefi-rs

Install the nightly version of Rust and the rust-src component:

rustup toolchain install nightly
rustup component add --toolchain nightly rust-src

Use the ./build.py script to build and test the crate.

Available commands:

  • build: build uefi-test-runner
  • clippy: run clippy on the whole workspace
  • doc: build the docs for the library packages
  • run: build uefi-test-runner and run it in QEMU
  • test: run unit tests and doctests on the host

Available options:

  • --target {x86_64,aarch64}: choose which architecture to build/run the tests
  • --verbose: enables verbose mode, prints commands before running them
  • --headless: enables headless mode, which runs QEMU without a GUI
  • --release: builds the code with optimizations enabled
  • --disable-kvm: disable KVM hardware acceleration when running the tests in QEMU (especially useful if you want to run the tests under WSL on Windows.

The uefi-test-runner directory contains a sample UEFI app which exercises most of the library's functionality.

Check out the testing project's README.md for instructions on how to run the tests.

Building UEFI programs

For instructions on how to create your own UEFI apps, see the BUILDING.md file.


We welcome issues and pull requests! For instructions on how to set up a development environment and how to add new protocols, check out CONTRIBUTING.md.


The code in this repository is licensed under the Mozilla Public License 2. This license allows you to use the crate in proprietary programs, but any modifications to the files must be open-sourced.

The full text of the license is available in the license file.


~20K SLoC