Silly toy project made to learn about EDK II
Consists of multiple modules, each implementing a mini-game that can run in a UEFI environment and following the premise of " Win -> Boot, Lose -> Shutdown"
-
User Evaluation For Ineptness: Presents a simple math question, the sum of two random numbers from 0 to 99, if your answer is incorrect the system mocks you and shuts down.

-
Insult Sword Fighting: Monkey island inspired. Choose the correct comeback to continue booting.

-
Fall To Boot: Vertical scrolling procedurally generated tunnel. Reach the bottom or you'll Fail to Boot.

-
Age Verification: Leisure Suit Larry inspired. Answer 80s pop culture trivia to prove you're an adult. Get it wrong and the system decides you're too young to use this computer.

-
UEFI Says: A memory test... but not for the computer. Simon-like game implementation. Win to boot or fail and shutdown.

User Evaluation For Ineptness Running on QEMU
demo_qemu.mp4
User Evaluation For Ineptness Running on Thinkpad X270
demo_thinkpad.mp4
Fall To Boot Running on QEMU
FallToBoot-qemu.webm
UEFI Says Running on QEMU
UEFISays-qemu.webm
In this README, Insult Sword Fighting is used as the example module throughout. You can substitute any mention of it and its files with any other module.
Real Hardware
- Download
InsultSwordFighting.efifrom releases - Or build from source
ESPis typically mounted at/bootor/efireference
# Create directory structure
sudo mkdir /boot/EFI/UEFIGame
# Copy the efi application
sudo cp InsultSwordFighting.efi /boot/EFI/UEFIGame/
# Copy extra file
sudo cp insults.txt /boot/EFI/UEFIGame/Insult Sword Fighting needs
insults.txtto be present in/esp/EFI/UEFIGame, exampleinsults.txtprovided
User Evaluation For Ineptess needs
phrases.txtto be present in/esp/EFI/UEFIGame, examplephrases.txtprovided
Age Verification needs
questions.txtto be present in/esp/EFI/UEFIGame, examplequestions.txtprovided
Easiest way is to use efibootmgr
sudo efibootmgr --create --disk /dev/nvme0n1 --part 1 \
--loader '\EFI\UEFIGame\InsultSwordFighting.efi' \
--label "UEFIGame"Adjust
--diskand--partto match your system
Restart your system and enter the UEFI Setup (formerly known as BIOS), look for the boot options section and select the EFI entry you just created
QEMU + OVMF
# Arch Linux
sudo pacman -S qemu edk2-ovmf
# Debian/Ubuntu
sudo apt install qemu-system-x86 ovmf
# Fedora
sudo dnf install qemu edk2-ovmfQemu can emulate a virtual drive with a FAT filesystem. It works by prepending fat: to a directory name. reference
# Create directory structure
mkdir -p uefi_disk/EFI/UEFIGameGet InsultSwordFighting.efi either from the release section or build it yourself and copy it on the virtual disk
# Copy the application
cp InsultSwordFighting.efi uefi_disk/EFI/Boot/BOOTX64.efi
# Optional: Copy phrases file (must be UTF-16)
cp phrases.txt uefi_disk/EFI/UEFIGame/qemu-system-x86_64 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2/x64/OVMF_CODE.4m.fd \
-drive file=fat:rw:./uefi_disk,format=raw,if=virtio \
-cpu qemu64,+rdrandNotes:
- Replace OVMF path if needed (common alternatives:
/usr/share/OVMF/OVMF_CODE.fd) - The
BOOTX64.EFIfilename is required for automatic UEFI boot
Extra files should be placed in the same directory as the .efi file.
User Evaluation For Ineptness
This file is optional. If it is not present, the game will always use the same fallback phrase.
Example provided: phrases.txt
The game will choose a random phrase (Reservoir Sampling) from this file as response if the user fails the question. If the file is not available or something crashed the game falls back to a default phrase.
Nothing fancy, check the example phrases.txt provided
- file must be UTF-16
- phrases can be multiline
- phrases are separated by 1 empty line (\n\n)
Insult Sword Fighting
This file is mandatory and must be UTF-16.
Example provided: insults.txt
The game will choose a random insult and its responses.
Insult
Correct comeback
incorrect comeback
another incorrect comeback
...
as many incorrects comebacks as you want
Another insult
Correct comeback
...
Age Verification
This file is optional. If not present, the game uses a fallback question.
Example provided: questions.txt
The game will choose a random trivia question (Reservoir Sampling) about 70s/80s pop culture.
Question text
Correct answer
Wrong answer
Wrong answer
Wrong answer
Another question
Correct answer
...
- File must be UTF-16
- First answer after the question is always the correct one (answers are shuffled on display)
- Questions are separated by 1 empty line
This file is optional. Contains snarky messages shown when you fail.
Example provided: failmessages.txt
- File must be UTF-16
- Messages are separated by 1 empty line
Instructions
Follow the instructions to get a working EDK II build environment
All following commands should be run inside the
edk2directory
Clone this repo as UefiGamePkg
git clone https://github.com/mycroftsnm/UEFIGame.git UefiGamePkg First of all, run edksetup.sh (or edksetup.bat if using windows)
source edksetup.shBuild command example
build -p UefiGamePkg/UefiGamePkg.dsc -a X64 -t GCC5 -b DEBUG -m UefiGamePkg/InsultSwordFighting.inf The
-mpart is useful to avoid building allMdeModulePkgmodules.
This will generate a (hopefully) working efi binary at Build/UefiGame/DEBUG_GCC5/X64/InsultSwordFighting.efi