Macbook Pro (3,1) FreeBSD



Apple MacBook Pro model 3,1 on FreeBSD (UPDATED 18/07/09)


Installation (FreeBSB 7.1/i386).

o I've first tried to install FreeBSD with the 7.1 dvd on a slice made by bootcamp. Unfortunely the fdisk utility has broke all the partitions (make backups!). Then I've reinstalled Mac OS X, and used the 7.0 cd to install a minimal FreeBSD. That worked.

FreeBSD 7.0 does not seem very stable, I've copied the kernel and modules from the 7.1 dvd and restart the box (under a 7.1 kernel and a 7.0 world so). After this, csup of the sources (RELENG_7) and make buildworld + make buildkernel + make installkernel and make installworld as usual. I use the stock GENERIC kernel. (Nb: You will need 7.1 to use the msk0 interface)

o Keyboard (for a french keyboard)
rc.conf(5):
keymap="fr.macbook.acc"

UPDATE (17/04/09) :
I've made a custom keymap to avoid the inversion of the "@" key and the "<" key :
fr.macbookpro.acc.kbd

o Sound
My Macbook uses a HDA sound chipset.
pciconf(8):
hdac0@pci0:0:27:0:      class=0x040300 card=0x00a0106b chip=0x284b8086 rev=0x03
hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H &SUBSYS_81EC1043&REV_02\3&11583659&0&D8'
    class      = multimedia
    subclass   = HDA

It works with the snd_hda(4) driver, but with the version of the driver in FreeBSD-Current (at the moment, until it will be MFCed).
Just copy the /sys/dev/sound/pci/hda directory from FreeBSD-Current to your source tree and rebuild the module.
I use the version "$FreeBSD: src/sys/dev/sound/pci/hda/hdac.c,v 1.94 2009/01/31 08:24:09 mav Exp $"

UPDATE (17/04/09) : snd_hda(4) in 7.2-PRERELEASE is ok

Also we must add some quirks:
/boot/device.hints
hint.hdac.0.config="gpio0 ovref"
hint.hdac.0.cad0.nid21.config="as=4 seq=15"

Internal speakers, headphones and the internal microphone work fine. I've not tested the line-in jack.

o Network
Works out of the box with the driver msk(4)

o Wifi.
Does not work, I have to use the ndis wrapper.
The Windows driver is on the first Mac OS X installation DVD. It is a rar executable, so we can use the unrar utility (in ports) to extract the files.
It looks to work quite fine, but at shutdown a panic related to ndis occurs often. A trick is to kldunload the module just before.
/etc/rc.shutdown:
...
# Insert other shutdown procedures here
kldunload ar5416_sys

(I'm sure there is a better way to do this, and I shall fill a "problem report" for these panics)

UPDATE (17/04/09):
- There is a problem using ndis with powerd, the machine seems to hang.
This is because the frequency of the cpu drops to low, a work-around is to limit the low frequency with the sysctl
debug.cpufreq.lowest=600 (the machine hangs below 400 MHz)

- ath(4) in 7.2-PRERELEASE now attach to the device, but is not stable.
I'm able to use WPA but after a moment, I've got some errors:
ath0: ath_chan_set: unable to reset channel 10 (2457 Mhz, flags 0x480 hal flags 0xc0), hal status 14
ath0: unable to reset hardware; hal status 0
...
UPDATE (18/07/09):
- ath(4) seems to work with 8.0-BETA1, that's cool!

o Screen backlight.

The level of the backlight of the screen is very very high. I've made a small driver to be able to set it with a
sysctl "hw.ambnb.level" (0 <= level <= 15)

This driver should work on Apple MacBook Pro Model 3,1, model  3,2  and model 4,2.
(I've tested only on my MacBook Pro model 3,1. Let me know how it works for you).

ambnb (Apple MacBook Nvidia Backlight): ambnb (18/07/09 - fix build on 8.0)

o Xorg.

With Xorg 7.4, the keyboard does not work at all if HAL is enabled. I've built Xorg without HAL.
The free driver 'nv' works fine and the nvidia driver too. The nv driver is quite slow and I use the nvidia driver (3D works fine with it).

UPDATE (17/04/09):
xorg.conf:
Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option "XkbRules"   "xorg"
    Option "XkbModel"   "macbook78"
    Option "XkbLayout"  "fr"
EndSection

Use xmodmap(1) to adjust the key '@' and '<':
$HOME/.xmodmaprc
! Mac
keycode 49 = less greater less greater
keycode 94 = at numbersign at numbersign

o DVD.

Works fine (read and write).

o TODO

The backlight of the keyboard does not work, and only one button of the touchpad works. You will need a mouse.
UPDATE (18/07/09):
- keyboard's backlight works with asmc(4) on 8.0. It works too on 7.2 (get the files from 8.0)

The internal webcam does not work too, and of course suspend/resume.

I have to try the remote IR and the Apple stufft found on the FreeBSD wiki:
http://wiki.freebsd.org/AppleMacbook

o CONCLUSION
The support is not perfect, but it could be worse and the machine is powerful and stable.

verbose dmesg

E-mail : "Patrick Lamaizière" <patrick (dot) softs (at) lamaiziere (dot) net>
17/04/2009