This is documented in other places, but some of the information is distributed across two or more sites, including information explaining why things have to be done this way. This article strives to consolidate the information in a way that creates enhanced understanding of Intel’s EFI and its role in the boot process of Apple’s computers. Much of this information is portable to other EFI platforms as well.
Overview: Boot Camp and Intel EFI
To better see how booting an arbitrary number of operating systems on a Mac is done, a quick review of what Apple’s Boot Camp product does is useful.
Apple’s Intel-based systems use Intel EFI (Extensible Firmware Architecture) rather than the old style PC BIOS. EFI is a significant improvement as it no longer requires 16-bit bootstrap code and a processor mode switch during the early stages of the boot process. As an extensible architecture it also allows pre-boot software to be added to the system, extending its manageability. In addition to these features, Intel provides a BIOS compatibility mode so that non-EFI aware operating systems can boot on EFI-based computers.
Intel EFI replaces the standard BIOS ‘Master Boot Record’ partition table with ‘GUID Partition Table’ or GPT. Among other things, GPT features the ability to create an unlimited number of disk partitions rather than the ‘4 primary + extended’ workaround employed by MBR. It also features the ability to host an MBR partition map within it, allowing legacy operating systems to coexist on the same drive with EFI-aware ones.
Initially, Apple did not ship BIOS compatibility mode in its EFI firmware. “Boot Camp” is an umbrella covering the introduction of BIOS compatibility mode, OEM drivers for Windows XP/Vista as provided by them, and a setup wizard allowing the user to partition their disk to boot Windows.
Quirks and caveats
Several behaviors arise when EFI-aware and legacy BIOS-aware operating systems coexist on the same system.
- A hybrid GPT/MBR partition table can only contain 4 partitions, and does not support MBR extended/logical partitions.
- The first partition must be reserved for EFI use, formatted as FAT32 with a size of 200MB. This partition cannot be removed.
- Windows cannot tolerate being on any partition but the very last in the hybrid partition table. The reason for this is, as yet, unknown but lies in some interaction between the NT boot loader and its interaction with the partition scheme.
- You must not edit the partition table within a legacy OS. The changes will not be synchronized with the GPT partition table and may render all legacy OSes unbootable.
How-To Do It
In order to triple boot you cannot use the Boot Camp Assistant at all, as it will want to create space for only two operating systems. Instead, use the command line utility ‘diskutil’. This is the equivalent of the ‘fdisk’ program under other operating systems, and also has the ability to grow, shrink, and reformat filesystems and supports command stacking.
If a copy of the Macintosh drivers for Windows is not burned to CD, you don’t need to use the boot camp assistant to create this either. Right-click the Boot Camp Assistant application icon and choose ‘show package contents’. Within the resources folder in the window that appears, you’ll find the driver CD residing there as a *.dmg file. Use disk utility to burn this to a CD.
It is also useful to install the rEFIt bootloader, which labels the bootable partitions in a simpler, more visually identifiable way. This can be obtained at http://refit.sourceforge.net/. Simply running the installation wizard will install the bootloader.
Armed with the above EFI/GPT knowledge, a Mac will arrive on the desk with 2 partitions, a 200MB EFI and a MacOS partition consuming the remainder of the disk. The MacOS partition will need to be shrunk down, creating free space in which Linux and Windows will reside. Simultaneously, we’ll build the hybrid partition map and create the two partitions for Linux/Windows.
$ diskutil list
#: type name size identifier
0: GUID_partition_scheme *111.8 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS Macintosh HD 111.6 GB disk0s2
diskutil resizeVolume [disk identifier] [disk size] [partition type] ["Partition label"] [partition size] [partition type] ["Partition label"] [partition size]
Using the above example, say we want to drop the size of the Mac partition by 30GB and create two 15GB partitions for Linux and Windows. The command will be as follows:
sudo diskutil resizeVolume disk0s2 81G "Linux" "Ubuntu Linux" 17G "MS-DOS FAT32" "Windows XP" 15G
Note that the ‘MS-DOS FAT32’ partition type does not infer that FAT32 is required. An NTFS filesystem can be created on this partition.
Once this command is finished, install Windows, followed by Linux by restarting the Mac and holding down ‘c’ to boot from the install CD in both cases. Do not edit the partition table within the installation programs for these operating systems, as they will not do it properly – modify the partition layout as needed within MacOS X. During the Windows installation, select the partition it labels as C: as the destination. All other aspects of the installation of both operating systems are as normal.
If more than 2 additional operating systems need to be installed, these can be installed 4 at a time on other drives by creating partition tables on these with a similar diskutil command. USB external drives are fine as long as the operating system supports booting from the USB bus.
Once these installations are complete, rEFIt will display the option to boot all available operating systems automatically on the next reboot. We’re done!