Skip to content

sunsided/ruefi

Repository files navigation

🦀🖥️ Rüfi: UEFI in Rust

Now with 100% more asteroids!

Rust UEFI QEMU OVMF unsafe allowed asteroids included

This repository contains a toy project for implementing an UEFI application in Rust mainly by using the uefi crate. It experiments with using the UEFI boot services, specifically the Graphics Output Protocol (GOP) and Input devices, and provides utility scripts for bundling the binary into an EFI System Partition (ESP) or a flashable image. The example can be run directly in QEMU from either source.

Running it

Build a local ESP directory and boot from it using QEMU:

just build && just run-qemu

Alternatively, build an image and boot from it:

just build-img && just run-qemu-img

Asteroids in UEFI

When run with just run-qemu:

Screenshot

  • Arrow keys for movement
  • Space key for firing
  • Brackets ([, ]) for changing projectile speed
  • ESC to exit to UEFI

To quit from QEMU interactive mode, press Ctrl-Shift-Q (or Ctrl-Shift-A to detach from input capture).

Setup

rustup target add x86_64-unknown-uefi
sudo apt install qemu-system ovmf libguestfs-tools

Justfile commands

Running off a directory mount:

  • just build: Build the application in debug flavor
  • just run-qemu: Run the application in QEMU

With image files:

  • just build-img: Build the application in release flavor and create a UEFI image
  • just run-qemu-img: Run the application in QEMU from the UEFI image

Additional commands used internally but provided for convenience:

  • just package: Package the application into an esp partition and prepare UEFI variables; called internally.