Overview

This describes how to build and run the latest version of GRUB 2 for PowerPC. These directions may change as development progresses; if they don't work for you then please ask about it on the development mailing list.

Do not try this unless you know what you're doing. Do not try this if you are not familiar with Open Firmware. GRUB 2 is experimental software, and since it's a bootloader, it could greatly inconvenience you or render your system unbootable.

Build Process

Get the latest GRUB 2 SVN.

svn co svn://svn.sv.gnu.org/grub/trunk/grub2 

Compile

cd grub2
mkdir build
cd build
../configure
make

If you get errors at this point, please report them to the grub-devel mailing list. Assuming the build completes successfully, you will now have a grubof executable and many modules in the build directory. make install is not used yet.

To add modules to grubof, use grub-mkimage. Modules are required to access disks, use filesystems, etc.

./grub-mkimage -d . -o grubof.modules *.mod

Config File

Use a config file named grub.cfg like this:

set timeout=10
menuentry "Linux" {
    linux (hd,7)/vmlinux root=/dev/hda9
    initrd (hd,7)/initrd
}

In this example, the Linux partition /dev/hda7 contains the kernel and initrd, and the / (or root) partition is /dev/hda9. hd is an Open Firmware device alias referring to the first ATA hard disk; almost all New World Power Macintosh have this alias. Use the Open Firmware command devalias to examine your system's aliases.

Installation

Place grubof.modules and grub.cfg on an HFS partition. If you currently use the yaboot bootloader, this is easy: use either the kernel HFS driver or the hfsutils userland tools to copy those files directly next to yaboot and yaboot.conf on the existing "bootloader" partition.

Do not delete yaboot. You will need it when something goes wrong and GRUB fails to boot.

Booting

Boot to the Open Firmware prompt. On Power Macintosh, do this by holding down the four keys option/alt apple/command o f immediately after the boot chime (hold them down until you see the screen change).

Run printenv boot-device to see how your system currently boots. Write this value down so that you can restore it later. To overwrite that setting, use setenv boot-device <new value>. If your system currently boots yaboot, and you installed grubof.modules next to yaboot as instructed above, you should modify boot-device replacing \\:tbxi with <partition number>,grubof.modules. Example, where grubof.modules lives on Linux's /dev/hda6:

0 > printenv boot-device
--------------- Partition: common ---------- Signature: 0x70 ----------
boot-device            /pci@f2000000/mac-io@17/ata-4@1f000/disk@0:,\\:tbxi    hd:,\\:tbxi
0 > setenv boot-device hd:6,grubof.modules

Once boot-device is set properly, run boot to boot your system. To restore your system's boot process, boot back to the OF prompt and restore the original contents of boot-device (which you wrote down above). You can set of variable with the tool nvsetenv :

# nvsetenv boot-device hd:6,grubof.modules

Notes For Non-Macintosh Systems

GRUB 2 is occasionally tested on a Total Impact briQ and a Genesi PegasosII. It has not been tested on other Open Firmware PowerPC systems such as RS/6000 or pSeries. If you have such a system and are willing to experiment, please try it and tell us how it works!

For the briQ, RS/6000, and pSeries, you must use the -n switch to grub-mkimage when adding modules.

yaboot is typically not installed on a filesystem on non-Macintosh systems, but rather copied onto a raw partition. You will need to create a small firmware-accessible filesystem on which to place grubof.modules and grub.cfg (that filesystem may be a floppy disk). FAT filesystems are typically accessible by firmware on these systems.

On the Pegasos the prefix environment variable is always set to (hd) no matter how I set boot-device and boot-file on Open Firmware. To be able to load the configuration file automatically it is possible to boot add an argument to grubof while booting. For example, "boot hd:5 boot/grub/grubof.modules prefix=(hd,5)/boot/grub/".


CategoryDocumentation

GrubWiki: TestingOnPowerPC (last edited 2010-02-06 18:31:28 by FelixZielcke)