EFI Native on Mac

Apple's line of x86-based Macintosh computers use EFI as their system firmware. However, it is neither Intel EFI 1.1 nor UEFI 2.0; it mixes elements from the two standard versions. Because of this, and because Linux support for EFI on desktops is still quite young, running Linux directly under EFI on a Mac is complex and difficult. It requires using software that is currently under development and not yet well-tested.

For most users it makes more sense to install Linux via Apple's BIOS emulation system (part of BootCamp). Unless you have a specific reason to run under EFI, you should probably go that route instead. If you're installing under BIOS emulation, for the most part you can treat your Mac as a normal BIOS-based computer. For specifics, go read the article for your Mac model (MacBook, MacBook Pro, Mac Mini).

This article provides instructions for running Gentoo Linux directly under EFI (without BIOS emulation) on a Mac. Generally information presented elsewhere in the official documentation or wiki will not be included here. Some, but not all, of the information presented here is applicable to general EFI systems.

Installing Gentoo
This section closely follows the latest Gentoo Handbook. Section headings will match those used in the handbook. TODO: Add info on choosing an architecture.

Preparing the Disks
Fortunately, partitioning is greatly simplified when installing directly under EFI as you needn't deal with maintaining a GPT/MBR hybrid partition table unless you also have BIOS-emulated OSes installed. Your partitions will be in the GPT. If you do need to deal with a hybrid partition table, you'll need to find instructions elsewhere.

You probably don't need a separate partition for. If you're using a filesystem understood by rEFIt (see the bootloader section) it can read the bootloader directly from your root partition. If not, you can put the bootloader in the EFI system partition (kind of a system-global boot partition). You only need a partition if the bootloader doesn't understand your root filesystem.

The best partitioning tool for EFI Macs is probably GPT fdisk. It is analogous to the MBR tool fdisk. If you want a higher-level tool, you can use GNU parted instead.

Installing the Sources
All of the MacTel linux patches have been integrated into the mainline kernel, so downloading and applying them is no longer necessary.

Configuring the Bootloader
EFI is supported in some way by both of the major Linux bootloaders. For GRUB, the new GRUB2 rewrite currently under development has experimental-but-usable EFI support. For LILO, there's the elilo variant which is the de facto standard bootloader for Linux on EFI. It is recommended that you use elilo, at least until GRUB2 is more mature.

Using GRUB
When the GRUB project decided that they needed to start over from scratch, they named the new version GRUB 2 and renamed the old one GRUB Legacy. Confusingly, GRUB 2 is version 1.* and GRUB Legacy is version 0.*.

Although there are ebuilds in portage for GRUB 2, they currently don't support EFI and are thus useless here. Instead, you'll have to build it from source manually.

You can download the source tarball from the GNU alpha software FTP server. This article was tested with version 1.98. Once you've downloaded and extracted the source tarball, change to the extracted directory.

Or you can extract the source from portage

Use the following commands to run the build.

for 64-bit (u)efi

or

for 32-bit (u)efi

On an EFI system the GRUB utilities are not very much use, so you can generally skip running. Instead, you need to use the grub-mkimage tool to build an EFI executable. The command below is generally a good default.

for 64-bit (u)efi

or

Using LILO
You'll need to unmask some packages in order to install elilo. Add the following to.

Now you can install elilo by running