Unified Extensible Firmware Interface (or UEFI for short ) is a new type of firmware that was initially designed by Intel (as EFI) mainly for its Itanium based systems. It introduces new ways of booting an OS that is distinct from the commonly used "MBR boot code" method followed for BIOS systems. It started as Intel's EFI in versions 1.x and then a group of companies called the UEFI Forum took over its development from which it was called Unified EFI starting with version 2.0 . As of 22 May 2010, UEFI Specification 2.3 is the most recent version.

Note: Unless specified as EFI 1.x , EFI and UEFI terms are used interchangeably to denote UEFI 2.x firmware. Also unless stated explicitely, the instructions are general and not Mac specific. Some of them may not work or may be different in Macs. Apple's EFI implementation is neither a EFI 1.x version nor UEFI 2.x version but includes features of both. This kind of firmware does not fall under any one UEFI version so it is not a standard EFI firmware.

Booting an OS using BIOS

A BIOS or Basic Input-Output System is the very first program that is executed once the system is switched on. After all the hardware are initialized and the POST operation is completed, the BIOS executes the first boot code in the first device in the device booting list.

If the list starts with a CD/DVD drive, then the El-Torito entry in the CD/DVD is executed. This is how bootable CD/DVD works. If the list starts with a HDD, then BIOS executes the very first 440 bytes MBR boot code. The boot code then chainloads or bootstraps a much larger and complex bootloader which then loads the OS.

Basically, the BIOS does not know how to read a partition table or filesystem. All it does is initialize the hardware, then load and run the 440-byte boot code.

Multi-booting using BIOS

Since very little can be achieved by a program which fits into the 440-byte boot code area, multi-booting using BIOS requires a multi-boot capable bootloader (multi-boot refers to booting multiple operating systems, not to booting a kernel in the Multiboot format specified by the GRUB developers). So usually a common bootloader like GRUB or LILO would be loaded by the BIOS, and it would load an operating system by either chain-loading or directly loading the kernel.

Booting an OS using UEFI

UEFI firmware does not support booting through the above mentioned method which is the only way supported by BIOS. UEFI has support for reading both the partition table as well as understanding filesystems.

The commonly used UEFI firmwares support both MBR and GPT partition table. EFI in Apple-Intel Macs are known to support Apple Partition Map also apart from MBR and GPT. Most of the UEFI firmwares have support for accessing FAT12 (floppy disks) , FAT16 and FAT32 filesystems in HDD and ISO9660 (and UDF) in CD/DVDs. EFI in Apple-Intel Macs can access HFS/HFS+ filesystems also apart from the mentioned ones.

UEFI does not launch any boot code in the MBR whether it exists or not. Instead it uses a special partition in the partition table called "EFI SYSTEM PARTITION" in which files required to be launched by the firmware is stored. Each vendor can store its files under <EFI SYSTEM PARTITION>/EFI/<VENDOR NAME>/ folder and can use the firmware or its shell (UEFI shell) to launch the boot program. An EFI System Partition is usually formatted as FAT32.

Under UEFI, every program whether they are OS loaders or some utilities (like memory testing apps) or recovery tools outside the OS, should be a UEFI Application corresponding to the EFI firmware architecture. Most of the UEFI firmware in the market, including recent Apple Macs use x86_64 EFI firmware. Only some older macs use i386 EFI firmware while no non-Apple UEFI system is known to use i386 EFI firmware.

A x86_64 EFI firmware does not include support for launching 32-bit EFI apps unlike the 64-bit Linux and Windows which include such support. Therefore the bootloader must be compiled for that architecture correctly.

Multi-booting using UEFI

Since each OS or vendor can maintain its own files within the EFI SYSTEM PARTITION without afffecting the other, multi-booting using UEFI is just a matter of launching a different UEFI application corresponding to the particular OS's bootloader. This removes the need for relying on chainloading mechanisms of one bootloader to load another to switch OSes.

Multi-booting Linux on UEFI with Windows

Windows Vista (SP1+) and 7 x64 versions support booting natively using UEFI firmware. But for this they need GPT partitioning of the HDD used for UEFI booting. Windows x64 versions support either UEFI-GPT booting or BIOS-MBR booting. Windows 32-bit versions support only BIOS-MBR booting. Follow the instructions provided in the forum link given in the references sections as to how to do this.

This limitation does not exist in Linux as linux supports all 4 combinations of booting - UEFI-GPT, UEFI-MBR, BIOS-GPT, BIOS-MBR. If Linux and Windows are in the same HDD and boot using UEFI, then the linux bootloader must be configured to boot from GPT. This is a limitation of Windows, not Linux.

Linux Kernel Configuration for UEFI

In case of linux, kernel support for EFI is very important. The required kernel configurations for UEFI systems are :

Note 1: For Linux to access UEFI Runtime Services, the UEFI Firmware processor architecture and the Linux kernel processor architecture must match. This is independent of the bootloader used and its compiled processor architecture.

Note 2: If the UEFI Firmware arch and Linux Kernel arch are different, then the "noefi" kernel parameter must be used to avoid the kernel panic and boot successfully. The "noefi" option instructs the kernel not to access the UEFI Runtime Services.

Note 3: If you experience issues booting your UEFI system, such as rebooting or a black screen you may need to use Linux 3.0 or greater. Known systems this effects, all Dell laptops, all Apple after 2010, and some Lenovo, as well as some ASUS (E-350?). See 13 in references.

To find out the arch of the efi firmware in a Mac, boot into Mac OS X and type the following command

ioreg -l -p IODeviceTree | grep firmware-abi

If the command returns EFI32 the it is i386 EFI 1.x firmware. If it returns EFI64 then it is x86_64 EFI 1.x firmware. Macs do not have UEFI 2.x firmware as Apple's efi implementation is not fully compliant with UEFI Specification.

UEFI Shell

The UEFI Shell is a shell/terminal for the firmware which allows launching uefi applications which include uefi bootloaders. Apart from that, the shell can also be used to obtain various other information about the system or the firmware like memory map (memmap), running partitioning programs (diskpart), loading uefi drivers, editing text files (edit), hexedit etc. You can download a BSD licensed UEFI Shell from Intel's Tianocore EDK2 Sourceforge.net project.

Use Beta Shell. If it does not work use Old shell. Few Asus and other AMI Aptio x86_64 UEFI firmware based motherboards (from Sandy Bridge onwards) provide an option called Launch EFI Shell from filesystem device . For those motherboards, download the x86_64 UEFI Shell and copy it to you EFI SYSTEM PARTITION as <EFI_SYSTEM_PARTITION>/shellx64.efi (mostly /boot/efi/shellx64.efi) .

Creating a UEFI SYSTEM PARTITION in Linux

For MBR partitioned disks :

Create a 200 MB FAT32 partition using GNU Parted/GParted. Change the type code of that partition to 0xEF using fdisk, cfdisk or sfdisk.

or

Create a 200 MB partition using fdisk with partition type 0xEF and format it as FAT32 using mkfs.vfat -F32 /dev/<THAT_PARTITION>

For GPT partitioned disks :

Create a 200 MB FAT32 partition using GNU Parted/GParted. Set "boot" flag on for that partition.

Note 1: Setting "boot" flag in parted in a MBR partition marks that partition as active, while the same "boot" flag in a GPT partition marks that partition as "EFI System Partition".

Note 2: Do not use fdisk, cfdisk or sfdisk to change the type codes in a GPT disk. Do not use GPT fdisk on a MBR disk, it will be automatically converted to GPT (without data loss, but with boot failure).