EFI System Partition

From OSDev.wiki
Jump to navigation Jump to search

The EFI System Partition (ESP) is a dedicated partition on GPT. Usually a small one (32-256MiB), located at the beginning of the disk and its partition record at the beginning of the GPT.

Identify

Unlike normal bootable partitions, which have the attribute flag bit 2 set, ESP is identified by its GUID, which is

C12A7328-F81F-11D2-BA4B-00A0C93EC93B

Format

The ESP can be formatted to any FAT file system, FAT12/16/32. Often NTFS may also be supported. There's one notable exception, some older Apple machines (like iMac and MacBooks) use a special firmware which only accepts HFS+ file system on the EFI System Partition.

Access

In the EFI Shell, the ESP is the very first file system, denoting as FS0:. GRUB and ELILO recognize ESP, and they install their files there by default. Other boot loaders, like rEFInd can only work if ESP exists. From your application, you can use the EFI_SIMPLE_FILESYSTEM_PROTOCOL to access files on the ESP programmatically.

Important Files on ESP

  • FS0:\STARTUP.NSH - an EFI Shell script, similar to MS-DOS autoexec.bat
  • FS0:\BOOTMGR.EFI - the EFI boot manager
  • FS0:\BOOT\BOOTIA32.EFI - the default IA-32 (32-bit x86) boot loader
  • FS0:\BOOT\BOOTX64.EFI - the default x86-64 boot loader

To avoid filename clashes, you should not create files in the root directory of ESP. The specification mandates that root directory is for vendor directories, like FS0:\APPLE, FS0:\MICROSOFT etc. Some applications (like GRUB) just creates a one level directory without vendor parent directory. Feel free to create a directory for your own OS, and put your files there.

See Also

Articles

External Links