UEFI: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
m Bot: Replace deprecated source tag with syntaxhighlight
m Bot: Replace deprecated source tag with syntaxhighlight
Line 129: Line 129:
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.
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.
The traditional "Hello, world" UEFI program goes like this.
<source lang="c">
<syntaxhighlight lang="c">
#include <uefi.h>
#include <uefi.h>
Line 137: Line 137:
return 0;
return 0;
}
}
</syntaxhighlight>
</source>
Makefile looks like this:
Makefile looks like this:
<syntaxhighlight lang="make">
<syntaxhighlight lang="make">
Line 161: Line 161:


The traditional "Hello, world" UEFI program is shown below.
The traditional "Hello, world" UEFI program is shown below.
<source lang="c">
<syntaxhighlight lang="c">
#include <efi.h>
#include <efi.h>
#include <efilib.h>
#include <efilib.h>
Line 173: Line 173:
return EFI_SUCCESS;
return EFI_SUCCESS;
}
}
</syntaxhighlight>
</source>


A few notes:
A few notes:
Line 251: Line 251:
The uefi-run application is useful for quick testing. It creates a temporary FAT image containing your EFI application and starts qemu.
The uefi-run application is useful for quick testing. It creates a temporary FAT image containing your EFI application and starts qemu.


<source lang="bash">
<syntaxhighlight lang="bash">
$ uefi-run -b /path/to/OVMF.fd -q /path/to/qemu app.efi -- <extra_qemu_args>
$ uefi-run -b /path/to/OVMF.fd -q /path/to/qemu app.efi -- <extra_qemu_args>
</syntaxhighlight>
</source>


uefi-run is not currently packaged for any distribution. You can install it using cargo (the Rust package manager) though ("cargo install uefi-run").
uefi-run is not currently packaged for any distribution. You can install it using cargo (the Rust package manager) though ("cargo install uefi-run").