| Crates.io | r-efi-alloc |
| lib.rs | r-efi-alloc |
| version | 2.1.0 |
| created_at | 2022-11-28 11:21:06.026675+00 |
| updated_at | 2025-06-17 09:13:25.451544+00 |
| description | UEFI Memory Allocator Integration |
| homepage | https://github.com/r-efi/r-efi/wiki |
| repository | https://github.com/r-efi/r-efi-alloc |
| max_upload_size | |
| id | 724364 |
| size | 44,699 |
UEFI Memory Allocator Integration
The r-efi-alloc project integrates the UEFI memory allocator routines with the
rust standard library allocation hooks. This allows using the alloc standard
library of rust on UEFI systems.
The requirements for this project are:
rustc >= 1.68.0r-efi >= 5.2.0To build this project, run:
cargo build
Available configuration options are:
allocator_api: Provide integration with the experimental upstream rust
allocators (tracked with the allocator_api feature).
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.
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
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
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.
https://github.com/r-efi/r-efi-alloc.gitgit@github.com:r-efi/r-efi-alloc.git