macOS, Startup, EFI – Understanding the Function of boot.efi

bootefimacos

I understand that when a Mac's EFI system runs, it locates the file boot.efi in the /System/Library/CoreServices/ (blessed) directory and runs this as an EFI application (subverting a large part of the UEFI specification if my understanding is correct).

My question is: what does this EFI application actually do on 10.8.4? I figure it must locate the kernel, pass through boot arguments, locate KEXTs, etc, but that is just my speculation. Is there anywhere I can find out what it does (ideally step-by-step) from a concrete source?

Best Answer

EFI is a contract that specifies how the hardware can find and start the software and vice versa.

Rather than have to build custom code into each new hardware device and each new software release - a standard was agreed upon and the specification was initially written by Intel.

Then a company like Apple decides to adopt a certain version of the EFI specification (perhaps even using specific implementations of the spec in hardware - either making it's own chips or adopting another company's implementation) and possibly extends/modifies the base implementation to meet Apple's needs.

From a high level, boot.efi is part of the software end of things that help shepard the hardware boot and handoff to the OS to let it run (in this case OS X 10.8.4):

http://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Efi_flowchart_extended.svg/500px-Efi_flowchart_extended.svg.png

The wikipedia article below is the source of the above image, as well as contains some good introductory details on EFI and Apple's use of it since 2006. Apple covers more details about their implementation of EFI and the boot process in the kernel programming guide: