Skip to content
/ nuefil Public

A Rust library for interfacing with UEFI firmware.

License

Notifications You must be signed in to change notification settings

aticu/nuefil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nuefil - New UEFI Library

nuefil is yet another Rust UEFI libraray.

It is based on the UEFI libaray of Redox.

Using nuefil

To use nuefil just write the following in your Cargo.toml and use the types where the FFI boundaries require them.

nuefil = { git = "https://github.com/aticu/nuefil" }

Then you can use it in the following way:

use core::fmt::Write;
use nuefil::{
    Handle,
    status::{Status, SUCCESS},
    system::SystemTable,
    text::{BackgroundColor, Color, ForegroundColor},
};

// The entry point for UEFI.
pub extern "C" fn efi_main(_image_handle: Handle, system_table: &'static SystemTable) -> Status {
    (&*system_table.ConsoleOut).write_fmt(format_args!("Testing the {} library.\r\n", "nuefil")).unwrap();

    system_table.ConsoleOut.set_attribute(Color::new(ForegroundColor::Red, BackgroundColor::Blue)).unwrap();

    (&*system_table.ConsoleOut).write_fmt(format_args!("This line should be red with a blue background.")).unwrap();

    // Wait for input, so the output can be read
    system_table.ConsoleIn.read_key_stroke(system_table).unwrap();

    SUCCESS
}

If you're unfamiliar working Rust in such an environment and get stuck on the errors, try reading this excellent block. It talks about Rust without an operating system in general. For UEFI specifics, you can check out this thread.

About

A Rust library for interfacing with UEFI firmware.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages