Running Linux on an Apple Macbook 2,1

This page documents my attempts (and successes!) to get Linux fully working on an Intel-based Apple MacBook, 2007 model.

Note: I no longer have this device.

DISCLAIMER: This information is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. If you fry your system by using this information that’s _your_ problem. Not mine. I accept no responsability for what happens with this information whatsoever.

PCI Specs

00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:07.0 Performance counters: Intel Corporation Device 27a3 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
01:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)
02:00.0 Network controller: Atheros Communications Inc. AR5418 802.11abgn Wireless PCI Express Adapter (rev 01)
03:03.0 FireWire (IEEE 1394): Agere Systems FW323 (rev 61)

Here’s a detailed pci listing.

Linux 2.6.x kernel

The latest 2.6 kernel is: 2.6.39.4.
Here’s my 2.6.26 kernel configuration. This is actually the stock debian kernel.

USB

Hardware: this is the Intel Corporation 82801G (ICH7 Family) USB chip.

USB worked out of the box by loading the following modules:

  • usb-uhci (USB 1.x support)
  • ehci-hcd (USB 2 support)

It is required to install the udev package.

10/100/1000 MBit ethernet LAN

Hardware: this is a Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller chip.

Works out of the box, using the sky2 module.

Soundchip

Hardware: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller

Works out of the box with the ALSA module called snd_hda_intel module.

VGA Framebuffer console

Hardware: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller

Since the inception of kernel-mode-setting (KMS), no additional work is needed to get
a decent framebuffer console. Load the i915 module, and you’re set.

VGA X.Org

Hardware: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller

To make it working just set your video driver to intel:

		Section "Device"
			Identifier	"Generic Video Card"
			Driver		"intel"
		EndSection

With modern Xorg versions, you don’t even need to specify this anymore.

CDRW/DVDRW

Hardware: HL-DT-ST DVDRW GWA4080MA.

Works out of the box, using libata.

Bluetooth

Hardeware: Apple, Inc. Bluetooth HCI MacBookPro.

Works perfectly with the bluetooth and btusb modules.

Debian users might want to install the bluetooth package.

Harddisk

SATA drive. Works out of the box, if you enable the ata_piix module.

DMA is automagically enabled. I use hdparm to set an extra parameter: hdparm -F /dev/sda

Explanation:

  • -F: set security-freeze (so that nothing can accidentily lock your disk with a password)

For Debian; check the hdparm package.

Speedstep

You need this if you don’t want your CPU to eat your batteries empty. It’s included in the kernel config.

It works perfectly after loading the acpi_cpufreq and any of the cpufreq- modules.

You can either install the cpufreqd daemon, or use the cpufreq_ondemand module (which modulates the speed by requirement).

For Debian, check the cpufreqd or powernowd packages.

Wireless Lan

Hardware: Atheros Communications Inc. AR5418 802.11abgn Wireless PCI Express Adapter

Works out of the box with the ath9k kernel module.

Firewire

Hardware: Atheros Communications Inc. AR5418 802.11abgn Wireless PCI Express Adapter

This also works pretty much out of the box. The kernel module to use is ochi_1394.

Infrared

Currently not supported by the linux kernel. Possible patch: is here. Untested

Multimedia Keys

This laptop has several function keys which allow for the changing of the volume, brightness, …

After installation of pommed, these keys work perfectly.

Debian users can install the pommed and gpomme packages.

(Userspace) Software Suspend

Works: suspend to ram (s2ram). I’m using the following parameters: -f (force) -p (do VBE post) -m (save/restore VBE mode)

Doesn’t work: suspend to disk (s2disk,s2both): causes a full system freeze, need to dig into this further.

iSight webcam

Works with kernel supplied driver.

You need to extract the firmware first from the Mac OS X driver, use isight-firmware-tools. Debian users can use the isight-firmware-tools package.

Touchpad in console

You can use the touchpad with gpm, using the exps2 driver.

Touchpad in X.Org

This is an AppleTouch touchpad. You can use it with this driver.

Add the following to the /etc/X11/xorg.conf file:

Section "InputDevice"
        Identifier      "AppleTouch"
        Driver          "synaptics"
        Option          "AccelFactor"           "0.015"
        Option          "BottomEdge"            "310"
        Option          "Device"                "/dev/psaux"
        Option          "FingerHigh"            "30"
        Option          "FingerLow"             "20"
        Option          "HorizScrollDelta"      "0"
        Option          "LeftEdge"              "100"
        Option          "MaxDoubleTapTime"      "180"
        Option          "MaxSpeed"              "0.88"
        Option          "MaxTapMove"            "220"
        Option          "MaxTapTime"            "150"
        Option          "MinSpeed"              "0.79"
        Option          "Protocol"              "auto-dev"
        Option          "RightEdge"             "1120"
        Option          "SendCoreEvents"        "true"
        Option          "SHMConfig"             "on"
        Option          "TapButton2"            "3"
        Option          "TapButton3"            "2"
        Option          "TopEdge"               "50"
        Option          "VertScrollDelta"       "25"
        Option          "VertTwoFingerScroll"   "true"
EndSection

Here’s my complete xorg.conf file

It’s advisable to run syndaemon after starting X, to prevent accidental taps while you’re typing.
example: syndaemon -i 2 -t -d

Debian users can install the xserver-xorg-input-synaptics package.

Links

Nokia 3109c and Snow Leopard (iSync 3.1)…

As I detailed in my previous post on how to get this phone working with Leopard, upgrading to Mac OS X 10.6 aka Snow Leopard broke things again.

Easy fix though: follow the steps in my previous post, and attached to this post you can find the ‘fixed’ MetaClasses.plist file.

All I actually did was copy this block in the existing MetaClasses.plist:

<key>com.nokia.3109</key>
<dict>
<key>Identification</key>
<dict>
<key>com.apple.cgmi+cgmm</key>
<string>Nokia+Nokia 3109</string>
<key>com.apple.gmi+gmm</key>
<string>Nokia+Nokia 3109</string>
<key>com.apple.usb.vendorid-modelid</key>
<string>0x0421/0x045A</string>
</dict>
<key>InheritsFrom</key>
<array>
<string>family.com.nokia.series40.3rdEd.bus.usb-bt</string>
</array>
<key>Services</key>
<array>
<dict>
<key>ServiceName</key>
<string>com.apple.model</string>
<key>ServiceProperties</key>
<dict>
<key>ModelIcon</key>
<string>NOK3109.tiff</string>
<key>ModelName</key>
<string>3109</string>
</dict>
</dict>
<dict>
<key>ServiceName</key>
<string>com.apple.synchro</string>
<key>ServiceProperties</key>
<dict>
<key>MaxCityLength</key>
<integer>50</integer>
<key>MaxEMailLength</key>
<integer>60</integer>
<key>MaxEventLocationLength</key>
<integer>150</integer>
<key>MaxPhoneNumberLength</key>
<integer>48</integer>
<key>MaxPostalCodeLength</key>
<integer>50</integer>
<key>MaxStateLength</key>
<integer>50</integer>
<key>MaxStreetLength</key>
<integer>50</integer>
<key>MaxURLLength</key>
<integer>60</integer>
</dict>
</dict>
</array>
</dict>

Since WP keeps on braking my indentation, just download it here: MetaClasses.plist

Status update!

Short summary of what I’ve been busy with:

  • We’ve moved to a new place, near the city of Ghent. Lots of painting needed be done, decoration, stuff like that… kept me busy for the better part of two months. The results are viewable here.
  • We’ve also moved internet providers, since the all-in-one bundles (TV+Telephony+Internet) came out cheaper in the end. So I’m back at Telenet.
  • Friend from Spain came over during the Gentse Feesten. It’s a treat being able to go by bus to the centre of Ghent in 10ish minutes ;)
  • On a sadder note, one of our smoothcoat cavies, Macchiatto, passed away on july 20th.
  • I’ve managed to trash the linux installation on my macbook, and since I too lazy I put Mac OS X on it again. Said macbook also had to go in for repairs anyway (crack in the topcase). All fixed now, free of charge.

I think that’s about it. Mostly getting settled now in the new place… so far so good ;)

Linux on the Apple Macbook

I was bored recently, and decided to install Linux on my Macbook. I opted for the distribution I like best – Debian (unstable/Sid).

After some twiddling it all works rather well, I’m amazed how well ;) Even suspend to ram works flawlessly! (that was a different case a year ago, when I last had linux on a laptop). The only things I still have to get working is the framebuffer console (so I get something better than 80×25), and the infrared. Nothing very high on the agenda, though :)

I’ve detailed the installation instructions in this post.

Automounting SMB/CIFS shares on Mac OS X

For my PVR/HTMAC project, I wanted to auto-mount several shares from my NAS. After some searching I ran across this hint on the Mac OS X Hints website, which works perfectly:

Basically, you add the shares you want to mount to the /etc/fstab file, with this syntax:

excalibur:/music x url net,automounted,url==cifs://guest:@excalibur/music 0 0
excalibur:/photos x url net,automounted,url==cifs://guest:@excalibur/photos 0 0
excalibur:/videos x url net,automounted,url==cifs://guest:@excalibur/videos 0 0

That way, those shares will allways be mounted under /Network/Servers, and always available, starting boot-time. Works like a charm ;)

Mac mini PVR

I recently acquired a Mac Mini, which I’m going to use as a PVR.

Together with an Elgato EyeTV Hybrid it works perfectly, attached to my good old analogue 21″ Sony TV .

Sofar it seems to work fine, using a DVI-to-svideo convertor. I’ve installed the EyeTV software, the PyeTV Front Row plugin (which allows me to controle EyeTV from within Front Row) and Perian (for more codec support in Front Row)

More on this can be found on the Hicksdesign blog ;)

Iodine (dns tunnel) on your Mac (to escape those evil firewalls)

Here’s a short how-to to get the iodine dns tunnel working on your Mac.

In this short howto, I’ll assume you’ll be using a linux server to act as your gateway to the world. I’ll also assume you’ve read the iodine documentation and setup your DNS accordingly. For my example, I’ll be using a (nonexistant) DynDNS.org static DNS entry, iodine.rulestheworld.tld. I’ll also assume that you’ll be using a public internet address of 1.2.3.4, and a private subnet of 10.0.0.1.

  1. Install the tun/tap driver for Mac OS X. Easy as doing *click* *click* done! :p
  2. Next, install iodine on your Mac. Easy as download, extract, and typing make; make install
  3. Now, install iodine on your linux box. It’s included in the package repositories of the usual suspects, for instance debian: apt-get install iodine.

    Start it (or configure it to use) with:
    iodined -P <password> <unused private IP> <dns name>
    or in our example:
    iodined -P mypass 10.0.0.1 iodine.rulestheworld.tld

    This should return the following:

    Opened dns0
    Setting IP of dns0 to 10.0.0.1
    Setting MTU of dns0 to 1024
    Opened UDP socket
    Listening to dns for domain iodine.rulestheworld.tld

  4. Configure your linux box for IP forwarding: sysctl -e net.ipv4.ip_forward=1
    (and add this to your /etc/sysctl.conf file), and configuring your firewall (iptables) for masquerading:
    iptables -t nat -A POSTROUTING -s 10.0.0.0/255.255.255.0 -o eth0 -j MASQUERADE
  5. Next, download NStun.sh, a very handy script that does all the hard work of changing the routes and so on :p

    You’ll want to change the script: change the first lines as the script reads, and lower, change the

    NS=`grep nameserver /etc/resolv.conf|head -1|awk ‘{print $2}’`

    line to read

    NS=”62.213.207.197″

Now, start NStun.sh on your Mac, and surf away! (well, slowly, but freely, atleast!)

Nokia 3109c (Symbian S40) and iSync…

I got a company phone, a Nokia 3109 Classic, which is nothing less nothing more than a standard company phone. It doesn’t have all the bells and whistles I’d like to have, but it works.

What didn’t work, was iSync on this phone. Real bummer, since I was hoping to sync everything between iCal/Address Book and this phone…

Google to the rescue, and i stumbled over this blog posting by James Lloyd, detailing how to get it to work.

Summary:

  1. Download the script here
  2. Right click iSync from the Applications folder in Finder and choose “Show Package Contents”
  3. Navigate to: Contents\Plugins\ApplePhoneConduit.syncdevice\Contents\Plugins\Nokia-6131.phoneplugin and choose “Show Package Contents” again.
  4. Navigate to \Contents\Resources
  5. Replace the content of the MetaClasses.plist file with the content of the script downloaded in step 1
  6. (Re-)Setup your phone with your Mac

Done!

Mail.app tips & tricks

I still haven’t found any mail client I really like on the Mac… I’ve been using Thunderbird now for a while, but it doesn’t really have what I want in a mail client. I guess I’m spoiled, since I’m used to using KMail at home (and I’m forced to use Lotus Notes at work – a horrible client from a usability point of view).

Recently I’ve been trying to get Mail.app to work for me. It doesn’t have quite all the bells and whistles I like, but after looking up some things online it’s getting there.

Here are some handy things for Mail.app to fix some of it’s shortcomings:

  • Adding custom headers to outgoing mails:
    Type this in Terminal.app:
    defaults write com.apple.mail UserHeaders '{"Reply-To" = "[email protected]"; }'
    Ofcourse you can replace the header with what you want, I used this to send a BCC copy to myself of every mail sent out)
  • Adding multiple mail addresses (aliases) to one mail account:
    You can type them in the “Email Address” field, separated by comma’s.
  • “Go to next unread message”:
    Use something like Fastscripts with the following AppleScript (from Macscripter)

    tell application “Mail” to try
    tell message viewer 1 to set selected messages to {first message of beginning of (get selected mailboxes) whose read status is false}
    activate
    on error
    beep
    end try

What I still need:

  • A way to improve the threading – it’s horrible
  • An easy way to switch from mailbox to mailbox through all the ones with unread messages

Let’s see if I find some way to fix those two… especially the threading.