Apple Macbook

'''This document is currently being rebuilt. It is not complete'''

Macbook is series of personal laptop computers on x86 architecture manufactured and marketed by Apple Inc. This documentation is intended to help you with installing and supporting Gentoo Gnu/Linux on various models of the Macbook.

This document serves the Apple MacBook in both hardware support and installation of Gentoo GNU/Linux.

For an in-depth explanation of Gentoo the installation process itself consult the Gentoo Handbook.

''Be aware that some of the instructions on this page may not be in the same order in that you will encounter them during the installation. So I suggest that you read ahead a bit to avoid unwelcome surprises. Also Notes have been added to sections where users were kind enough to put in input of their personal experiences.''

Macbook Pro users should use the Apple Macbook Pro Gentoo Wiki.

Support Information & Files
Any questions not answered here can be discussed on the MacBook thread in the official Gentoo Forums, the Gentoo IRC Channels, or visit the mactel-linux irc chatroom at #mactel-linux on irc.oftc.net. The Gentoo Handbook is also a good source of information. Also check out the Links section of this page for some additional resources.

&rArr; lspci information &rArr; make.conf &rArr; grub.conf &rArr; fstab &rArr; Kernel Configuration &rArr; Xorg.conf &rArr; pommed.conf
 * ''' [[Media:Kernel_2628tuxonicer1.txt|Macbook 4,1 - 2.6.28-tuxonice-r1 configuration file]]
 * ''' [[Media:Config-2.6.31-5.txt|Macbook 5,1 - gentoo-sources-2.6.31-r5 configuration file]]
 * ''' [[Media:Xorg.txt|Macbook 4,1 - /etc/X11/xorg.conf configuration file]]
 * ''' [[Media:Pommed.txt|Macbook 4,1 - /etc/pommed.conf configuration file]]

Choosing the Right Installation Medium

 * First Generation MacBooks will need to use the i686 CD.
 * Second Generation MacBooks feature the Core2Duo which can emulate the 64bit instruction set. The Core2Duo is a processor that uses the IA-32 microarchitecture with EM64T extension. That makes it similar to an AMD Athlon 64 processor. Although it is not a true 64 bit processor (not IA-64 microarchitecture) it can process the 64bit instruction set and features the 64bit address register extensions and general purpose registers. That means you can choose to run a traditional 32bit x86 or an x86-64 system. An x86-64 system is capable of running 32bit and 64bit applications. The 64bit applications can use 4GB address space per process (2GB in x86).

Hard Drive Setup
First thing first. We need to:


 * Design a Partitioning Scheme
 * Partition the Disk
 * Install a bootloader. rEFIt or BootCamp

Designing a Partitioning Scheme
This is a very critical step of the installation. Depends a lot whenever you would like to run Microsoft Windows alongside with the OSX and Gentoo and if you want to keep the GPT partition scheme or use the old MBR.

There were two ways to partition a MacBook to install Gentoo GNU/Linux, use (diskutil) to partition on a pre-installed EFI-GPT scheme, or use third party utilities and partition with the MBR standard. Parted and GParted have proved to be reliable to many users.

For EFI-GPT Partition Schemes
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.

diskutil only is able to create primary/logical partitions hence the 4 partition GPT limit. It is possible to have a 7 partition system running smoothly with bootcamp using GPT.

For MBR Partitioning Schemes
The hybrid partitioning scheme that allows Intel-based Macs to boot OS X with other operating systems supports for GPT partitioning as well as legacy MBR.

If you are going to wipe the GPT partition and go for a MBR only disk, you'll have to destroy your current OSX partition. Is possible to mirror the current OSX installation to a external USB drive, make the MBR partitions, and then bring the OSX installation back to one of the partitions. I did exactly that, and used SuperDuper to mirror the OSX partition out to a USB Drive and then back in.

Partitioning Using diskutil
diskutil is included with Mac 10.4.6 or higher. It must be noted, that GPT partition standard only allows a maximum of four partitions to be created. The first partition is an EFI partition (an unseen partition) located at the first 200MB on a MacBook hard disk. With the GPT scheme this leaves only three partitions to work with. diskutil is used from the command line or can be used with BootCamp with limited ability.

In OS X open the Terminal application and type:

The disk is already partitioned, notice the EFI partition (disk0s1). Locate the "identifier" of your Mac OSX partition. This partition will be divided to create a partition(s) for the Linux install.

In this instance the OSX partition is disk0s2.

In the example below, the disk is repartitioned from a 80GB partition to contain a 32GB OS X partition, 21GB Linux partition and 21GB Windows partition. The volume sizes and names can be changed but keep the order. This example includes a Windows partition.

diskutil doesn't actually format here. It separates the disk (moves data if necessary) and writes a new GPT/EFI/MBR partition map.

Now from OSX, install rEFIt

Partitioning Using BootCamp
If you are planning to use BootCamp (best for new Mac OS X users). When you run BootCamp, create a Windows Drivers CD if you plan a Windows XP or Vista install. BootCamp simplifies the entire process. It will walk you through not only how to resize the Mac OS X partition, but also install a bootloader.

Download BootCamp

Partitioning Using a 3rd Party Tool
This bellow is my partitioning scheme. (Scheme A - No Windows!)
 * 1) Clone (SuperDuper) to an external disk. Make sure you have rEFIt DMG in this external disk for posterior instalation.
 * 2) Boot Gentoo's Minimal CD and repartition the disk with fdisk as MS-DOS/MBR (NO GPT):
 * Scheme A (without compatibility partition)
 * - Boot - /boot (500MB) ReiserFS (flag it "a"/bootable in fdisk)
 * - SWAP - 2GB
 * - OSX - HPFS (You decide the size)
 * - Gentoo Root / (You decide the size) - ReiserFS
 * Scheme B (with compatibility partition)
 * - Gentoo Root / (You decide the size) - ReiserFS
 * - SWAP - 2GB
 * - OSX - HPFS (You decide the size)
 * - Shared - FAT32 (You decide the size)
 * - Shared - FAT32 (You decide the size)


 * 1) Boot via USB Drive (The one you used to mirror OSX).
 * 2) Mirror OSX Back to partition 3.
 * 3) Install rEFIt to OSX partition 3. Choose rEFIt's enable-always.
 * 4) Boot OSX from partition 3 to make sure is booting ok.
 * 5) Boot to Gentoo Minimal CD and proceed with the installation.
 * 6) Install GRUB to the disk's MBR.

More Partitioning Info
Check this Website.

Resyncing
If you are using EFI-GTP you need to install rEFIt and after you create the Linux partitions use the rEFIt partitioning tool to resync your partition tables. Only then proceed with the installation. Remember once you modify the partition type under Linux (use only GParted or Parted), you need to reboot, and resync using rEFIt partitioning tool (is on the rEFIt menu).

This is not needed if you used the "Partitioning Using a 3rd Party Tool" method.

Installing Gentoo
As usual, for general installation information consult the Gentoo Installation Docs. This section details Macbook specific installation quirks.

Setting make.conf
Check Apple Macbook make.conf for a complete make.conf. Download it and edit to suit your requirements. I have done my best to make this configuration as heterogeneous as possible. Due to the amount of variables in Gentoo's make.conf they cannot be covered in this tutorial. If you require some assistance ingesting how make.conf works Gentoo's Official Portage Documentation can be used. If you need, use the x86 documentation or the ia64 documentation (you mean x64?).

WLAN
Different generation of macbook included different wlan chipset. To find out, which chipset your macbook has installed, try

and search for a line like 02:00.0 Network controller: Broadcom Corporation Device 4328 or a line like 02:00.0 Network controller: Atheros Communications Inc. AR5418 802.11abgn Wireless PCI Express Adapter (rev 01)

2nd-3rd Generation (AR5418 802.11a/b/g/n chipset)
As the chip is not yet supported by the madwifi release, you can build the development version from source.

unpack the driver

change directory

build it

install the modules

Not you can load the module by typing

Don't forget to create the initscript-link:

4th-5th Generation (BCM4328 802.11a/b/g/n chipset)
The easiest way to set up WiFi for these generation Macbooks is to follow the directions for the Open Source Kernel Driver in Broadcom_43xx (make sure you do the fwcutter part).

There are two ways to get this card working. Either using ndiswrapper and the windows drivers or using broadcom's official "hybrid"-driver.

Hybrid driver
Broadcom has issued a driver at http://www.broadcom.com/support/802.11/linux_sta.php which contains source code and closed-source bits, hence the name. This driver is in portage as broadcom-sta. To install, unmask the driver and do

The ebuild will inform you about which kernel options are necessary for the driver to work.

If the emerge process was successful, you should be able to

to load the driver, and then to

to check if everyting worked. You should find a new device like eth1     Protokoll:Ethernet  Hardware Adresse 00:1e:52:7e:ce:e1 BROADCAST MULTICAST MTU:1500  Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)          Interrupt:16 Notice the new device's name will be eth1 whereas with other drivers it is generally called "wlan0". This is normal. Don't forget to update your to confirm it working.Note: It's confirmed that Wireless Draft N is working with this driver.

Trackpad
The masked package mtrack is designed for Macbook trackpads, so it's the one I'll be using.

Links
More information may be found on the old wiki-page: http://www.gentoo-wiki.info/Apple_MacBook

Configuring Gentoo
This section is meant to be anything related to configuring Gentoo for the Macbook SPECIFICALLY. Please do not add anything related to Gentoo in a general sense.

LIRC
If the following is added to /etc/make.conf and the lirc package is (r)emerged, LIRC works and receives the proper codes from the Apple remote (PLAY, BACKWARD, FORWARD, VOLUP, VOLDOWN, MENU).

Copy the configuration file: cp /usr/share/lirc/remotes/apple/lircd.conf.macmini /etc/lirc/lircd.conf Now, if you have a kernel version >=2.6.30 (where the |module appleir is removed), you need:

Obviously in your kernel you must have (static or module): CONFIG_INPUT_UINPUT=m

For more information about LIRC (installing, configuring, and using), see this page.

Mapping keys
Mapping Keys is documented in the Multimedia Keys wiki document already. This section should contain Macbook specific key remappings that may be useful to some users.

Remap enter to right ctrl
Do you ever use the little enter key (beside the right command key) on your Macbook? If not, you can remap it to a right control key. That way, it ends up being in the exact same location as Control_R, as most other keyboards. We can do that by running xmodmap with the appropriate input.