GRUB on Open Firmware (PowerPC)

This article Article description::covers installation of the [[GRUB2 bootloader on PowerPC machines with Open Firmware]]. This corresponds to GRUB_PLATFORMS = for  and  architectures, and to the   option of. IEEE standard 1275 was the official standard for Open Firmware, sometimes abbreviated as OFW or OF.

Apple NewWorld Macs (PowerPC)
NewWorld Macs are Macs with Open Firmware version 3 (OF3) or later (OF3+). NewWorld Macs will show a graphical boot selection when holding the key right after the chime, until a startup selection is shown on the screen. This will only work well when a CHRP script that includes an  is blessed (attribute :tbxi) on a HFS volume.


 * NewWorld Apple Mac computer (1999—2006).
 * is a separate ext2 partition.
 * Apple Partition Map (APM) consisting of:
 * NewWorld Bootblock as
 * Filesystem HFS.
 * As any partition number (at the beginning of the disk is preferred, but not required).
 * Apple specific.

NewWorld Bootblock partition
First, a NewWorld Bootblock has to be created using :

At the interactive command prompt this partition can either be created manually e.g. by using the command for "create new partition, specifying the partition type", or semi-automatic by using the  command for "create new 800k Apple_Bootstrap partition (used by yaboot)". Either way you should get a bootable HFS partition of either the type  or. The partition name is optional but helps when listing the partitions. All values are entered by hand without automatism of any kind.

The following example uses the free space (type Apple_Free) right after the partition table. If this wasn't taken care of e.g. when installing Mac OS X, per default only 128 MB will be free here, which should barely be enough for this purpose. Older versions of Mac OSnbsp;X don't add free space between partitions, so the NewWorld Bootblock will have to be added behind the already existing partitions.

Normally 800 KB is used but any size big enough for a HFS filesystem and the GRUB core files will do. In this example, the hole between the partition table and the first partition (Mac OS X Tiger) is 1.1 GB. It starts at block 64 (base column) and is 2359232 blocks long (length column). Since this is enough to add 128 MB "holes" before and after, the partition will add two more Apple_Free holes. The block numbers to enter have to be calculated first: 128 MB Apple_Free "holes" are 262144 block in size, so the first block will have to be  (base) +   (Apple_Free) =. Since the original Apple_Free "hole" in this specific example has 2359232 blocks, another hole is left at the end if the size of the bootstrap partition is.

To get this done, the key sequence (print partition table),  (create partition with type also specified; type uppercase C!),   (first block),   (length),   (name of partition; use quotes!) and   (type of partition). To check if this worked, use again to list the new partition table. Note that two more partitions were added and the numbers behind those partitions have been shifted accordingly ("Linux Boot" was /dev/sda9 and got shifted to /dev/sda11). All modifications are done in memory and will be saved with (write the partition table), followed by  (to confirm). To restart if something got messed up simply quit without writing the modifications. Type for quit.

The final partition layout of this example looks like this, using and :

To make the Linux kernel recognize the new partitions a restart is required. But to get access to devices that were not in use, (from the  package) can force the kernel to re-read the partition table, with the exception of partitions already in use:

Notice that partition 11 is now "Linux Boot" (ext2), but it was mounted as  before the change to. The former partition numbers and the listet new partition numbers from the error message should not be used for anything else than to keep them mounted as they were, but it should be safe to access the newly created NewWorld Bootblock as  now to setup GRUB as the bootloader – before a restart.

CHRP boot script
Install the required tools:

In this example, a CHRP boot script will load the GRUB image, which will use an initial grub.cfg to find and load the actual grub.cfg configuration from the directory on the    partition.

Make sure that is mounted and create a new directory  (for NewWorld BootBlock):

Find out the UUID of the partition:

Alternative:

Create file and use the UUID from above to let GRUB find the correct  partition. Although it would also be possible to specify an absolute path, using the UUID will compensate automatically for small changes, like switching drives or adding/deleting partitions.

Install GRUB to (the default path). Option  prevents GRUB from setting the Open Firmware   nvram variable. Since GRUB doesn't know about the CHRP script on the NewWorld Bootblock, it would set the wrong value anyway.

With this setup, the initial grub.cfg, GRUB will then look for on the actual  partition (i.e.  on the live system, since the boot partition is mounted) found via its UUID. Further updates to grub.cfg therefore go via the real grub.cfg the usual way, without the need to touch the NewWorld Bootblock anymore:

Now create a list of modules to be included in the GRUB image.

The command will create a minimal grub bootimage that includes these modules and the initial grub.cfg:

If  with grub-initial.cfg is ommited, it will be looked up as grub.cfg in the same directory where the grub.img will later be loaded on the NewWorld Bootblock HFS partition.

Now find the partition number of the NewWorld Bootblock, e.g. is partition. Open Firmware notation is used in the CHRP script, so the command is  when the GRUB image is in   on the HFS NewWorld Bootblock. is an alias for the first disk drive.

Now copy all files to the NewWorld Bootblock HFS filesystem into and bless (attribute :tbxi) the CHRP boot script   and the  subdirectory:

Test and set as default boot-device
After a reboot, when holding the key right after the chime, a startup selection for the partition with GRUB should now be visible. If everything worked, from the  package may be used to set the default startup volume:

In the above commands the default startup volume was (in the example APM partition layout from above this is Tiger i.e. Mac OS X Tiger 10.4) and it is then set to, the GRUB CHRP boot script in this example.

External resources

 * Open Firmware Quick Reference from FirmWorks