UEFI: Difference between revisions

185 bytes removed ,  2 years ago
Refactor POSIX-UEFI section to not reflect bias
[unchecked revision][unchecked revision]
mNo edit summary
(Refactor POSIX-UEFI section to not reflect bias)
Line 128:
:''Main article: [[POSIX-UEFI]]
 
AnOne easy wayoption to compile EFIUEFI applications on Linux (or any other POSIX compatiblelike system)systems is POSIX-UEFI. It doesprovies not only provide the well-knowna [[libc]]-like API for your EFI application, but alsoand ships with a Makefile that can detect and set up the toolchain for you. WorksIt withcan bothuse GNUGCC gcc andor LLVM, CLang.and Normallydefaults to usesusing the host's compiler, but ita iscross alsocompiler capableis ofstill detecting the need for cross-compilationrecommended.
 
It has POSIX-ized typedefs (like ''uintn_t'' instead of ''UINTN''), and it does not need nor ship the standard EFI headers. But if you install those from EDK2 or GNU-EFI, you can safely include those as well, there will be no naming conflicts. Still, those interfaces are properly defined, and all fields have exactly the same name as in EDK2, so a big advantage over GNU-EFI that you can do
<source lang="c">
ST->ConOut->OutputString(ST->ConOut, L"Hi!\r\n");
</source>
 
It uses POSIX style typedefs (like ''uintn_t'' instead of ''UINTN''), and it does not ship with the standard EFI headers. You can still get interfaces not covered by POSIX-UEFI (such as GOP) by installing the EFI headers from GNU-EFI or EDK2. Also, it compiles with the MS ABI, meaning that UEFI services can be called natively (i.e., without uefi_call_wrapper) so long as your apps are compiled with it as well.
The traditional "Hello, world" UEFI program goes like this.
<source lang="c">
Line 150 ⟶ 146:
include uefi/Makefile
</source>
JustRun run ''make'', andto thebuild rest is taken care for youit. The result of this process is a 17 kB PE executable file ''main.efi''.
 
==Developing with GNU-EFI==
Anonymous user