FS#20419 - (U)EFI Boot support for Installer CD/USB
Attached to Project:
Release Engineering
Opened by Anonymous Submitter - Monday, 09 August 2010, 13:53 GMT
Last edited by Eric Belanger (Snowman) - Saturday, 25 August 2012, 13:16 GMT
Opened by Anonymous Submitter - Monday, 09 August 2010, 13:53 GMT
Last edited by Eric Belanger (Snowman) - Saturday, 25 August 2012, 13:16 GMT
|
Details
Description :
Currently Archlinux Official Installer and Archboot do not include support for booting in pure (U)EFI systems (without a BIOS compatibility option). This support is important as more and more motherboards are shipping with UEFI 2.x firmware (Phoenix 1-second boot firmware) like Intel Server motherboards, MSI Boards and of course Apple-Intel Macs. EFI Boot support does not involve any boot-sectors and stuff like that. Only some extra files (efi apps and their configs) will be required. EFI support is not same as GPT support. Supported boot-loaders :- Fedora's grub-legacy fork - http://aur.archlinux.org/packages.php?ID=38466 - grub-efi-fedora GRUB2 EFI - http://aur.archlinux.org/packages.php?ID=38369 - grub2-efi-bzr SYSLINUX does not support EFI. Of these 2, grub2 is recommended. Although it is not KISS, it is more actively developed and its modular structure is great. Important Info :- http://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface UEFI Firmware can be either 32-bit (i386) or 64-bit (x86_64). In the ISO, the following files should be present - (iso-root)/efi/boot/bootx86.efi (grub2 binary for 32-bit EFI) (iso-root)/efi/boot/bootx64.efi (grub2 binary for 64-bit EFI) (iso-root)/efi/boot/grub.cfg (grub2 configuration file) Both the grub2 binaries need to be present as the UEFI firmware arch need not be same as the linux kernel arch. It is also not possible to change the UEFI arch by simply flashing the firmware. The UEFI firmware will automatically launch the appropriate binary depending on its arch. Therefore the filenames should not be changed. The kernel config already has efi enabled so no change is needed at kernel level. Additional requirements :- Although GPT support is not needed for UEFI boot, most of the systems using UEFI are GPT partitioned. Archboot includes GPT support in its installer and also includes "extra/gdisk" in the iso for GPT partitioning. Archiso does not include any such support. All >2TiB 512-byte sector drives have to use GPT. Please add GPT support to Archiso and move gdisk to core. None of the util-linux-ng tools support GPT. Testing :- Testing can be done using any UEFI motherboards, Intel's Tianocore EDK2 DuetPkg (http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Welcome_to_TianoCore), in QEMU using Tianocore's OVMF (http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF_FAQ) or using EFI emulation in VirtualBox (based on OVMF but OVMF downloaded binaries cannot be used). |
This task depends upon
Closed by Eric Belanger (Snowman)
Saturday, 25 August 2012, 13:16 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented. Using new EFI_STUB feature of Linux-3.3. https://projects.archlinux.org/archiso.g it/commit/?id=6caa5bcb69037442fac2b30ac5 b20e4350a11056
Saturday, 25 August 2012, 13:16 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented. Using new EFI_STUB feature of Linux-3.3. https://projects.archlinux.org/archiso.g it/commit/?id=6caa5bcb69037442fac2b30ac5 b20e4350a11056
http://fedoraproject.org/wiki/Anaconda/Features/UEFI
http://fedoraproject.org/wiki/Features/EFI
In case of Linux, I think only Fedora (and Redhat) officially support UEFI currently. They expect EFI SYSTEM PARTITION to be mounted on /boot/efi/ . In my system I mount my EFISYS at /efi so that /boot is not disturbed. I manually edited my /etc/fstab. I do not know how to detect which partition is EFISYS in a particular drive. Each physical drive may contain its own EFISYS partition.
In MBR, its type code is 0xEF. In GPT its GPT Partition Type GUID is C12A7328-F81F-11D2-BA4B-00A0C93EC93B . In GNU Parted "boot" flag in GPT disks marks a part as EFISYS. No such option exists in parted for MBR disks though. In GPT fdisk, EF00 type sets a part as EFISYS.
I had to install Archlinux only through BIOS (using Archboot for GPT and gdisk). I setup my efi bootloaders after installation manually.
The AUR grub2-efi-bzr PKGBUILD will help in understanding how to compile grub2 for efi. As you already know, cross compiling for different EFI arch requires gcc-multilib.
I think GNU xorriso is able to create compliant BIOS+UEFI+isohybrid ISOs
http://lists.gnu.org/archive/html/grub-devel/2010-04/msg00173.html
http://lists.gnu.org/archive/html/grub-devel/2010-04/msg00189.html
http://fedoraproject.org/wiki/User:Pjones/BootableCDsForBIOSAndUEFI
GNU Xorriso Latest development version includes support for creating UEFI boot images.
The R6 isos will not contain any uefi booting.
After this release i have some weeks time to develop the uefi stuff.
grub2_efi_stuff.tar.xz (281.5 KiB)
I tested the images using Virtualbox PUEL 3.2.8 and EDK1 UEFI64 DUET. There was a kernel panic while using grub2-efi-bzr but that was solved by using grub2-efi-bzr-exp package as the initrd was not loaded properly. Also grub2 efi takes a long time to setup the initramfs in the memory due to its size. There is also some problem with available video modes due to which the boot messages are not shown in EDK1 DUET (no problem with Virtualbox). Otherwise the efi firmwares detect and launch grub2 correctly which is enough for the cd. All other problems are either due to the firmware. grub2 or the kernel itself.
One problem that may arise with older BIOS firmwares is that they do not know how to read multiple el-torito boot entries.
grub.cfg_usb (0.8 KiB)
Edit: The AUR grub2-efi package link is http://aur.archlinux.org/packages.php?ID=40300 .
(iso-root)/efi/boot/bootia32.efi (grub2 binary for 32-bit EFI) - correct
Try Colin Watson's test iso http://people.canonical.com/~cjwatson/grub2/grub-multi-catalog.iso (also https://wiki.ubuntu.com/FoundationsTeam/Specs/MaverickUefiSupport ). That seems to be a better solution than my shell script. But I think grub2 bzr experimental branch must be used to solve initramfs problems that occur with main trunk.
Edit: New script at http://gist.github.com/549014 - includes grub.cfg as "cat >" output and uses splash png file syslinux/splash.png . No need for grub2_efi_stuff dir now or a separate grub.cfg outside of the script.
grub.cfg (0.9 KiB)
archboot_efi_img.sh (8.1 KiB)
set _EFI_ARCH="x86_64" for 64-bit EFI and
set _EFI_ARCH="i386" for 32-bit EFI
This variable is added to the kernel boot parameter as "none=EFI_ARCH_${_EFI_ARCH}" in the final grub2 config for the kernel. This is my workaround for detecting which efi arch is used for booting. It is possible to know the firmware version of the EFI used for booting using "dmesg" but no easy way to find out which processor arch of EFI is booted, not even with efibootmgr or uefivars (both utils use efivars kernel module).
If the kernel arch and EFI arch do not match, then "dmesg | grep EFI" shows no proper output (not even the firmware version). If tha archs match then "dmesg | grep EFI" shows the firmware (but may not show always - noefi kernel boot parameter).
With this grub2 config the "BOOT_IMAGE=" line in dmesg output includes none=EFI_ARCH_x86_64 (for 64-bit EFI) or none=EFI_ARCH_i386 (for 32-bit EFI). This detection will help in deciding which grub2 package will have to be installed during bootloader install section in archboot, whether grub2-efi-x64 or grub2-efi-x86 . I do not know how to implement install support for grub2-efi. That part is left to Tobias.
This script only enables iso or usb booting in efi. Isohybrid iso's dd copy to a USB pendrive will not work in efi. The USB has to be FAT16/32 formatted for EFI-USB booting to work.
The grub2-efi-* packages in AUR currently do not use 1.98 tar.gz but my own tar.xz of bzr rev 2627, as release 1.98 is too old for efi, as confirmed by grub2 devs http://lists.gnu.org/archive/html/grub-devel/2010-08/msg00064.html . Also archboot_efi_img.sh script needs memdisk support in grub2 which is present only in bzr development version. 1.99 is likely to be released in september http://lists.gnu.org/archive/html/grub-devel/2010-08/msg00085.html .
And a minor issue - EFI boot in VirtualBox or QEMU (OVMF based) or any Tianocore based firmware is not supporting AHCI SATA mode in BIOS. All these firmwares support only Legacy IDE mode. This may be the case even with actual UEFI firmwares in the motherboard. There should be some way to check this while booting.
if [ -d /sys/firmware/efi/ ] || [ -d /proc/efi/ ]
then
if [ "$(uname -m)" == "x86_64" ]
then
pacman -S grub2-efi-x64
elif [ "$(uname -m)" == "i686" ]
then
pacman -S grub2-efi-x86
fi
else
pacman -S grub2-bios
fi
The dir /sys/firmware/efi/ is created only if the kernel arch and efi arch match. If kernel & efi arch do not match, or if "noefi" kernel parameter is used while booting, then there is no reliable way of detecting whether it is a bios boot or efi boot. In that case assume bios boot or query the user for correct firmware info.