Single
header
minimalUEFI
library
C++20 (clang++13+, g++11+)
#include <uefi> int efi_main(void*, uefi::sys* sys) { uefi::println(sys->stdout, "Hello World!"); for (;;); }
clang++-std=c++20 -I. \ -target x86_64-pc-win32-coff \ -fno-stack-protector \ -fshort-wchar \ -mno-red-zone \ -c uefi.cpp -o uefi.o lld-link \ -filealign:16 \ -subsystem:efi_application \ -nodefaultlib -dll \ -entry:efi_main \ -out:BOOTX64.EFI \ uefi.o mkdir -p efi/boot && cp BOOTX64.EFI /usr/share/ovmf/OVMF.fd efi/boot qemu-system-x86_64 \ -drive if=pflash,format=raw,file=efi/boot/OVMF.fd \ -drive format=raw,file=fat:rw:. \ -net none
namespace uefi::inline v1_0_0 { template<u32 N> constexpr void print(auto& os, const char (&str)[N]); template<u32 N> constexpr void println(auto& os, const char (&str)[N]); } // namespace uefi