Search:  
Gentoo Wiki

EFI_Native_on_Mac

Under Development

This page is currently under development by: Elemecca

This page aims to provide you with: Instructions for running Gentoo on an EFI Mac without BIOS emulation

Please do NOT edit this page until this note is removed. Thank you.

Concerns or Compliments? Please use the Discussion section.

Warning: This works on my MacBook4,1. I have not tested it on other EFI Macs. Your mileage may vary. --Elemecca
Note: This article covers only the differences from the official Gentoo Handbook.
Note: Information about Gentoo on the Mac not related to EFI can be found in the Apple MacBook article.
FIXME: Add an introduction.

Contents

Partitioning

EFI uses a new partition table format called GPT instead of the old MBR scheme. GPT is not supported by the fdisk group of commands, so you'll have to use something else. You can use GParted, parted, or Apple's Disk Utility.

FIXME: Someone should probably write a tutorial for parted, but I'm not going to. --Elemecca

Kernel

You need to use kernel version 2.6.25 or better.

MacTel Patches

The MacTel patches aren't strictly necessary, but they add or improve drivers for some of the Apple-specific hardware. If you want to use the MacTel patches, you should probably use gentoo-sources or vanilla-sources. Other kernels available in Portage sometimes have problems with applying the patches.

After you download the kernel but before you configure it, you need to download and apply the MacTel patches:

svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/kernel/mactel-patches-(version)
cd mactel-patches-(version)
./apply /usr/src/linux

Replace "(version)" with the base version number of your kernel (i.e. 2.6.25). Subversion will save the patches in the current directory, so make sure to cd to where you want them first.

Configuration

Linux Kernel Configuration: Enable all supported EFI capabilities
 Processor type and features -->
   [*] EFI runtime service support (EFI=y)
 Device Drivers -->
   Graphics support -->
     Support for frame buffer devices -->
       [*] Intel-based Macintosh Framebuffer Support (FB_IMAC=y)
     Console display driver support -->
       [*] Framebuffer Console Support (FRAMEBUFFER_CONSOLE=y)
 Firmware Drivers -->
   [*] EFI Variable Support via sysfs (EFI_VARS=y)
 File systems -->
   Partition Types -->
     Advanced partition selection -->
       [ ] PC BIOS (MSDOS partition tables) support (MSDOS_PARTITION=n)
       [*] EFI GUID Partition support (EFI_PARTITION=y)

Boot Loader

Warning: If you have a Core2 processor (i.e. recent MacBooks) the EFI on your system is 64-bit. Unlike Linux, EFI cannot mix 32- and 64-bit binaries. If you have a Core2, follow the instructions in Differences for 64-bit EFI.

You can use either GRUB2 or ELILO. This is mostly a matter of preference. If you want to use GRUB2, you'll have to check it out of Subversion and compile it yourself.

GRUB2

Installation

Obtain the latest source from Subversion with the command

svn co svn://svn.savannah.gnu.org/grub/trunk/grub2

The sources will be in a directory called grub2 in the current directory.


Configure and build it with

./configure --with-platform=efi --target=i386
make

This will build all the modules, but it won't create an EFI image. You can do that with grub-mkimage.

./grub-mkimage -d . -o grub.efi gpt hfsplus fat ext2 normal chain boot configfile

If you're using any filesytems other than HFS+, FAT, and ext2, add them after ext2.


If you're using ext2/ext3 for your root partition, you can put GRUB in /efi/grub/. Otherwise, you need to put it in EFI/grub/ on the EFI system partition. You need to copy grub.efi and all the related modules to the correct directory, which is represented as "(grub-dir)" below.

cp grub.efi *.mod fs.lst command.lst (grub-dir)/

Configuration

Configuration for GRUB2 goes in grub.cfg in the same directory as grub.efi. The configuration format has changed considerably since GRUB Legacy. Each menu entry has its own scope enclosed in curly braces, and global options (i.e. timeout) go in the global scope.

File: grub.cfg
timeout=5

menuentry "Gentoo Linux 2.6.25-r7 build 0" {
    root=(hd0,4)
    linux /boot/kernel-2.6.25-gentoo-r7-mactel-b0 root=/dev/sda4 \
        video=efifb agp=off
}

Setting agp=off in the kernel options is very important. It ensures that the kernel will not try to use AGP, which would prevent the frame buffer from working.

ELILO

FIXME: I use GRUB, so I don't know anything about ELILO. Someone else should fill this in. --Elemecca

Differences for 64-bit EFI

Some newer Macs have 64-bit CPUs. These include models with Intel Core2 or recent-model Xeon CPUs. On these computers, the EFI firmware is 64-bit. Unlike Linux, 64-bit EFI has no emulation mode for 32-bit binaries. Therefore, your boot loader must be compiled 64-bit. This is fairly simple if you are using 64-bit Linux, but if you are using 32-bit Linux it becomes more difficult.

GRUB2

When you configure, use this command instead of the one above:

./configure --with-platform=efi --target=x86_64

This will work easily if your system target is x86_64 (amd64), but if your system target is i686 you'll have to cross-compile for x86_64.

FIXME: Add instructions for cross-compiling to x86_64. I don't know how. --Elemecca
Retrieved from "http://www.gentoo-wiki.info/EFI_Native_on_Mac"

Last modified: Thu, 25 Sep 2008 13:51:00 +0000 Hits: 150