// internals

Building

Both architectures, from one tree.

x86_64

make                 # → visor_x64.efi

The Makefile finds the gnu-efi headers and crt0-efi-x86_64.o across distro layouts. If yours is unusual:

make GNU_EFI_INC=/path/to/efi CRT0=/path/to/crt0-efi-x86_64.o

Missing gnu-efi stops the build early with an explanatory message and the per-distro install command, not a cryptic compiler error.

AArch64

tools/setup_gnuefi_aarch64.sh    # once: cross-builds gnu-efi for arm64
make ARCH=aarch64                # → visor_aa64.efi

Needs aarch64-linux-gnu-gcc. Distro gnu-efi packages ship x86-64 objects only, so the setup script cross-builds gnu-efi from gnu-efi-src/ and stages crt0/libs/linker script where the Makefile expects them.

What the build does

  1. Compiles every src/*.c freestanding: -ffreestanding -fpic -fshort-wchar -fno-stack-protector -mno-red-zone (x86) / -mstrict-align (arm), -Wall -Wextra -O2, objects into build/<arch>/.
  2. Links a shared object against gnu-efi with the arch linker script (src/visor_x86_64.lds / gnu-efi's arm one) and version script src/efi.vers.
  3. objcopy converts it to a PE (pei-x86-64 / pei-aarch64-little, subsystem 10 = EFI application).
  4. x86 only: rewrites the .reloc section with a minimal valid block and verifies its PageRVA — some binutils write a broken relocation block that firmware rejects; the build catches this instead of producing an unbootable image.

Build rules of the house

Other targets

TargetPurpose
make cleanRemove objects and binaries.
make installBuild then run ./install.sh.
make bakefont FONT=/path/font.ttf FONT_PX=64Re-bake src/font_jetbrains.c from a TTF (needs Python + Pillow).
make BUILD_DIR=/tmp/visor-buildBuild with objects outside the tree.