What are the various EFI binaries for?

Hi.

Ever since FreeBSD first started supporting native UEFI boot, I always used to use /boot/boot1.efi as the first boot loader by copying it to [ESP]/EFI/BOOT/BOOTX64.EFI. This has always worked just fine.

But I've just noticed the following in uefi(8):
Code:
     The UEFI boot process proceeds as follows:
           1.   UEFI firmware runs at power up and searches for an OS loader
                in the EFI system partition.  The path to the loader may be
                set by an EFI environment variable.  If not set, an
                architecture-specific default is used.

                      Architecture    Default Path
                      amd64           /EFI/BOOT/BOOTX64.EFI
                      arm             /EFI/BOOT/BOOTARM.EFI
                      arm64           /EFI/BOOT/BOOTAA64.EFI

                The default UEFI boot configuration for FreeBSD installs
                loader.efi in the default path.

If loader.efi is now the correct binary to use for booting, this has me wondering what the purpose is of boot1.efi or gptboot.efi, or any of the other UEFI binaries:

Code:
# ls -l /boot/*.efi
-r-xr-xr-x  1 root  wheel  114176 30 Jun 19:02 /boot/boot1.efi
-r-xr-xr-x  1 root  wheel  109568 30 Jun 19:02 /boot/gptboot.efi
-r-xr-xr-x  1 root  wheel  805376 30 Jun 19:02 /boot/loader_4th.efi
-r-xr-xr-x  2 root  wheel  892928 30 Jun 19:02 /boot/loader_lua.efi
-r-xr-xr-x  1 root  wheel  747520 30 Jun 19:02 /boot/loader_simp.efi
-r-xr-xr-x  2 root  wheel  892928 30 Jun 19:02 /boot/loader.efi

(loader.efi and loader_lua.efi are hardlinks of the same file)

Can anyone shed any light on this?

EDIT: boot1.efi(8) sheds light on this. boot1.efi is deprecated and should be replaced by loader.efi. Still curious what gptboot.efi is for.
 
Last edited:
Look at the commit: here. Basically used for EFI boot on disk with GPT scheme and UFS rootfs. Man page was missing and PR was logged by grahamperrin@ some time ago.
Interestingly enough I don't have the man page even on my 13.1 VM (my HW machines use still 12.x).
 

zirias@

Developer
If loader.efi is now the correct binary to use for booting, this has me wondering what the purpose is of boot1.efi or gptboot.efi, or any of the other UEFI binaries:
None, AFAIK they're all legacy. I'm not sure since when (12? 13?), but loader now can boot every supported scenario directly as the EFI bootloader.
 

SirDice

Administrator
Staff member
Administrator
Moderator
loader_4th was the 'old' Forth loader(8), it got replaced with the LUA loader; loader_lua with 12.0 if I recall correctly. But the old Forth loader is still kept, you can switch back to it if you want. It's going to be removed in some future version though. boot1.efi is still around as sometimes an existing efi partition is too small for loader.efi.
 

zirias@

Developer
boot1.efi is still around as sometimes an existing efi partition is too small for loader.efi.
Uhm. Ok, it's kind of plausible :D ... but I'm sure you're aware that you're way outside UEFI specs if your ESP is too small for loader(8)...

Do you have a source that this is indeed the reason to keep it?
 

SirDice

Administrator
Staff member
Administrator
Moderator
Older installs created a tiny efi partition. When we still used dd(1) to write efi.fat. loader.efi won't fit in there.
 

zirias@

Developer
SirDice of course I remember that (and that wasn't in line with specs, so it did cause a few problems). But is that really the reason to keep boot1.efi etc? So they must be kept forever for installations that were once made on FreeBSD 11? :-/
 

SirDice

Administrator
Staff member
Administrator
Moderator
But is that really the reason to keep boot1.efi etc?
Don't know for sure, but it seems like a reasonable explanation.

So they must be kept forever for installations that were once made on FreeBSD 11?
Deprecation and actual removal of things can take several major versions, at least that's been my experience over the past 25 or so years.
 
  • Like
Reactions: mer
Top