EFI development tools

Eric McCorkle eric at shadowsun.net
Fri Jun 15 22:44:32 UTC 2012


I've been working on EFI support for intel platforms.  I've managed to
build the EFI Development Kit (EDK II) and the IASL compiler for
FreeBSD, which raises the possibility of integrating them either as
ports, or possibly into the base system.

Here is some background:

Right now, there is only one EFI program that gets built in the entire
system: loader.efi (for IA64, and in the future, i386 and amd64).
This is done by building a standard ELF program with a custom linker
script which produces code at a base address of 0x1000 (This is a
trick to get the effects of compiling for position-independent code,
as required by the PE format, as the actual .text section starts at
that offset into the file).  It then uses objcopy to translate to the
PE executable format.  I've had some strange behavior in some of the
EFI interfaces (notably, ConOut), which smacks of some sort of subtle
ABI issue.

EDK seems to be made for development on a windows box, with marginal
support for Darwing and some Linux distros added as an afterthought.
It takes a bit of shoehorning to get it to build and run on FreeBSD,
but I did get it to work.  However, it would take a nontrivial effort
to get it in shape for importation into the base FreeBSD system.  It
also relies on mingw32 binutils and gcc, as well as python (though it
only uses python for build purposes; an effort to import it into the
base system would probably remove all the python bits).

The IASL compiler comes with a bunch of other ACPI components, some of
which may very well be in the base system already.

However, the EFI programs I produce using the EDK system work
properly, and don't have the same issues as the ones I produce using
what's in the base system.


As for what to do with EDK and the IASL compiler, there seem to be two
possibilities: 1) create ports for them, 2) plan on importing them
into the base system.  Here's the advantages and disadvantages as I
see them:


Port advantages: less work, doesn't mess with the base system, less
need to change the EDK and IASL compiler sources and build tools, less
work to keep up to date with releases

Port disadvantages: won't be available for building EFI boot loaders

Base system advantages: tools will be available for building boot
loaders and other components, easier to maintain compliance with UEFI
(EDK is published by Intel, and represents the official EFI
toolchain), less likely to run into subtle ABI-related bugs in EFI
programs, makes future EFI support efforts (ie on ARM) significantly
easier.

Base system disadvantages: more work, would require rewriting the
build process to avoid dependence on python, gmake, mingw32, and
others, adds more to the base system.


I'd like to get some discussion/commentary on these options, to figure
out which is the best way forward.

Thanks


More information about the freebsd-hackers mailing list