UEFI

From Free Pascal wiki
Jump to navigationJump to search

Motivations behind this target

Unified Extensible Firmware Interface (UEFI) now replace BIOS in most current PCs.

Currently, there is two main options to develop UEFI applications :

- Tianocore : http://www.tianocore.org/
- gnu-efi : http://sourceforge.net/projects/gnu-efi/

Both solutions require a tedious setup process.

Thank to his internal linker, Freepascal can become the easiest option to develop UEFI applications, as no external tools would be required to start hacking.

Technical requirements

UEFI applications are PE binaries like Windows target. Freepascal already support that. The only difference is a different subsystem in the PE header.

Calling conventions under UEFI are identical to the corresponding ones under Windows on the same architecture. Freepascal already support that too.

Testing UEFI applications with qemu

See http://wiki.osdev.org/UEFI#Emulation_with_QEMU_and_OVMF

To avoid creating an image, i use FAT emulation to a local directory where my UEFI application is located :

qemu-system-i386-x86 -pflash /path/to/OVMF.fd -hda fat:local_directory -net none

"-net none" avoid net booting to save a few seconds in the boot process.

From UEFI shell, then write :

fs0:

then you can launch your UEFI application :

app.efi

Resources

Some interesting development resources around UEFI :

- UEFI specifications : http://www.uefi.org/
- OS development under UEFI : http://wiki.osdev.org/UEFI
- UEFI bootloaders : http://www.rodsbooks.com/efi-bootloaders/principles.html