No description
Find a file
Nicholas Bishop d6edea5e4c uefi-macros: Change uefi dev-dependency from version to path
Using a path avoids having to update the `uefi-macros` dep on `uefi` after
releasing a new version of `uefi`, slightly simplifying our release process.

Prior to cargo 1.40 there was no choice but to have a version on
dev-dependencies. That changed with
https://github.com/rust-lang/cargo/pull/7333, and now you can publish a crate
with a path-only dev dependency.
2023-11-11 19:27:34 -05:00
.cargo several unrelated cleanups 2022-11-20 12:49:37 -05:00
.github chore(deps): update crate-ci/typos action to v1.16.22 2023-11-03 19:28:01 +00:00
book Update uefi-services version 2023-10-11 13:16:13 -04:00
nix nix: switch to niv instead of non-standard dependency management 2023-06-10 19:46:42 -04:00
template Update uefi-services version 2023-10-11 13:16:13 -04:00
uefi uefi: Replace FileImpl with uefi-raw's FileProtocolV1 2023-11-04 11:35:52 -04:00
uefi-macros uefi-macros: Change uefi dev-dependency from version to path 2023-11-11 19:27:34 -05:00
uefi-raw uefi-raw: Add API guidelines 2023-11-07 19:28:55 -05:00
uefi-services uefi: Use atomics instead of static mut in allocator 2023-10-27 11:52:24 -04:00
uefi-test-runner Mark free_pages and free_pool as unsafe 2023-10-25 20:26:44 -04:00
xtask build(deps): bump regex from 1.9.0 to 1.10.2 2023-10-16 16:24:14 +00:00
.editorconfig OVMF: enable "cargo xtest run" under NixOS 2023-03-24 15:33:20 -04:00
.envrc add .envrc 2023-06-10 19:46:42 -04:00
.gitattributes Add project skeleton 2017-11-22 19:06:09 +02:00
.gitignore add Cargo.lock 2023-03-25 10:50:38 -04:00
.typos.toml ci: add spellcheck with "typos" 2023-03-09 16:48:13 +01:00
Cargo.lock chore(deps): lock file maintenance 2023-11-07 22:09:21 +00:00
Cargo.toml build(deps): bump uguid from 2.0.0 to 2.1.0 2023-10-09 16:46:47 +00:00
CHANGELOG.md uefi-raw: Add SimpleFileSystemProtocol and related types 2023-11-04 11:27:10 -04:00
CONTRIBUTING.md uefi: Use unsafe_protocol! for all protocol impls 2022-12-26 18:10:19 -05:00
LICENSE License under MPL 2.0 2017-11-22 19:38:50 +02:00
PUBLISHING.md uefi-macros: Change uefi dev-dependency from version to path 2023-11-11 19:27:34 -05:00
README.md Add links to the uefi-raw docs 2023-07-08 18:43:33 -04:00
rust-toolchain.toml Change toolchain from nightly to stable 2023-03-19 18:09:27 -04:00
shell.nix xtask: add "cargo xtask fmt [--check]" for rust, nix, and yml 2023-06-13 12:55:54 -04:00

uefi-rs

Crates.io Docs.rs Stars License Build status

Description

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.

uefi-rs running in QEMU

Project structure

This project contains multiple sub-crates:

  • uefi: defines the standard UEFI tables / interfaces. The objective is to stay unopinionated and safely wrap most interfaces.

  • uefi-macros: procedural macros that are used to derive some traits in uefi.

  • uefi-raw: raw types that closely match the definitions in the UEFI Specification. Safe wrappers for these types are provided by the uefi crate. The raw types are suitable for implementing UEFI firmware.

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

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

Documentation

The uefi-rs book contains a tutorial, how-tos, and overviews of some important UEFI concepts.

Reference documentation can be found on docs.rs:

For additional information, refer to the UEFI specification.

Building and testing uefi-rs

Use the cargo xtask command to build and test the crate.

Available commands:

  • build: build all the UEFI packages
    • --release: build in release mode
    • --target {x86_64,ia32,aarch64}: choose target UEFI arch
  • clippy: run clippy on all the packages
    • --target {x86_64,ia32,aarch64}: choose target UEFI arch
    • --warnings-as-errors: treat warnings as errors
  • doc: build the docs for the UEFI packages
    • --open: open the docs in a browser
    • --warnings-as-errors: treat warnings as errors
  • run: build uefi-test-runner and run it in QEMU
    • --ci: disable some tests that don't work in the CI
    • --disable-kvm: disable hardware accelerated virtualization support in QEMU. Especially useful if you want to run the tests under WSL on Windows.
    • --example <NAME>: run an example instead of the main binary.
    • --headless: run QEMU without a GUI
    • --ovmf-code <PATH>: path of an OVMF code file
    • --ovmf-vars <PATH>: path of an OVMF vars file
    • --release: build in release mode
    • --target {x86_64,ia32,aarch64}: choose target UEFI arch
  • test: run unit tests and doctests on the host

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 prerequisites for running the tests.

MSRV

See the uefi package's README.

Contributing

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.

License

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.