Skip to content

qlibs/uefi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

// Overview / API / Resources

uefi: Unified Extensible Firmware Interface library

MIT Licence Version

https://en.wikipedia.org/wiki/UEFI

Overview

Single header minimal UEFI library

Requirements

C++20 (clang++13+, g++11+)

Overview

#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

API

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

Resources

License

About

C++20 UEFI library

Resources

Stars

Watchers

Forks