Seeking help on trying to learn how to work with UEFI in Rust, with the ultimate goal of learning how to write a bootloader

This page summarizes the projects mentioned and recommended in the original post on

Our great sponsors
  • - Download’s Tech Salary Report
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Scout APM - Truly a developer’s best friend
  • SonarLint - Clean code begins in your IDE with SonarLint
  • rust

    Empowering everyone to build reliable and efficient software.

    // Should be self-explanatory. #![no_std] // Like most no_std targets, UEFI executables don't use the typical main function. // Most UEFI executables have the following entry point signature (C, taken from EDK2): // // EFI_STATUS // EFIAPI // UefiMain ( // IN EFI_HANDLE ImageHandle, // IN EFI_SYSTEM_TABLE *SystemTable // ); #![no_main] // The EFIAPI ABI, used by UEFI executables, has not been stabilized in Rust yet: // #![feature(abi_efiapi)] use core::fmt::Write; use core::panic::PanicInfo; use uefi::prelude::*; // We need to manually define a panic handler. // You could also use the implementation in the uefi-services crate, but we'll keep things // simple for now. #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} } // Our custom entry point. #[entry] fn efi_main(_handle: Handle, system_table: SystemTable) -> Status { match system_table.stdout().write_str("Hello, world!\n") { Ok(_) => Status::SUCCESS, Err(_) => Status::DEVICE_ERROR } }

  • edk2

    EDK II

    The entry point takes two parameters, a Handle and a SystemTable. Section 4.1: UEFI Image Entry Point in the UEFI Specification covers this, but I'll give a brief explanation here. The Handle is an opaque handle (allocated by the firmware implementation) used to identify the currently running image/executable. You can use it with the EFI Loaded Image Protocol (more on that later) to get some more info about the current image/executable. Next is the SystemTable. The EFI System Table contains some fields such as the revision of the UEFI specification that the firmware implementation complies to, the name of the firmware vendor, and pointers to instances of the EFI Simple Text Input/Output Protocols for standard input/output/error. It also has pointers to the EFI Boot Services Table and the EFI Runtime Services Table. Section 4.3: EFI System Table has the C structure definition of the EFI System Table; you can also find its definition in the EDK2 (EFI Development Kit 2) headers. system_table.stdout() is how uefi-rs wrapped the StdOut member of the EFI System Table.


    Download’s Tech Salary Report. Median salaries, most in-demand technologies, state of the remote work... all you need to know your worth on the market by tech recruitment platform

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts