Triple boot  on a MacBook Pro 5,5

Fedora 12 aka "Constantine", OpenBSD -current and MacOSX 10.6
or...
"How to spend a week trying to employ an emetic, unusable OS and then desperately look
for something sensible for your shiny, showy, inutile apple laptop to do real work"




I am assuming that initially you only had MacOSX on the machine, that you made room for the other OS's and that you know some very basic fundamentals of UNIX (otherwise you would not be reading this, right?).

0- Check out what your system actually is from the fedora live cd
# dmidecode -s system-product-name
MacBookPro5,5
1- Make place in the hard drive (SSD)

This is my drive:
Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
These are my partitions:
# parted -l
Model: ATA APPLE SSD TS256A (scsi)
Disk /dev/sda: 251GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size    File system     Name                  Flags
 1      20.5kB  210MB  210MB   fat32           EFI System Partition  boot
 2      210MB   100GB  99.9GB  hfs+            
 3      100GB   100GB  107MB   ext4                                  boot
 6      100GB   216GB  116GB
 5      216GB   225GB  8390MB  linux-swap(v1)
 4      225GB   251GB  26.2GB                                      

2- Grab a live Fedora CD. I am obviously using 12 for this example

3- Install it the way you want it. I am using separate /boot,  and / (encrypted with LUKS) partitions and swap, of course

4- Make sure grub is installed in the /boot partition (fedora finds it out but check)

5- Reboot into MacOSX

6- Install the latest rEFIt dmg (0.13 as of this writing)

7- Reboot and go into the rEFIt "partition editor" and let the thing "fix" your partition tables (fdisk sucks and is buggy, as usual)

8- A bit of stupid magic is needed here: Once you have done that, and from the rEFIt menu, shutdown the laptop. This is crucial. Otherwise you will spend hours trying to understand why your fedora does not boot

9- Fix the Fedora on the mac (as you expected, not everything is working) : Note: "#" is root, "$" is user

9.1- Wireless needs rpmfusion : grab the rpm and keys from their web page and then run
# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm\
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
# yum update
# yum install kmod-wl
9.2- Camera is working "out of the box". If not, it needs the firmware extractor and patcher and the AppleUSBVideoSupport driver, which got from MacOSX 10.6 install DVD. I found it with... "find":
/Volumes/Mac OS X Install DVD/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport 
After you got it:
# yum install isight-firmware-tools
# ift-extract --apple-driver AppleUSBVideoSupport
9.3- Keyboard backlight is working fine,
# echo 255 | sudo tee -a /sys/class/leds/smc::kbd_backlight/brightness 
sets it to the maximum and 0 to the minimum (default).
If you are a GNOME user (I am using cwm but for linux... sigh) you probably want to set up a script like
#!/bin/sh

BACKLIGHT=$(cat /sys/class/leds/smc::kbd_backlight/brightness)
BACKLIGHT=$(zenity \
--title "Keyboard backlight" \
--scale \
--text="Adjust the keyboard backlight" \
--value="$BACKLIGHT" \
--min-value="0" \
--max-value="255")
echo $BACKLIGHT | tee -a /sys/class/leds/smc::kbd_backlight/brightness
exit 0
And then make a shortcut in the panel or whatever you call it. This will fire a gtk application. Obviously,
brightness
needs to have the correct rights for the users to modify it.

Another option is to launch it with gksudo but, for that, on fedora you need to comment out the line which has 'requiretty' on it in the /etc/sudoers file

9.4- Remote control - The model I have, A1294, seems to not be supported, though others have reported it to work (but different "distro" etc)

9.5- Sound is not working well, only with the headsets, micro is (how do I know? find out by yourself). You can make it work with your headphones by running
$ gstreamer-properties  
Set the output devices to PulseAudio.

As for the speakers, make sure that everything is unmuted:
$ alsamixer -c 0
or
$ alsamixer -D hw:0
or
$ alsaunmute
If nothing of this works for the speakers, first of all run "yum update" and applied all the system-updates before continuing.

a) Install the Jack Audio Connection Kit:
# yum install alsa-plugins-pulseaudio pulseaudio pulseaudio-module-jack alsa-plugins-jack jack-audio-connection-kit tuned
b) Add your user-id to the proper audio groups:
# usermod -aG jackuser,audio YourUsernameHere
Then reboot... This will allow you to have perfect sound with the headphones, but not on the speakers

If you are stubborn and want to try to make the speakers work, you can try the following, but in my case this didn't work _and_ it broke sound with the headphones:
# cp /etc/pulse/default.pa /etc/pulse/default.pa.old
And edit it in line 53;
# vi +53 /etc/pulse/default.pa
And then
:s/load-module module-udev-detect/load-module module-udev-detect tsched=0 ENTER
Save and quit... then
# cp /etc/pulse/daemon.conf /etc/pulse/daemon.conf.old
# vi +80 /etc/pulse/daemon.conf
Change the values to
default-fragments = 8
default-fragment-size-msec = 5
Now you will have to create a ~/.asoundrc file
$ touch ~/.asoundrc
$ echo "pcm.pulse { type pulse }" >> ~/.asoundrc ; echo "ctl.pulse { type pulse }" >> ~/.asoundrc
We'll have to install now a bunch of things:
# yum install pavucontrol pavumeter paman padevchooser paprefs 
alsa-plugins-pulseaudio gstreamer-plugins-pulse pulseaudio
pulseaudio-core-libs pulseaudio-esound-compat pulseaudio-libs
pulseaudio-libs-glib2 pulseaudio-libs-zeroconf pulseaudio-module-gconf
pulseaudio-module-x11 pulseaudio-module-zeroconf pulseaudio-utils
xine-lib-pulseaudio xmms-pulse
Make sure pulse is your default:
Applications > Sound and Video > Pulseaudio Device Chooser
And then reboot... good luck...

9.6- ACPI is a weak point:

Suspend and resume is working sometimes (welcome to the wonderful world of chaotic linux!): it seems to break randomly after updating.... You may consider installing s2ram:
# yum install wget
# wget -c "http://prdownloads.sourceforge.net/suspend/suspend-0.8.tar.gz?download"
# yum install gcc
# yum install pciutils-devel.i686
# yum install libx86-devel.i686
# tar xvfz suspend-0.8.tar.gz -C /tmp
# cd /tmp/suspend-0.8
# ./configure
# make install
This will install s2ram in your system.

If you do not want to freeze your laptop, add this option to the kernel line of /boot/grub/menu.lst :
resume=/dev/sda4 
Where obviously sda4 is your swap partition.
# s2ram --force
If it works well for you, change the gnome applet to use s2ram (if you're a gnome user, of course).

For that, you have to create the file
# touch /etc/pm/config.d/config
and then add the line
2RAM_OPTS="-f"
to it. Have a look at http://en.opensuse.org/Pm-utils#Configuration.

This will allow you to cleanly suspend and resume but from the menu. If you close the lid the system will freeze.
This is bad and I do not know the reason why.

Battery life sucks enomously. Have a look at the estimate of
# powertop -d
The module coretemp should help a little bit, though,
# modprobe coretemp
It's up to you to decide whether you want to make this permanent or not.

And you can tweak a bit your xorg.conf after having generated it, of course. But watch out. This is experimental and can leave you with a broken X. Since you cannot kill X with the usual, good combination of CTRL + ALT + BACKSPACE, you will have to then reboot with the live cd, mount the FS and remove the xorg.conf file.

If you still feel like playing, first you will need xorg.conf: Since linux has decided that GUI should rule the world, the usual X -configure will not work here, you will have to do a bit of work :
 # yum install system-config-display
And then create the file:
 # system-config-display --noui
Once you have it, add the following to the section Device:
Option "OnDemandVBlankInterrupts" "True"
Option "RegistryDwords" "PowerMizerLevel=0x3"
and this to Screen
Option     "Coolbits" "1"
You'll then need to add this to the kernel line in conf.list of grub (which thanks God is not grub2, a point for fedora)
usbcore.autosuspend=1 hpet=force

9.7- Touch pad: click and drag : You will need dkms and bcm5974, provided by xorg-x11-drv-synaptics
# yum install dkms.noarch
# yum install xorg-x11-drv-synaptics.i686
# modprobe -r bcm5974
# modprobe bcm5974

10- Congratulations!

At this point you have a rather functional OS in which you can install software without doing a juggling... Gosh, just for the installation matplotlib on MacOSX I needed something like 2 days! It's insane... not to speak of the emetic MacOSX "features". I got seasick by looking at those wobbling and "cool" effects... I wonder how people can do real work on that OS.

yum install -y vim zsh gcc a2ps pstoedit subversion git psutils

yum install -y py-matplotlib xfig inkscape gnuplot grace maxima g3data

yum install -y gparted aspell mutt qiv openoffice.org-writer openoffice.org-impress pidgin 

yum clean
11- Note I have noticed that fedora seems to break randomly after rebooting the laptop. Sometimes the wireless stopped working, sometimes suspend etc... Then I realised that those problems vanished when I ran the stupid magic bits (see point 8). I think that this is related to rEFIt being a bogus... if this persists in the end I will simply delete the whole MacOSX and get fedora's grub installed in the MBR of the drive.

12- Install OpenBSD by following the steps of this very nice page... but set the partition to a6 with setpid in the installation instead of linux (which was what I used in that page), because gnu fdisk knows shit about GUID Partition Tables and parted seems not to be able to do the job (correct me if I'm wrong, please)

http://www.aei.mpg.de/~pau/zen_process_obsd.html

Unfortunately, OpenBSD seems to not be able to run X with the nv driver (NVIDIA)... you must run vesa to get X working; this is due to Open's using xenocara. I do not blame them at all... you cannot code correctly in a rush. And supporting this laptop sure needs rush software.

In any case, for OpenBSD to boot you must skip the stupid magic of point 8. Otherwise stoopid rEFIt will mess the partition table and assign vfat to OpenBSD and boot.conf will not understand anything (obviously).
Legal notice