|
Understanding the role of EFI/GPT on the Mac platform.
The macintosh hardware/software platform is unique in several ways. A primary difference between "ordinary PC's" is that the hardware uses a bootup interface known as EFI (Extensible Firmware Interface) rather than the traditional X86 BIOS.
The use of EFI has many advantages (beyond the scope of this document), however, it has one primary disadvantage: many operating systems lack native EFI support. EFI, being a very new and very different way of interacting with the hardware during bootup, provides a unique challenge to pre-existing operating systems. Windows XP and Vista, as well as Haiku, all lack native support for EFI booting.
How, may you ask, does one see people running Windows / Linux on the Macbook? Well, Apple sometime ago released a set of BIOS emulations with a firmware update entitled 'Bootcamp'. This, along with a set of user-friendly installation tools in OS X allows one to install Windows alongside their native Mac OSX installation.
Another primary change with the mac is the use of a different partitioning format for the disk: GPT.
The GUID partition format changes some of the legacy problems of the traditionally used master boot record, while still providing fairly useful backwards compatibility.
The GPT format provides space at the head of the drive where the MBR was traditionally found. This allows not only for protection, in the case of an overzealous file utility, but also allows the Mac to use this 'dummy' MBR in its Bootcamp emulation.
Okay, but why is this important?
The Bootcamp emulation can only reference the first 4 partition entries located in the 'fake' MBR. Two of these are traditionally used by the Mac. The fourth is occupied by Windows in a typical Bootcamp setup. The typical partitioning of a Haiku installation will thus be:
1) EFI system partition (necessary for firmware updates, etc)
2) Mac OS X (Leopard) (HFS+ case sensitive? or insensitive)
3) Haiku
4) Windows / Linux / BSD Whatever. (fat32/ext2/3)
5) Build partitions (See below) (HFS+ Case Sens.)
Partitions beyond 4, in this case the build partition, cannot be accessed from within legacy OSs, but can be accessed by EFI / GPT aware systems.
How can I setup these partitions on my Macbook?
A program called diskutil.
Diskutil allows you to dynamically resize your OSX partition to allow the addition of others. To see a list of partitions simply type 'diskutil list' from within a Terminal prompt.
In my case it displays:
$ diskutil list /dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *111.8 Gi disk0
1: EFI 200.0 Mi disk0s1
2: Apple_HFS Macintosh HD 79.9 Gi disk0s2
3: Microsoft Basic Data 3.0 Gi disk0s3
4: Microsoft Basic Data NO NAME 17.0 Gi disk0s4
5: Apple_HFS Build 10.1 Gi disk0s5
6: Linux Swap 1.3 Gi disk0s6
Prior to adding the other partitions I had 2 main partitions, the main EFI and the Apple HFS partition.
Additional partitions can be created using diskutil resizeVolume. The format of the command is sudo diskutil resizeVolume (target partition) size "Format" "Name of New Partition" NewSize "Format" "Name of New Partition2" newSize2 etc..
For example:
sudo diskutil resizeVolume disk0s2 50G "MS-DOS FAT32" "Haiku" 5G "MS-DOS FAT32" "Windows" 30G
Would add 2 additional partitions: Haiku (5 Gig) and Windows (30 Gig) in that order. BFS and EXT2/3 are obviously not supported by Apple, so setting up a FAT32 partition and then changing the partition to BFS by copying an image is the easiest way to proceed. Attaching an additional build partition can be done by specifying HFS+ and then ensuring it is case-sensitive by using Utilities->Disk Utility.
Partitioning to Build the Source
The first necessary step in compiling the Haiku source on the Mac is to setup the build
environment. The Haiku source requires that you build from a case-sensitive partition. This is
necessary as several header files have similar, but different names, such as <String.h> and
<string.h>. You can achieve this setup by one of two main setups:
1) Install MacOSX on a case-sensitive HFS partition by selecting this in the partition setup.
2) Setup an additional partition on your drive, define it as case-sensitive, and build from there.
Option 1 is the easiest way to integrate the build environment into your pre-existing Mac development tree, but Option 2 is probably the easiest way to go without installing MacOSX over again.
By using the diskutil command as described above you can easily accomplish this and have your case-sensitive partition ready to go.
The XCode tools located on your Leopard DVD must then be installed on your system.
Installing MacPorts
The next step is to install several ported unix utilities found as part of the Macports project. Macports can be found here and installed from the disk image.
Following the installation it is then necessary to install several ports via the command line.
'sudo port install expat gawk gettext libiconv and gnuregex' will do the trick.
The next step is checking out the source as detailed in other related posts .
The build setup is then roughly identical to linux, except GCC4 must be used. The current makebootable found in the SVN will currently not allow you to build to a partition from linux. Building to a file or vmware image should now be successful.
The next blog post will overview how to build to a partition using a modified makebootable, and running Haiku on the Macbook.
Please email me (chrisjp) with any questions, comments, errors, or omissions.
|