CFT EFI Boot Refactoring

Eric McCorkle eric at
Fri Dec 2 17:03:09 UTC 2016

Hello everyone,

My work to refactor the EFI boot loader has been in review for some time
now.  This work is a behavior-neutral refactoring which eliminates
duplicated code in boot1, provides better integration of boot1 and
loader with the EFI API, and moves towards better compliance with the
recommendations of the UEFI driver writer's guide.  This work also
serves as a precursor to more work, such as GELI, hot-plugging, and
other things.

One of the reviewers was able to trigger a hang on his setup; however,
it's not clear whether this is a problem in the refactoring, or whether
it's due to a related bug:

Therefore, I would like to issue a CFT for this changeset.  We need
people using the boot1/loader EFI boot setup to test their setup using
boot1 and loader as built with this patch applied.

You can also get the source tree directly from my github
(  Use the efize_new branch to get
this changeset.  Note that I am maintaining the state of this branch in
a single change at this point using rebase -i, so there *will* be forced
pushes to this branch.

Here are some notes on testing the changeset:

* To test it, just do a buildworld, then copy loader.efi in place and
copy boot1.efi to /efi/BOOT/BOOTX64.EFI on your ESP.  If your system
boots, then the test was successful (there are no new features in this

* The output of boot1 is slightly different, so you'll be able to tell
if you installed it correctly.

* I recommend keeping a copy of the basic boot1 around on your ESP, just
in case something goes wrong.  On my setup, I have a backup at
/efi/BOOT/BOOTX64.BAK (with the main program at /efi/BOOT/BOOTX64.EFI,
of course)

* I have been using this on a machine with two disks, a ZFS pool
spanning both disks, and a dummy UFS filesystem for months now, so it
can be considered relatively safe.

* This has also been tested on basic setups without incident, so
priority is on complex or odd setups.

* If something goes wrong, you will most likely get a boot-hang.  If
this happens, please contact me directly with the details, and I'll
coordinate on diagnosis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: efize.diff
Type: text/x-patch
Size: 132936 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-amd64 mailing list