Apple Macbook

From Gentoo Linux Wiki
Jump to: navigation, search
Please format this article according to the Style Guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article.

Reason(s):

  • use proper templates (Template:Root is for root-level commands, not for dangerous stuff)
  • use the right wiki syntax (# vs manual numbering, to name one problem)
  • remove information available elsewhere (e.g. list of macbook models) and refer to official documentation instead of rewriting the Gentoo Handbook
  • remove incorrect and dangerously false information (for example, concerning 32-bit and Itanium)
  • general cleanup
  • condense information
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.

Contents

[edit] Existing Models

Early 2006 (1 Gen) Late 2006 (2 Gen) Mid 2007 (3 Gen) Late 2007 (4 Gen) Early 2008 (5 Gen) Late 2008 (Aluminum)
Release
May 16, 2006 November 8, 2006 May 15, 2007 November 1, 2007 February 26, 2008 October 14, 2008
Models
MA254LL/A, MA255LL/A, MA472LL/A MA699LL/A, MA700LL/A, MA701LL/A MB061LL/A, MB062LL/A, MB063LL/A MB061LL/B, MB062LL/B, MB063LL/B MB402LL/A, MB403LL/A, MB404LL/A MB466LL/A, MB467LL/A
FSB 667MHz 800MHz
CPU CD 1.83GHz; 2.0GHz
T2400/T2500
C2D 1.83GHz; 2.0GHz
T5600/T7200
C2D 2.0GHz; 2.16GHz
T7200/T7400
C2D 2.0GHz; 2.2GHz
T7300/T7500
C2D 2.1GHz; 2.4GHz
T8100/T8300
C2D 2.0GHz, 2.4GHz
T8100/T8300
RAM 512MB 512MB 1GB 1GB 2GB 2GB DDR3
GPU Intel GMA 950 graphics processor using 64MB of shared DDR2 SDRAM Intel GMA X3100 graphics processor using 144MB of shared DDR2 SDRAM Nvidia GeForce 9400M 256MB VRAM
HDD 60GB or 80GB 60GB, 80GB or 120GB 80GB, 120GB or 160GB 80GB, 120GB or 160GB 120GB, 160GB, or 250GB 160GB, 250GB
WiFi Atheros AR242x 802.11a/b/g Atheros 802.11a/b/g and draft-n
(n disabled by default)
Atheros 802.11a/b/g and draft-n
(n enabled)
Broadcom BCM43xx 802.11|802.11a/b/g and draft-n (n enabled)

[edit] 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.

⇒  lspci information
⇒  make.conf
⇒  grub.conf
⇒  fstab
⇒  Kernel Configuration

⇒  Xorg.conf

⇒  pommed.conf

[edit] 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).

[edit] Hard Drive Setup

First thing first. We need to:

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


[edit] 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.


[edit] 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.


[edit] 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.

[edit] 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:

# diskutil list /dev/disk0
/dev/disk0
0:                 TYPE NAME                   SIZE    IDENTIFIER
0:  GUID_partition_scheme                    *74.5 GB  disk0
1:                    EFI                    200.0 MB  disk0s1
2:              Apple_HFS Macintosh HD        74.2 GB  disk0s2


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.

# sudo diskutil resizeVolume disk0s2 32G \

"Linux" <name of linux volume> 21G \ "MS-DOS FAT32" <name of windows volume> 21G

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

Note:
  • If the above command fails, run the disk utility on the Mac OSX Install and check for errors. Also diskutil can fail if it cannot find a contiguous space for large files.
  • A full Mac OSX Tiger (10.4.8) requires ~30GB of space.
  • Mac OSX 10.5 (aka Leopard) provide a different version of diskutil and it seems to not allow you creating a Linux Partition Type! Just create FAT32 partitions, boot linux from CD and change to ext3/xfs/reisersf using parted. Reboot and sync partition table using rEFIt.

[edit] 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

[edit] Partitioning Using a 3rd Party Tool

Warning:
  • May not be wise to delete your GPT partition as OS X expects it to be there.
  • It might mess things up when updating firmwire or reinstall/upgrade OS X.

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)
  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.

[edit] More Partitioning Info

Check this Website.

[edit] 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.

[edit] Installing Gentoo

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

Fix me: Fix formatting

[edit] 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?).

[edit] Hardware Setup

[edit] WLAN

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

# lspci

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)
[edit] 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.

# wget http://snapshots.madwifi-project.org/madwifi-trunk-current.tar.gz

unpack the driver

# tar xzf madwifi-trunk-current.tar.gz

change directory

# cd madwifi-trunk-current

build it

# make

install the modules

# make install

Not you can load the module by typing

# modprobe ath_pci

Don't forget to create the initscript-link:

# ln -s /etc/init.d/net.lo /etc/init.d/net.ath0
[edit] 4th-5th Generation (BCM4328 802.11a/b/g/n chipset)

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

[edit] 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

# emerge -pv broadcom-sta

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

# modprobe wl

to load the driver, and then to

# ifconfig -a

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 /etc/conf.d/net to confirm it working.Note: It's confirmed that Wireless Draft N is working with this driver.

[edit] Trackpad

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

File: /etc/make.conf
INPUT_DEVICES="evdev mtrack"
File: /etc/portage/package.keywords
=x11-drivers/xf86-input-mtrack-0.2.0 ~amd64
File: /etc/X11/xorg.conf
Section "InputClass"
  MatchIsTouchpad "on"
  Identifier "Touchpad"
  Driver "mtrack"
EndSection
# emerge xf86-input-mtrack

[edit] Audio

[edit] 5th Generation (HDA Intel)
File: /etc/asound.conf
pcm.out {
        type route
        slave.pcm "hw:0,0";
        slave.channels 6
        ttable {
                0.0 1
                1.1 1
                2.2 1
                3.3 1
                4.4 1
                0.5 0.5
                1.5 0.5
        }
}

[edit] Links

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

[edit] 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.

[edit] 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).

File: /etc/make.conf
LIRC_DEVICES="macmini"

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 appleir is removed), you need:

File: /etc/conf.d/lircd
LIRCD_OPTS="--driver=macmini --output=/var/run/lirc/lircd --uinput"

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.

[edit] 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.

[edit] 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.

$ cat > entermap.txt
remove Control = Control_R
keysym KP_Enter = Control_R
add Control = Control_R
EOF
$ xmodmap - < entermap.txt

[edit] Remap sysrq key in the kernel

# showkey
File: /usr/src/linux/include/linux/input.h
...
#define KEY_SYSRQ <keycode>
...
# cd /usr/src/linux && make mrproper && make && make modules_install
Personal tools