Howto guide for Debian GNU/Linux on the Apple MacBook Pro 5,5 (Summer 2009)
Last updated: Mon Jun 21 07:40 UTC 2010
Contents:
Status
Installation
Booting Linux by default
Upgrade to Sid
Kernel
Graphics drivers
Wireless
Touchpad
Keyboard
Sound
LCD Brightness
Fan control
Recommended packages
Resources
Appendices:
Building the latest rc kernel
Problems upgrading dkms packages
System Information
I'm dual booting OS X 10.6.1 and Debian Sid AMD64. Specs of my 13" MBP:
StatusCode:Model Name: MacBook Pro
Model Identifier: MacBookPro5,5
Processor Name: Intel Core 2 Duo
Processor Speed: 2.53 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 3 MB
Memory: 4 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MBP55.00AC.B03
SMC Version (system): 1.47f2
Not working yet:
-Expose and Dashboard hotkeys
Works (out of the box):
-Bluetooth
-Camera
-Suspend and resume
Works (after some tweaks):
-Wireless (via proprietary Broadcom STA module).
-Sound with headphone sensing and digital (optical) switch (via manual ALSA build). See important note below about volume balance.
-NVIDIA 9400M GPU with HDMI out over Mini DisplayPort (via proprietary NVIDIA drivers). Note: hardware does NOT support HDMI audio -- Mini DisplayPort cannot carry audio signals.
-Touchpad two finger scrolling, two finger right click, three finger 3rd button, click-and-drag (via bcm5974-dkms).
-Rebooting and halting the machine works with 2.6.31 and later but not .30 or earlier
-Light sensor (via pommed).
-Keyboard backlight, adjustment with F5 and F6 (via pommed).
-LCD backlight adjustment with F1 and F2 (via pommed and nvidia-bl).
Installation
Step 1. Upgrade to Snow Leopard. (optional)
Step 2. Resize primary partition to 120GB (or whatever). Open the Terminal (from Applications->Utilities) and run:
Where 120G is 120GB or however much space you want to leave for OS X out of your whole disk.
Code:
Code:diskutil list
sudo diskutil resizevolume disk0s2 120G
Step 3. Reboot.
Step 4. Create MS-DOS partition in Disk Utility (from Applications->Utilities) to fill up free space. Do not choose a different partition type besides MS-DOS.
Step 5. Install rEFIt. If rEFIt doesn't show up immediately upon rebooting, in OS X open the Terminal (from Applications->Utilities) and run:
You may need to enter your password (or press enter for a blank password).
Code:
Code:cd /efi/refit
./enable.sh
Step 6. Burn Debian 5.0.3 AMD64 Netinst ISO and reboot holding the C key (note: the latest Squeeze daily build did not work for me it would hang after setting console mode to UTF-8).
Step 7. Start Debian installer with Ethernet plugged in, go through first steps.
Step 8. Choose manual partitioning and delete the MS-DOS partition. In its space create a primary Linux and swap partitions. Other partitions for sharing data are optional. Format the partitions and make sure the primary Linux partition is bootable.
Step 9. Configure package sources and install base system. Choose software and install the rest of the system up until the bootloader.
Step 10. When prompted to install GRUB select 'Go Back'. Hit Fn+control+option+F2 to get to the terminal. Hit return. The partitions need to be synchronized:
Step 12. Now install GRUB where /dev/sda4 is the linux system partition:
Code:
Code:chroot /target
aptitude install refit
/sbin/gptsync /dev/sda
Step 13. Hit Fn+control+option+F1, complete the installation and reboot.
Code:
Code:aptitude install grub
grub-install /dev/sda4
update-grub
Step 14. Choose Linux from the rEFIt menu and boot Debian.
Boot Linux by default
This is optional. If you want OS X to be your default OS, skip this section.
Boot OS X and open the Terminal. Run:
You should start on a line that reads:
Code:
Code:nano +93 /efi/refit/refit.conf
Hit Fn+Delete to remove the # from the beginning of the line (to uncomment it).
Code:
Code:#legacyfirst
Optional: If you want to change the timeout (default 5 seconds), it is at the top of the file. Press Control+w and type timeout and press return and you should see it.
Hit Control+o (the letter O NOT number 0) and press Enter/Return to save the file.
Upgrade to Sid
Edit your /etc/apt/sources.list (as root) to read:
Comment out (or delete) any other lines. Then update the package list and do the upgrade:
Code:
Code:deb http://mirrors.kernel.org/debian/ sid main contrib non-free
deb-src http://mirrors.kernel.org/debian/ sid main contrib non-free
Kernel
Code:
Code:apt-get update && apt-get dist-upgrade
First get a few packages installed (as root):
Next, add your regular user account to the src group (as root):
Code:
Code:apt-get install build-essential kernel-package
Copy over the kernel installation scripts (otherwise no initrd will be created and the system won't boot until a manual mkinitramfs) as root:
Code:
Code:adduser yourname src
Log out and back in (restart X) from System->Log Out.
Code:
Code:cp /usr/share/kernel-package/examples/etc/kernel/postinst.d/initramfs /etc/kernel/postinst.d/
cp /usr/share/kernel-package/examples/etc/kernel/postrm.d/initramfs /etc/kernel/postrm.d/
After logging back in with your regular user account you will have write access on /usr/src. Next, download and build the kernel as a regular user (not root).
This should take about an hour or so. After it finishes, install the .debs in the parent directory and update grub (as root):
Code:
Code:cd /usr/src
wget http://www.kernel.org/pub/linux/kern....31.13.tar.bz2
tar jxvf linux-2.6.31.13.tar.bz2
cd linux-2.6.31.13
export CONCURRENCY_LEVEL=2
wget -O .config http://allurgroceries.com/mbp55/config-2.6.31.6
make oldconfig && make prepare
make-kpkg clean
fakeroot make-kpkg --initrd kernel_image kernel_headers
Now reboot and select the 2.6.31.13 kernel from the boot menu.
Code:
Code:dpkg -i /usr/src/linux-image-2.6.31.13_2.6.31.13-10.00.Custom_amd64.deb /usr/src/linux-headers-2.6.31.13_2.6.31.13-10.00.Custom_amd64.deb
update-grub
Graphics drivers
Hit Fn+control+option+F1 if you are in a graphical environment.
Optional: install my xorg.conf which has PowerMizer enabled to throttle back the GPU when it's not being used by 3D apps. Also disables the NVIDIA logo on X startup. Do this as root (use sudo if needed):
Code:
Code:/etc/init.d/gdm stop
cd ~
wget http://us.download.nvidia.com/XFree8...36.31-pkg2.run
chmod +x NVIDIA-Linux-x86_64-195.36.31-pkg2.run
modprobe -r nvidia
./NVIDIA-Linux-x86_64-195.36.31-pkg2.run -Nqa --ui=none
nvidia-xconfig
/etc/init.d/gdm start
Wireless
Code:
Code:mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old
wget -O /etc/X11/xorg.conf http://allurgroceries.com/mbp55/xorg.conf
First make sure that the b43 module is not installed and loaded because it does not support the BCM4322 in the MBP5,5 and it will cause conflicts (lockups).
Check to see if b43 is loaded (as root):
If anything is listed, it means the module is loaded. Unload it (as root):
Code:
Code:lsmod | grep b43
To prevent the module from loading on startup, add it to the blacklist (as root):
Code:
Code:modprobe -r b43
Now install the wireless drivers:
Code:
Code:echo "blacklist b43" >> /etc/modprobe.d/blacklist.conf
echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf
Touchpad
Code:
Code:apt-get update
apt-get install wireless-tools
cd /usr/src
mkdir wl
cd wl
wget http://www.broadcom.com/docs/linux_s....91.9.3.tar.gz
tar zxvf hybrid-portsrc-x86_64-v5.10.91.9.3.tar.gz
KBUILD_NOPEDANTIC=1 make -C /lib/modules/`uname -r`/build M=`pwd`
install -D -m 755 wl.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/wl.ko
depmod -r
modprobe wl
echo wl >> /etc/modules
First, configure the touchpad by creating /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi. There is an example file here:
https://help.ubuntu.com/community/Ma...aunty#Touchpad
Next, install dkms and get a patched bcm5974-dkms that enables click-and-drag:
Click and drag will work, but you must click first and then place 2nd finger down to drag, otherwise it ends up a right click (remember -- two fingers to right click and three for the 3rd mouse button).
Code:
Code:apt-get install dkms
wget http://launchpadlibrarian.net/248719...4_all_test.deb
dpkg -i bcm5974-dkms_1.1.4_all_test.deb
modprobe -r bcm5974
modprobe bcm5974
Keyboard
To get the keyboard backlight working (with F5 and F6 to control it):
Also see the resources section below on how to manually control the keyboard backlight level.
Code:
Code:apt-get install pommed
Sound
First install the build dependencies, then get the ALSA driver source, compile it, install, and reload ALSA. Note that the pulseaudio line is optional. If you are not running pulseaudio disregard that command below. Most Ubuntu users probably have it enabled.
Sound will now work.* You may notice that the left channel is louder than the right at first. This is because the mixer has the 'Surround Speaker' switch off by default and its levels at 0. Enable the switch in your mixer (gnome-alsamixer for example) and turn up its channel and the levels should even out. This is by hardware design - the left speaker is above the Esc key and the right is below the return key, thus the left is more directly exposed and reflects off of the LCD. With the surround speaker ("subwoofer") enabled it will sound even between left and right channels.
Code:
Code:apt-get build-dep alsa-source
wget ftp://ftp.alsa-project.org/pub/drive...1.0.21.tar.bz2
tar jxvf alsa-driver-1.0.21.tar.bz2
cd alsa-driver-1.0.21
./configure
make
make install
/etc/init.d/pulseaudio stop
alsa force-reload
*Ubuntu users: If sound doesn't work still, try this:
http://ubuntuforums.org/showthread.p...68#post8076668
How to stop the terribly annoying volume adjustment sound. Edit /etc/pommed.conf
LCD Brightness
Code:
Code:# Audio support
audio {
# Use amixer or alsamixer/alsamixergui to determine the sound card
# and the mixer elements to use here.
# sound card to use
card = "default"
# initial volume [80] (0 - 100%, -1 to disable)
init = -1
# step value (1 - 50%)
step = 10
# beep on volume change
beep = no
This requires nvidia-bl-dkms from the Mactel PPA along with pommed 1.29 or later.
First install nvidia-bl-dkms:
Then, blacklist mbp_nvidia_bl and add nvidia_bl to /etc/modules:
Code:
Code:wget https://launchpad.net/~mactel-suppor...~lucid_all.deb
dpkg -i nvidia-bl-dkms_0.16.9~lucid_all.deb
Reboot and the backlight control with F1 and F2 should work now (inside X and at the terminal).
Code:
Code:echo "blacklist mbp_nvidia_bl" >> /etc/modprobe.d/blacklist.conf
echo "nvidia_bl" >> /etc/modules
Update: pommed seems to be killing my backlight brightness now when I unplug from AC power. Also the step is too low so I have to hold down the brightness keys forever for it to change. Here's a workaround. Edit /etc/pommed.conf, the changes are in bold:
Then restart pommed:
Code:
Code:# sysfs backlight control
# nVidia machines, will fall back to nv8600gmt if not supported by the kernel
lcd_sysfs {
# The sysfs backlight control is a generic interface provided
# by the Linux kernel for backlight control on most graphic cards.
# The brightness range can differ depending on the hardware.
# initial backlight level [12] (0 - 15, -1 to disable)
init = -1
# step value (1 - 2)
step = 32
# backlight level when on battery [6] (1 - 15, 0 to disable)
on_batt = 1024
}
OBSOLETE: This is for reference if you used the previous method with a patched version of gnome-power-manager. Here is how to remove and reinstall the stock gnome-power-manager package:
Code:
Code:/etc/init.d/pommed restart
Fan control
Code:
Code:dpkg -P gnome-power-manager
apt-get install gnome-power-manager
With the use of the applesmc module the fan can be manually controlled:
Recommended packages
Code:
Code:echo 1 > /sys/devices/platform/applesmc.768/fan1_manual
echo 7000 > /sys/devices/platform/applesmc.768/fan1_min
Preload "is an adaptive readahead daemon. It monitors applications that users run, and by analyzing this data, predicts what applications users might run, and fetches those binaries and their dependencies into memory for faster startup times."
cpufrequtils: "utilities to deal with the cpufreq Linux kernel feature". Use with cpufreq-applet (part of the gnome-applets package).
Code:
Code:apt-get install preload
blueman: Gnome applet to control bluetooth.
Code:
Code:apt-get install cpufrequtils
sensors-applet: Display readings from hardware sensors in your Gnome panel.
Code:
Code:apt-get install blueman
Laptop Mode Tools "is a laptop power saving package for Linux systems. It allows you to extend the battery life of your laptop, in several ways. It is the primary way to enable the Laptop Mode feature of the Linux kernel, which lets your hard drive spin down. In addition, it allows you to tweak a number of other power-related settings using a simple configuration file."
Code:
Code:apt-get install sensors-applet
Resources:
Code:
Code:apt-get install laptop-mode-tools
http://wiki.debian.org/MacBook
https://help.ubuntu.com/community/MacBookPro5-5/Jaunty
https://help.ubuntu.com/community/MacBookPro5-5/Karmic
Wireless:
http://www.broadcom.com/support/802.11/linux_sta.php
Sound:
http://ubuntuforums.org/showthread.p...17#post7627817
Touchpad click and drag:
https://bugs.edge.launchpad.net/mact...rt/+bug/356317
Keyboard backlight (manual control):
https://bugs.launchpad.net/ubuntu/+s...945/comments/3
LCD backlight:
http://lists.alioth.debian.org/piper...09-October.txt (this patch is included in pommed 1.29).
http://ubuntuforums.org/showpost.php...1&postcount=13
NVIDIA drivers:
http://www.nvnews.net/vbulletin/showthread.php?t=122606
Disassembly (teardown):
http://www.ifixit.com/Teardown/MacBo...-Unibody/814/1
Building the latest rc kernel
THIS IS VERY OLD - for reference only.
Problems upgrading DKMS packages
Code:
Code:cd /usr/src
wget http://www.kernel.org/pub/linux/kern...32-rc7.tar.bz2
tar jxvf linux-2.6.32-rc7.tar.bz2
cd linux-2.6.32-rc7
export CONCURRENCY_LEVEL=2
wget -O .config http://allurgroceries.com/mbp55/config-2.6.32-rc7
make oldconfig && make prepare
fakeroot make-kpkg clean
fakeroot make-kpkg --initrd kernel_image kernel_headers
sudo dpkg -i /usr/src/linux-image-2.6.32-rc7_2.6.32-rc7-10.00.Custom_amd64.deb /usr/src/linux-headers-2.6.32-rc7_2.6.32-rc7-10.00.Custom_amd64.deb
sudo update-grub
If you have trouble upgrading dkms packages with an error like 'bad config file' or similar, move the dkms files out of the way and reinstall the deb.
Example for nvidia-bl:
Example for bcm5974:
Code:
Code:mv /var/lib/dkms/nvidia_bl ~/nvidia_bl.old
Now reinstall the deb packages and there should be no errors.
Code:
Code:mv /var/lib/dkms/bcm5974 ~/bcm5974.old

