How to install Ubuntu Gutsy on a MacBook 3,1 generation

My new Ubuntu DesktopI recently bought a wonderful Apple Macbook last generation (Santarosa 3,1) but when I tried to run my best Linux distribution (Ubuntu 7.10 Gutsy Gibbon) I ran into a lot of problems. Almost everything doesn’t work out-of-the-box so I looked at wiki, documentation and Google to find out how to arrange them.
This is my personal guide to install Ubuntu Gutsy and work with all the hardware of the Macbook in Linux, try it at your own risk 🙂

I don’t care about how to double or triple boot your Macbook, it is just documented in a lot of sites, you can refer to the Ubuntu wiki to how to use rEFIt to double boot Mac OS X and Linux.

This guide is for an Ubuntu Gutsy Gibbon 32 bit installation. I know this Macbook have a 64 bit cpu but I still prefer a 32 bit installation then 64. Why? Because the 32 bit software is better supported and the performance aren’t so different.

If you would like to follow a “semi-official ” Ubuntu way to install your Macbook Santa Rosa with Ubuntu 7.10 (and 8.04 Hardy Heron – 8.10 Intrepid Ibex) please read the Macbook Santa Rosa HOW-TO on Ubuntu community site.

Apple Macbook 3,1 GenerationMacBook technical specifications:

CPU: Intel Core 2 Duo 2,2 GHz
Ram: 2GB
GPU: Intel Graphics Media Accelerator X3100
CD/DVD: 8x slot-loading SuperDrive (DVD±R DL/DVD±RW/CD-RW)

The Hardware:

$ lspci
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)
00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
00:1f.2 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA IDE Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
02:00.0 Network controller: Broadcom Corporation BCM4328 802.11a/b/g/n (rev 03)
03:00.0 Ethernet controller: Marvell Technology Group Ltd. Marvell Yukon 88E8058 PCI-E Gigabit Ethernet Controller (rev 13)
04:03.0 FireWire (IEEE 1394): Agere Systems FW323 (rev 61)

Kernel:

In order to work your kernel needs to be patched with a lot of patches, I know it is frustrating but today there aren’t other method to run your Macbook 3,1 with Ubuntu and with all the hardware present.

sudo aptitude install linux-source-2.6.22 build-essential bin86 kernel-package libqt3-headers libqt3-mt-dev libncurses5 libncurses5-dev subversion
cd /usr/src
sudo tar xjvf linux-source-2.6.22.tar.bz2
sudo ln -s linux-source-2.6.22 linux

Now you need to apply some patches:

sudo svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux/trunk/kernel/mactel-patches-2.6.22

cd /usr/src/mactel-patches-2.6.22
sudo ./apply /usr/src/linux

cd /usr/src/linux
sudo wget http://launchpadlibrarian.net/10335284/appletouch-add-macbook3-trackpad.patch

sudo wget http://launchpadlibrarian.net/10540630/hid-add-new-apple-keyboard.patch
sudo wget http://follefuder.org/appleir2622.patch.txt.tar.bz2
sudo tar xjvf
appleir2622.patch.txt.tar.bz2

sudo patch -p1 < appletouch-add-macbook3-trackpad.patch
sudo patch -p1 <
hid-add-new-apple-keyboard.patch
sudo patch -p1 <
appleir2622.patch.txt

Ok now we are ready to compile the new kernel and headers:

cd /usr/src/linux
sudo cp /boot/config-2.6.22-14-generic .config
sudo make oldconfig
sudo make menuconfig

Now go to the Processor type and select Core2duo then go to device drivers -> Sound and mark the Intel HDA module. Save the new config and exit.

sudo make-kpkg clean
sudo make-kpkg -initrd kernel_image kernel_headers modules_image

Wait until the kernel’s packages are ready then install them:

cd ..
sudo dpkg -i linux-image-2.6.22.9*.Custom_i386.deb
sudo dpkg -i linux-headers-2.6.22.9*.Custom_i386.deb

Now you have your kernel patched installed you can reboot to try it but if you are impatient or you have problem to build your own kernel as described here, download and install the packages I compiled for me:

cd /usr/src/
sudo wget https://www.michelem.org/wp-content/ubuntu/linux-image-2.6.22.9_2.6.22.9-10.00.Custom_i386.deb
sudo wget https://www.michelem.org/wp-content/ubuntu/linux-headers-2.6.22.9_2.6.22.9-10.00.Custom_i386.deb

sudo dpkg -i linux-image-2.6.22.9*.Custom_i386.deb
sudo dpkg -i linux-headers-2.6.22.9*.Custom_i386.deb

Reboot.
When you are logged into your Ubuntu with the new kernel installed you are ready to continue with this guide to install the rest of the hardware.

Wireless:

Wireless is a BCM4328, it works only with ndiswrapper, unfortunately due to the new kernel you have to compile the ndiswrapper package too:

cd /usr/src
sudo mkdir bcm4328
cd bcm4328
sudo wget http://kent.dl.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-1.50.tar.gz
sudo tar xzvf
ndiswrapper-1.50.tar.gz
cd
ndiswrapper-1.50
sudo make uninstall
sudo make
sudo make install

Now we can install the bcm4328 drivers:

wget http://download297.mediafire.com/czzdjrxtjejg/exuymodkstx/bcm4328.zip
unzip bcm4328.zip

sudo ndiswrapper -i bcmwl5.inf
ndiswrapper -l
sudo depmod -a
sudo modprobe ndiswrapper

Sound/Audio

The audio driver is an Intel HDA 82801H, but it doesn’t work out-of-the-box with our Macbook 3,1 because we need the latest alsa packages, so let’s go to compile them too:

cd /usr/src
sudo mkdir alsa
sudo rsync -avz --delete rsync://alsa.alsa-project.org/hg/alsa-driver alsa
sudo rsync -avz --delete rsync://alsa.alsa-project.org/hg/alsa-kernel alsa
cd alsa/alsa-driver
sudo ./hgcompile --with-cards=hda-intel
sudo make
sudo make install
sudo /etc/init.d/alsasound stop


sudo vi /etc/modprobe.d/alsa-base
Append this line:
options snd-hda-intel model=mbp3

sudo modprobe snd-hda-intel

May be you have to reboot your system.
Warning because the master mixer is disabled by default so right click on the volume applet and click on “Open Volume Control”. Enable the master mixer and test your sound.

Apple Touchpad:

In order to be able to use full functions of the Apple Touchpad you need to change your Synaptics Xorg configuration with this:

Section "InputDevice"
# updated 2007-12-07
# use command "synclient -m 1" to see raw output
# common stuff
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"

# not using edge scrolling
Option "HorizEdgeScroll" "0"
Option "VertEdgeScroll" "0"


# use two finger scrolling
Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "1"

# scroll speed, lower is faster
Option "HorizScrollDelta" "10"
Option "VertScrollDelta" "10"

# minimum pressure motion factor
Option "PressureMotionMinZ" "10"

# touch and untouch thresholds, higher numbers if you like to push hard
Option "FingerLow" "10"
Option "FingerHigh" "20" # change to 30 or 40 if like

# borders based on output from synclient
Option "LeftEdge" "20"
Option "RightEdge" "1200"
Option "TopEdge" "20"
Option "BottomEdge" "3
70″

# speeds, smaller number for a slower mouse
Option "MinSpeed" "0.8" # 0.5 is very slow, 1.5 is very fast
Option "MaxSpeed" "1.2" # up to 1.5 works ok
Option "AccelFactor" "0.10"

# tap times, change to suit your tapping habits
Option "MaxTapMove" "100"
Option "MaxTapTime" "100"
Option "MaxDoubleTapTime" "20
0″

# don't change these or two finger tap stops working
Option "TapButton2" "3"
Option "TapButton3" "2"

# must be commented out or normal tapping wont work
#Option "TapButton1" "0"

# needed for disabled while typing fix
Option "SHMConfig" "on"
EndSection

Make sure you have the Synaptics Touchpad string before any other mouse configured in the server layout like this:

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Synaptics Touchpad"
InputDevice "Configured Mouse" "SendCoreEvents"
EndSection

This is my full xorg.conf

iSight webcam:

Following the Étienne Bersac howto Built-in iSight Firmware Tools it will work without any problem.

Backlight brightness:

You have to install the xbacklight and it will work great:

sudo aptitude install xbacklight

Video:

The graphic card is an Intel GM965 (X3100) it works out-of-the-box with the latest intel video drivers, but this driver is actually blacklisted in Compiz, so if you try to enable Compiz Fusion your Macbook will refuse it due to lack of XV support when using XAA.
I solved it commenting out the blacklist and using the noxv with gstreamer:

sudo vi /usr/bin/compiz

Comment out the line 60 ( T=”$T 8086:2982 8086:2992 8086:29a2 8086:2a02 8086:2a12″ # intel 965)

Now launch the “gstreamer-properties” command from a terminal, go to the Video tab and select “X Window System (No Xv)” as Default Output.

This will permit you to watch your videos and use Compiz togheter, but you will use more CPU processor then GPU.

Suspend/Hibernation:

I didn’t test it with the Ubuntu official kernel but with this patched kernel they work very fine!

Functions keys:

If your functions keys don’t work fine, volume controls, brightness etc.. You should install pommed:

sudo aptitude install pommed

This should arrange them.

CD/DVD read & write:

It works out-of-the-box, I suggest you to install the best cd/dvd recording software Brasero:

sudo aptitude install brasero

Apple IR Remote:

It should be works with the patch you downloaded and inserted before in the kernel. If you would like to associate keys with events on main video softwares follow the MacBookPRO wiki page at Ubuntu.com (section Apple Remote Control)

Enjoy your new Apple Macbook with your Ubuntu Linux!

Special thanks to the following links authors:

Buying a new MacBook? Think twice…
MacBook on Ubuntu Community help
MacBook PRO on Ubuntu Wiki
MacBook PRO SantaRosa on Ubuntu Wiki
MacBook SantaRosa on Ubuntu Community help





Leave a Comment