Boot Animation
EFICustomize the animated boot screen displayed by the UEFI DXE driver during the 5-second delay before chainloading Windows.
Overview
The EFI driver displays a custom animated boot screen using the UEFI Graphics Output Protocol (GOP). Animation frames are pre-converted at build time and embedded in the EFI binary for maximum performance.
Technical Details
- • Format: BGRA32 (matches GOP
PixelBlueGreenRedReserved8BitPerColor) - • Pre-converted: No runtime GIF decoding, frames stored as raw pixels
- • Display: Centered on screen, loops for 5 seconds
- • Fallback: Text-only display if GOP unavailable
- • Recommended: Max 256x256 resolution, 10-15 fps
Converting a GIF Animation
Use the provided Python tool to convert a GIF to the C header format:
Convert GIF
# Install requirements
pip install Pillow
# Convert GIF to C header
python efi/tools/gif_to_header.py your_animation.gif -o efi/DioProcessEfi/Animation.h
# Rebuild EFI driver
cd efi
build -a X64 -t VS2022 -p DioProcessEfi/DioProcessEfi.dsc -b RELEASEAnimation.h Format
Animation.h (generated)
#ifndef ANIMATION_H
#define ANIMATION_H
#define ANIMATION_WIDTH 128
#define ANIMATION_HEIGHT 128
#define ANIMATION_FRAME_COUNT 12
#define ANIMATION_FRAME_DELAY_MS 83 // ~12 fps
// Frame data: BGRA32 format, row-major order
static const UINT8 AnimationFrame0[] = {
0x00, 0x00, 0x00, 0xFF, // Pixel 0: BGRA
0x8B, 0x5C, 0xF6, 0xFF, // Pixel 1: Violet
// ... (WIDTH * HEIGHT * 4 bytes per frame)
};
static const UINT8 AnimationFrame1[] = { /* ... */ };
// ... more frames
static const UINT8* AnimationFrames[] = {
AnimationFrame0,
AnimationFrame1,
// ... all frames
};
#endifGraphics Implementation
Graphics.c (excerpt)
EFI_STATUS PlayAnimation(VOID) {
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
EFI_STATUS Status;
// 1. Locate GOP protocol
Status = gBS->LocateProtocol(
&gEfiGraphicsOutputProtocolGuid,
NULL,
(VOID**)&Gop
);
if (EFI_ERROR(Status)) {
// Fallback to text mode
return ShowTextBanner();
}
// 2. Get screen dimensions
UINTN ScreenWidth = Gop->Mode->Info->HorizontalResolution;
UINTN ScreenHeight = Gop->Mode->Info->VerticalResolution;
// 3. Calculate centered position
UINTN X = (ScreenWidth - ANIMATION_WIDTH) / 2;
UINTN Y = (ScreenHeight - ANIMATION_HEIGHT) / 2;
// 4. Animation loop (5 seconds)
UINTN TotalFrames = (5000 / ANIMATION_FRAME_DELAY_MS);
for (UINTN i = 0; i < TotalFrames; i++) {
UINTN FrameIndex = i % ANIMATION_FRAME_COUNT;
// 5. Blit frame to screen
Gop->Blt(
Gop,
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)AnimationFrames[FrameIndex],
EfiBltBufferToVideo,
0, 0, // Source X, Y
X, Y, // Dest X, Y
ANIMATION_WIDTH,
ANIMATION_HEIGHT,
0 // Delta (row stride)
);
// 6. Wait for next frame
gBS->Stall(ANIMATION_FRAME_DELAY_MS * 1000); // microseconds
}
return EFI_SUCCESS;
}Creating Custom Animations
Tips for creating effective boot animations:
- • Keep it small — Large animations increase EFI binary size
- • Simple loops — 8-16 frames is usually sufficient
- • Use transparency wisely — Alpha channel is preserved
- • Test on real hardware — Some UEFI implementations have limitations
Alternative: Matrix Animation
The repo includes tools to generate Matrix-style falling code animation:
# Generate Matrix animation
python efi/tools/gen_matrix_animation.py -o efi/DioProcessEfi/Animation.h
# Preview in console
python efi/tools/preview_matrix.pyDefault Placeholder
The default Animation.h contains a simple 2-frame blinking violet square that demonstrates the animation system without adding significant binary size.