3 ms·
I don't know how it works on apple hardware—though I heard they used a UEFI variant with HFS+ at one point—but in general, on PCs, there are two ways to get boo
by moonchild 6y ago
I don't know how it works on apple hardware—though I heard they used a UEFI variant with HFS+ at one point—but in general, on PCs, there are two ways to get bootcode to run.
The first is legacy BIOS: the BIOS will load the first 512 bytes of the boot sector, called the Master Boot Record (MBR) into memory location 0x7C00; they are then responsible for bootstrapping the rest of the system. Usually by doing the bare minimum to load a second-stage bootloader off the disc, and letting the second-stage bootloader do the rest of the work, since 512 bytes (actually only ~440) is really not very much.
The second is UEFI. The firmware will load a PE-formatted executable from a .efi-suffixed file on a FAT32 partition which has the EFI System Partition (ESP) flag set. Since this PE file can be any size, a second-stage bootloader is not generally necessary (but may be interesting for aesthetic reasons e.g. if you don't like PE).
- alexjm 6y agoThe process for Apple hardware to find and start EFI is described in the "Booting from an Apple File System Partition" section on page 22 of this document. Basically, the EFI image is read from a special block on disk. https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf https://developer.apple.com/support/downloads/Apple-File-Sys... The boot process for HFS+ is more involved, because you have to actually read the HFS+ file system to locate the EFI image, since it's stored in a regular file. I'm not sure what happens after jumping into the EFI code. (Disclaimer: I worked on the linked document.)