Recently I bought a white MacBook with a 2.0 GHz Intel Core Duo, 1 GB RAM and a 100 GB hard disk. It’s a good, and relatively cheap, computer and I can run Debian, Windows and Mac OS X.
On the Internet there is a lot of documentation about the MacBook and Linux, the best guides I read are:
- the MacBook page on the Debian wiki
- triple boot at OnMac.net
- Debian Etch on a MacBook HOWTO (triple-boot)
- the MacBook page on the Gentoo wiki
Here’s the steps I went through to get everything working.
Prepare the installation
Obviously you need a MacBook. I bought a white MacBook with a 2.0 GHz Intel Core Duo, 1 GB RAM and a 100 GB hard disk.
You need a full (not-upgrade) CD of Windows XP. I used Windows XP Pro with SP2.
Download and burn a Linux Installation CD, I used the daily netinst build of Debian.
Boot Camp is not needed to install Windows but it contains the drivers for it. Boot MacOS X, download and install Boot Camp. Now locate the Boot Camp Assistant icon in utilities, ctrl-click on it and select “Show package contents”. In the Finder window that opens, double click on “Contents”, then double click on “Resources”. Ctrl-click on the “diskimage.dmg” file and select “Open with”, then “Disk utility”. Burn the image file to create the driver cd.
rEFIt is used to boot the three operating systems, download it, double click on the file and use the following commands to install it:
sudo cp -r /Volumes/rEFIt/efi /efi cd /efi/refit ./enable.sh
Partition the disk
The disk must be splitted so you can install Linux and Windows. Open the terminal and use diskutil to partition the disk, the syntax of the command is:
sudo diskutil resizeVolume disk0s2 <macoxs size> "Linux" <name of linux volume> <linux size> "MS-DOS FAT32" <name of windows volume> <win size>
I used something like this:
sudo diskutil resizeVolume disk0s2 27G "Linux" Linux 35G "MS-DOS FAT32" Windows 30.8G
I chose to use FAT32 because it’s the only file system that can be read and written by Windows, Mac OS X and Linux. If you don’t need to share data between the different operating systems, NTFS is a better choice.
The problem with FAT32 is that you cannot format partitions bigger than 32GB with the Windows installer. The tools available under Mac OS X and Linux can format it but it will not be usable by Windows. You can try to format the Windows partition using the fat32format program from a boot CD created with PE builder.
Insert the Windows XP CD and restart. Hold down the C key to boot from CD and install Windows as usual. Remember to choose the last partition as the target. When Windows if fully installed use the Boot Camp drivers CD you created to install the required software.
Insert the Debian CD and restart. Hold down the C key to boot from CD. The kernel I used was crashing, so I followed the instructions in the Debian wiki, inserting “install noapic irqpoll acpi=force” at the boot prompt.
When you need to select where to install Linux, format the empty partition as ext3 and use “/” as mount point. When the installer warns you that you don’t have a swap partition just press “Continue”, a swap file will be created later.
Continue the installation until you reach the “Install the GRUB boot loader on a hard disk” step. GRUB does not work, so we need to install LILO:
- switch to the second console by pressing CTRL-ALT-F2
- press return to start the shell and enter:
chroot /target apt-get install refit /target/sbin/gptsync /dev/sda
- press “y” to accept the changes
- switch back to the first console by pressing CTRL-ALT-F1
- select “Go back”
- choose “Install the LILO boot loader on a hard disk” from the main menu
- choose “/dev/sda3” as installation target
Now your system is ready but it needs some more configuration.
Swap and mount points
During the installation you didn’t create a swap partition, so you can create a swap file now:
dd if=/dev/zero of=/swap bs=1024 count=1048576 mkswap /swap swapon /swap chmod 600 /swap
Modify “/etc/fstab” to always use the swap file just created, and to mount the Windows and Mac OS X partition:
/dev/sda4 /win vfat defaults,umask=000 0 0 /dev/sda2 /mac hfsplus ro 0 0 /swap none swap sw 0 0
Create the mount points:
mkdir /win mkdir /mac
Configure X11 for your video driver as explained on the wiki but removing the “Modeline”, “HorizSync” and “VertRefresh” lines from the “Monitor” section of the “/etc/X11/xorg.conf” file. Your “Device” section for the video card shoul be:
Section "Device" Identifier "Generic video card" Driver "i810" Screen 0 BusID "PCI:0:2:0" EndSection
Now you need to change the layout of your keyboard as you prefer, I created an executable file with the following content (it requires the xkbset package):
#! /bin/sh # Without the sleep, xbkset sometimes fails. sleep 5 xmodmap - << EOF ! "<" and "" are swapped, at least using the Italian layout ! for the keyboard. keycode 49 = less greater keycode 94 = backslash bar ! Small enter is used for right mouse click. keycode 108 = Pointer_Button3 ! Eject is used as del. keycode 204 = Delete EOF xkbset m
This script should be launched on every login, so add it to the list of programs executed by gnome-session using the gnome-session-properties program.
If you want to use the right Apple key as ALT GR modify the “/etc/X11/xorg.conf” file adding the following line to the “InutDevice” section for the keyboard:
Option "XkbOptions" "lv3:rwin_switch"
By default the “fn” key is always on for function keys, that is if you want to press “F1” you have to press “fn” + “F1”. If you prefer the normal behavior add to “/etc/rc.local” this line before the “exit 0” command:
echo -n 0x02 > /sys/module/usbhid/parameters/pb_fnmode
The touchpad works, but only as a simple pointing device with a single mouse button. If you want two-finger scrolling, right click, and other advanced features you need the appletouch kernel module, so X11 can use the synaptics driver for the touchpad. For more information see the MacBook Pro wiki page.