This page is about getting Ubuntu Edgy (6.10) working on my Macbook. It is the follow-up to the original page about Ubuntu Dapper on the Apple Macbook.
If you have any information that I could add to this page, please email me (( desrt at desrt dot ca )).
Even though sleep got fixed for Dapper, something in Edgy broke it again. You can, however, install the Feisty prerelease kernel on your system and then everything will work great.
It turns out that one does not need to do a full vbetool save/restore of the video BIOS. The only register of interest that is clobbered by the suspend/resume cycle is the backlight control register. See Launchpad #72287 for a temporary workaround to this problem.
If you want to use vbetool, you need to know that currently, on Macbooks this is broken. This is caused by a mistake: the vbesave init script comes before the acpi init script. This means that laptop-detect will report to vbesave that you are not on a laptop and vbesave will not save your vbestate. Matthew Garrett is working on a fix, but in the mean time a workaround is to edit /usr/sbin/laptop-detect and insert a line 'exit 0' right after the #!/bin/sh (always report that we're a laptop).
The video chip in the Macbook is an Intel 945GM. This uses the i810 driver.
As per default, the card is incorrectly configured and won't let you use the native resolution of the LCD (1280x800). You need to download and use the 915resolution utility to correct this. A package is available in the universe repository.
apt-get install 915resolution
Due to recent changes in the 915resolution package the native panel resolution is now detected via 'vbetool' and you no longer need to modify the 915resolution config. Thanks to Joel Stanley for pointing this out.
When you reboot your Macbook the display should be working properly.
Not supported in Dapper as per default, so I reverse engineered the AppleIntelIntegratedFramebuffer.kext kernel extension and found the memory address of the register responsible for controlling it.
After experimenting with poking random values at it I wrote a program which controls it. This program is a temporary hack. I've also added support for macbook backlight control to HAL (patch awaiting upstream approval) since this is the proper fix. See Launchpad #72287 for more information.
You can download the C source for the program here: Macbook Backlight Control. You need to link against libpci with -lpci. Make sure you have pciutils-dev installed. If you want to use the old version that has the hard-coded video card address (and does not require libpci), it is still available in the same directory, called macbook-backlight-old.c.
If you intend to use the program as a normal user you'll have to install it setuid root as it needs access to /dev/mem to function.
note: this program does not work for macbook pro - only macbook.
update: The program now automatically detects the video card address via libpci.
Direct rendering Just Worked(tm). The integrated chipset seems to be beefy enough to do simple things like glxgears and the Flurry screensaver. AIGLX with beryl is running nicely but when I use it it makes me miss metacity -- so I don't.
In Edgy, sound just works.
In Edgy, wired ethernet just works.
The keyboard and the touchpad are both USB HID devices and work as well as you'd expect any generic USB device to work.
In Edgy, the 'fn' key on the keyboard works. By default, the F1 key will modify the screen brightness (and so on) and you have to press Fn+F1 in order to get F1.
If you prefer your F1 key to actually be F1, create a file in /etc/modprobe.d/ with the following content:
options usbhid pb_fnmode=2
Wireless works out of the box in Edgy. If you installed the Feisty kernel, however, you will be unhappy since the driver oopses on load. You should download and install madwifi from subversion. See Launchpad #76294.
If you're running a Macbook, the only closed source driver you need is madwifi. It makes a lot of sense to get rid of linux-restricted-modules entirely and just build your own (since this avoids all the cruft with the tmpfs and linking-at-bootup). You don't have to worry about violating the GPL since you're merely using the software (and not redistributing it like Ubuntu is).
WPA works out of the box. Install the network-manager-gnome package. It will make you happy.
The battery works just fine. I seem to get a bit more than 3 hours when running Linux (as opposed to Apple's advertised 6 hour theoretical max). You can improve battery life by unloading unused modules and by killing powernowd and setting your scaling_governor to 'powersave' or 'ondemand'. See Launchpad #13610.
Works fine, but make sure you use the regionset utility first. Also make sure that you've installed libdvdcss properly according to the instructions in RestrictedFormats.
The Macbooks ship with a version of the Apple firmware which includes a BIOS mode for booting legacy operating systems. Ubuntu boots fine under this mode. You need to use lilo, however as I'm told GRUB makes an unsupported BIOS call.
I am using a fantastic program called rEFIt. This program makes my life substantially easier and let me understand a bit more about how EFI works. Functionally, it serves as a easy (and attractive) way to select between Ubuntu and OSX on startup.
Works with the 3rd party appleir driver. The driver is a bit buggy, though. For example, if you point another (non-apple) remote at the receiver the driver will transmit a never-ending stream of the last button you pressed.
Just works. I gave a talk at linux.conf.au using this and was happy.
Not working by default, but not too hard to get working.
Download this linux-uvc package and extract it. You want the extract.c utility included inside. The driver itself is already included in the Feisty kernel.
Grab your iSight driver from your MacOS partition. You'll find it in /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport. As root, run 'extract' on this file and the firmware should be installed. The kernel driver will automatically notice the firmware has been loaded and will setup a v4l2 device for you to use.
If you fancy looking at yourself, give this gstreamer pipeline a go:
gst-launch-0.10 v4l2src use-fixed-fps=false ! ffmpegcolorspace ! ximagesink
Some sources on the net report that loading the firmware once is sufficient to always have it loaded in the future. As far as I can tell, this is not true. The firmware, for example, doesn't survive across a cold boot. The simple solution, of course, is to do firmware loading from a startup script or just do it whenever you need to use the camera (which is almost never for me).
Not working out of the box, but can be made to work with some work.
If you're using the Feisty kernel then the included version of the appletouch driver supports the touchpad in the Macbook. If you have Edgy kernel, you will need to patch it.
You need to ensure that the appletouch module is loaded before the usbhid module (since otherwise the trackpad will start up in legacy USB HID mode). You can create a file in /etc/modprobe.d/ containing the following line:
install usbhid /sbin/modprobe appletouch && sleep 2 && /sbin/modprobe --ignore-install usbhid $CMDLINE_OPTS
You then probably want to modify some settings for the Synaptics driver in your X config file.
See this page for more information about making your trackpad work.
If you want to use your keyboard to emulate additional mouse buttons you can use the following method:
Install the 'xkbset' package. Write a small shellscript like this one:
#!/bin/sh
xmodmap -e 'keycode 116 = Pointer_Button2'
xmodmap -e 'keycode 108 = Pointer_Button3'
xkbset m
Then run this script when your GNOME session starts. It will set the right meta and 'enter' keys to act as your middle and right mouse buttons, respectively. Of course, you can change the keycodes if you would prefer others.
If anyone is aware of a method to simplify this process (without using the kernel driver) then please let me know. I'm particularly interested in not enabling full-blown mousekeys mode and in not having to install a 3rd party utility.
I was able to use rEFIt to load ELILO. On start ELILO looks like it's doing nothing, then says 'Loading initrd.img...done' then locks up. I rebuilt ELILO (adding some debug output) and found out that the part where it seems to be doing nothing is actually the kernel being loaded. As near as I can tell, the only thing preventing this setup from working is that the kernel in Dapper doesn't support being booted on a Mac using EFI.
Matthew Garrett confirms this -- it appears that we can boot on iMacs but not on Macbooks. Nobody is really sure why right now.