UEFI: Difference between revisions

[unchecked revision][unchecked revision]
Line 89:
 
==Developing with GNU-EFI==
GNU-EFI can be used to develop both 32-bit and 64-bit UEFI applications. This section will address 64-bit UEFI applications only, and assumes that the development environment itself is running on an x86_64 system, so that no cross-compiler is needed. For a more thorough walk-through of a proper (non-gnu-efi) development environment, see [[UEFI Bare Bones]].
 
GNU-EFI includes four things:
* '''crt0-efi-x86_64.o''': A CRT0 (C runtime initialization code) that provides an entry point that UEFI firmware will call when launching the application, which will in turn call the "efi_main" function that the developer writes.
* '''libgnuefi.a''': A library containing a single function (''_relocate'') that is used by the CRT0.
* '''elf_x86_64_efi.lds''': A linker script used to link ELF binaries into UEFI applications.
* '''efi.h''' and other headers: Convenience headers that provide structures, typedefs, and constants improve readability when accessing the System Table and other UEFI resources.
* '''libefi.a''': A library containing convenience functions like CRC computation, string length calculation, and easy text printing.
Line 159:
</source>
 
The result of this process is a 44 kB PE executable file ''main.efi''. On a real project you'll probably want to use make or another build tool, and may need to build a cross-compiler. The way GNU-EFI works is a bit contrived: you are wrapping an ELF file built by your normal compiler into PE.
 
==Emulation with QEMU and OVMF==
14

edits