Difference between revisions of "Unified Extensible Firmware Interface"

From ArchWiki
Jump to navigation Jump to search
m (Creating a EFI SYSTEM PARTITION in Linux)
Line 120: Line 120:
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''') .
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 EFI SYSTEM PARTITION in Linux ==
== Creating a UEFI SYSTEM PARTITION in Linux ==
'''''For MBR partitioned disks :'''''
'''''For MBR partitioned disks :'''''

Revision as of 16:11, 1 October 2011

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 (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 :

Important UEFI related options -


GUID Partition Table config option - very important for UEFI


UEFI Runtime Services Support - 'efivars' kernel module - optional but 'm' recommended since it can cause booting in some Sandy Bridge UEFI systems if compiled in the kernel image itself.


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 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.

Linux Bootloaders for UEFI

GRUB2 - Follow instructions in the GRUB2 wiki page link. For bzr development version try AUR package - Template:Package AUR.

GRUB-Legacy - Vanilla versions do not support UEFI, nor does Archlinux patched versions. Only Fedora's patched GRUB (efi-gpt patches from Intel) is known to support UEFI. grub-fedora git repo. AUR package - Template:Package AUR.

ELILO - LInux LOader for EFI - Still in development but at a slow pace. Config file similar to that of lilo. The only efi bootloader for Itaniun (IA64) systems. AUR package - Template:Package AUR.

EFILINUX - Reference Implementation of a x86_64 UEFI Linux Bootloader - Still in alpha phase. AUR package - Template:Package AUR.

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), 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.

x86_64 UEFI Shell (Beta) - http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=ShellBinPkg/UefiShell/X64/Shell.efi;hb=HEAD

x86_64 UEFI Shell (Old) - http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=EdkShellBinPkg/FullShell/X64/Shell_Full.efi;hb=HEAD

i386 UEFI Shell (Beta) - http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=ShellBinPkg/UefiShell/Ia32/Shell.efi;hb=HEAD

i386 UEFI Shell (Old) - http://tianocore.git.sourceforge.net/git/gitweb.cgi?p=tianocore/edk2;a=blob_plain;f=EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi;hb=HEAD

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) .


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.


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.


Create a 200 MB partition using GPT fdisk (aka gdisk) 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 "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).


  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. EFI Boot problems on some newer machines(LKML)