Difference between revisions of "Unified Extensible Firmware Interface"

From ArchWiki
Jump to: navigation, search
m (Linux Kernel Configuration for UEFI: fixed error)
m (Linux Kernel Configuration for UEFI: fixed formatting error from last two edits.)
Line 65: Line 65:
[[Note:CONFIG_EFI_PARTITION=y by default in the Arch default kernel.]]
{{Note|CONFIG_EFI_PARTITION=y by default in the Arch default kernel.}}
UEFI Runtime Services Support - 'efivars' kernel module - optional but 'm' recommended, since it can cause booting issues in some UEFI systems if compiled within the kernel itself. Required for the sake of '''efibootmgr''' utility.
UEFI Runtime Services Support - 'efivars' kernel module - optional but 'm' recommended, since it can cause booting issues in some UEFI systems if compiled within the kernel itself. Required for the sake of '''efibootmgr''' utility.

Revision as of 01:37, 8 January 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Unified Extensible Firmware Interface (or UEFI for short) is a new type of firmware that was initially designed by Intel (known as EFI then) 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, these 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 mixes up both. This kind of firmware does not fall under any one UEFI Specification version and therefore it is not a standard UEFI 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.

Multiboot on 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 GRUB2 or Syslinux 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.

Multibooting on UEFI

Since each OS or vendor can maintain its own files within the EFI SYSTEM PARTITION without affecting 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.

Linux Windows x86_64 UEFI-GPT Multiboot

Windows Vista (SP1+) and 7 pr 8 x86_64 versions support booting natively using UEFI firmware. But for this they need GPT partitioning of the disk used for UEFI booting. Windows x86_64 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. See http://support.microsoft.com/default.aspx?scid=kb;EN-US;2581408 for more info.

This limitation does not exist in Linux Kernel but rather depends on the bootloader used. For the sake of Windows UEFI booting, the Linux bootloader used should also be installed in UEFI-GPT mode if booting from the same disk.

Linux Kernel Configuration for UEFI

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

Important UEFI related options -


GUID Partition Table config option - important for UEFI

Template error: are you trying to use the = sign? Visit Help:Template#Escape template-breaking characters for workarounds.

UEFI Runtime Services Support - 'efivars' kernel module - optional but 'm' recommended, since it can cause booting issues in some UEFI systems if compiled within the kernel itself. Required for the sake of efibootmgr utility.


Retrieved from http://kernel.org/doc/Documentation/x86/x86_64/uefi.txt .

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.

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. This limitation does not exist in Linux Kernel 3.x versions.

Linux Bootloaders for UEFI

GRUB2 - Follow instructions in GRUB2#UEFI_systems page. For bzr development version try AUR package - grub2-efi-bzrAUR.

GRUB-Legacy - Vanilla versions do not support UEFI, nor does Archlinux patched versions. Only Fedora's patched GRUB (with UEFI and GPT patches from Intel) is known to support UEFI. grub-fedora git repo. AUR package - grub-legacy-efi-fedoraAUR.

ELILO - LInux LOader for EFI - Still in development but at a slow pace. Config file similar to that of LILO. AUR package - elilo-gitAUR.

EFILINUX - Reference Implementation of a x86_64 UEFI Linux Bootloader - Still in alpha phase. AUR package - efilinux-x86_64-gitAUR.

Detecting UEFI Firmware Arch

If you have a non-mac UEFI system, then you have a x86_64 (aka 64-bit) UEFI 2.x firmware.

Some of the known x86_64 UEFI 2.x firmwares are Phoenix SecureCore Tiano, AMI Aptio, Insyde H2O.

Some of the known systems using these firmwares are Asus EZ Mode BIOS (in Sandy Bridge P67 and H67 motherboards), MSI ClickBIOS, HP EliteBooks, Sony Vaio Z series, many Intel Server and Desktop motherboards

Pre-2008 Macs mostly have i386-efi firmware while >=2008 Macs have mostly x86_64-efi. All macs capable of running Mac OS X Snow Leopard 64-bit Kernel have x86_64 EFI 1.x firmware.

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), modifying boot manager variables (bcfg), 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 UDK/EDK2 Sourceforge.net project.

x86_64 UEFI Shell 2.0 (Beta) - https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi
x86_64 UEFI Shell (Old) - https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
i386 UEFI Shell 2.0 (Beta) - https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/Ia32/Shell.efi
i386 UEFI Shell (Old) - https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi

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 your UEFI SYSTEM PARTITION as <UEFI_SYSTEM_PARTITION>/shellx64.efi (mostly /boot/efi/shellx64.efi) .

Systems with Phoenix SecureCore Tiano UEFI firmware are known to have embedded UEFI Shell which can be launched using either F6, F11 or F12 key.


For MBR partitioned disks:

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


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

For GPT partitioned disks:

Using GNU Parted/GParted: Create a >=200 MiB FAT32 partition. Set "boot" flag on for that partition.


Using GPT fdisk (aka gdisk): Create a >=200 MiB partition with gdisk type code "EF00". Then format that partition as FAT32 using mkfs.vfat -F32 /dev/<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 "UEFI System Partition".

Note 2: Do not use util-linux fdisk, cfdisk or sfdisk to change the type codes in a GPT disk. Similarly do not use gptfdisk gdisk, cgdisk or sgdisk on a MBR disk, it will be automatically converted to GPT (no data loss, but the system will fail to boot).


  1. Wikipedia's page on UEFI
  2. Wikipedia's page on EFI SYSTEM Partition
  3. Linux Kernel UEFI Documentation
  4. UEFI Forum - contains the official UEFI Specifications - GUID Partition Table is part of UEFI Specification
  5. Intel's Tianocore Project for Open-Source UEFI firmware which includes DuetPkg for direct BIOS based booting and OvmfPkg used in QEMU and Oracle VirtualBox
  6. Intel's page on EFI
  7. FGA: The EFI boot process
  8. Homepage of rEFIt
  9. Microsoft's Windows and GPT FAQ - Contains info on Windows UEFI booting also
  10. Convert Windows Vista SP1+ or 7 x86_64 boot from BIOS-MBR mode to UEFI-GPT mode without Reinstall
  11. Create a Linux BIOS+UEFI and Windows x64 BIOS+UEFI bootable USB drive
  12. Rod Smith - A BIOS to UEFI Transformation
  13. UEFI Boot problems on some newer machines(LKML)