Unified Extensible Firmware Interface
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.
- 1 Booting an OS using BIOS
- 2 Booting an OS using UEFI
- 3 Linux Kernel Configuration for UEFI
- 4 Linux Bootloaders for UEFI
- 5 Detecting UEFI Firmware Arch
- 6 UEFI Shell
- 7 Creating a UEFI SYSTEM PARTITION in Linux
- 8 References
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 -
CONFIG_EFI=y CONFIG_RELOCATABLE=y CONFIG_FB_EFI=y CONFIG_FRAMEBUFFER_CONSOLE=y
GUID Partition Table config option - important for UEFI
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.
CONFIG_EFI_VARS=m or y
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
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.
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.
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.
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.
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).
- Wikipedia's page on UEFI
- Wikipedia's page on EFI SYSTEM Partition
- Linux Kernel UEFI Documentation
- UEFI Forum - contains the official UEFI Specifications - GUID Partition Table is part of UEFI Specification
- 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
- Intel's page on EFI
- FGA: The EFI boot process
- Homepage of rEFIt
- Microsoft's Windows and GPT FAQ - Contains info on Windows UEFI booting also
- Convert Windows Vista SP1+ or 7 x86_64 boot from BIOS-MBR mode to UEFI-GPT mode without Reinstall
- Create a Linux BIOS+UEFI and Windows x64 BIOS+UEFI bootable USB drive
- Rod Smith - A BIOS to UEFI Transformation
- UEFI Boot problems on some newer machines(LKML)