https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8...
https://sourceforge.net/projects/gnu-efi/
Broadly: EFI is a simple C environment (albeit one based on windows-style PE binaries and not ELF). The firmware will load and run your application binary and jump to its entry point, passing a giant table of API hooks and callbacks for you to use to interact with its services. You then read and assemble your own OS image using these tools and jump into it.