Git Product home page Git Product logo

uefi-rs's Introduction

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 (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.

Documentation

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 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.
    • --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.

Building UEFI programs

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

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.

uefi-rs's People

Contributors

adriandanis avatar atsukitak avatar bjadamson avatar colinfinck avatar dependabot-preview[bot] avatar e820 avatar edigaryev avatar foxcob avatar fredrikaleksander avatar gabrielmajeri avatar gil0mendes avatar gz avatar hadrieng2 avatar htg-yt avatar imtsuki avatar isaacwoods avatar jonahplusplus avatar josephlr avatar necauqua avatar nicholasbishop avatar ocadaruma avatar phil-opp avatar phip1611 avatar raccog avatar supdrewin avatar sven-eliasen avatar timrobertsdev avatar toku-sa-n avatar verticalegg avatar ytvwld avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.