This repository hosts the Patina project - a Rust implementation of UEFI firmware.
The goal of this project is to serve as a replacement for core UEFI firmware components so they are written in Pure Rust as opposed to Rust wrappers around core implementation still written in C.
We host a Patina Community Call. Details are maintained in the discussion thread. We welcome participation from anyone interested in learning more about Patina and contributing to its development.
Unsafe Code
[![methods_unsafe_code]][_methods_unsafe_code]
There have been various instances of advocacy for building system level software in Rust.
This repository contains a Rust UEFI firmware implementation called Patina. We plan to enable an incremental migration of today's firmware components largely written in C to Rust starting with the core. The primary objective for this effort is to improve the security and stability of system firmware by leveraging the memory safety offered by Rust while retaining similar boot performance.
Patina is not a simple port of C UEFI code to Rust.
Patina is a pure‑Rust UEFI firmware implementation that removes legacy complexity and introduces a modern architecture, while preserving compatibility with current PI Specifications and enabling a clear path toward writing more firmware components in pure Rust over time.
Simply writing individual C UEFI drivers in Rust is not equivalent to Patina.
To better understand the types of memory safety problems that Patina helps mitigate, see Memory Safety Strategy.
Otherwise, read the docs to learn about concepts like Patina DXE Core Requirements and the Patina Component Model to better understand how Patina is structured and how to integrate it into a platform.
Content in the main branch of the patina repository is expected to be functionally stable with the following exception:
Also, be aware that Patina has other branches that may host work that is not yet ready for the main branch. To learn more about these branches and the overall Patina release process, read the Patina Release Process RFC.
Platform testing and integration feedback is very welcome.
Patina does not accept contributions directly from AI tools (e.g. GitHub Copilot) and has an AI Policy defined in CONTRIBUTING.md that must be followed for any contributions that are AI-assisted.
Below is the information required to perform a release that publishes to crates.io:
Follow the steps outlined by Getting Started - Rust Programming Language (rust-lang.org) to install, update (if needed), and test cargo/rust.
The [toolchain] section of the rust-toolchain.toml
file contains the tools necessary to compile and can be installed through rustup.
shell
rustup toolchain install
[tools] section of the rust-toolchain.toml
file contains tools to support commands such as cargo make coverage and must be installed manually. A local build
does not need them all, but at a minimum, cargo-make and cargo-llvm-cov should be installed.shell
cargo install cargo-make
cargo install cargo-llvm-cov
All of the Patina crates can be compiled in one of 3 supported targets; aarch64, x64, or native.
cargo make build-aarch64
- or -
cargo make build-x64
- or -
cargo make build
By default, the make compiles a developer build, but development or release can be indicated by using the "-p" flag
cargo make -p development build-aarch64
- or -
cargo make -p release build-aarch64
cargo make test
cargo make test -p patina
Build on-platform tests in the workspace:
cargo make patina-test
cargo make patina-test -p patina
Patina has a defined process that must be followed when updating the Rust or toolchain version used in the project. This sets clear expectations for developers and consumers. The update process can be found in the Rust Version Update Process page in the mdbook. If you are updating the toolchain version, you must follow that process.
The coverage command will generate test coverage data for all crates in the project. To target a single crate, the name can be added to the command line.
cargo make coverage
- or -
cargo make coverage dxe_core
Various crates have benchmarks setup that can be executed using the cargo make bench command. Any arguments provided
will be passed along to the bench command:
cargo make bench -p patina
cargo make bench -p patina --bench bench_component
cargo make bench -p patina --bench bench_component -- with_component
Benchmarks utilize the criterion benchmarking library, so if new benchmarks are to be added, they should follow that documentation. Benchmarks can be added to any crate to test performance by following the same layout as existing benchmarks, and adding the benchmark to the appropriate crate's Cargo.toml file.
Patina's upcoming work falls into three main categories:
Patina welcomes and encourages community contributions to help accelerate progress in these focus areas. We also value your ideas and feedback on additional priorities that matter to the community.
$ claude mcp add patina \
-- python -m otcore.mcp_server <graph>