Handbook:PPC/Blocks/Bootloader/en

Making a choice
Now that the kernel is configured and compiled and the necessary system configuration files are filled in correctly, it is time to install a program that will fire up the kernel when the system is started. Such a program is called a boot loader.

The boot loader to use depends upon the type of PPC machine.

For a NewWorld Apple or IBM machine, yaboot needs to be selected. OldWorld Apple machines have two options, BootX (recommended) and quik. The Pegasos does not require a boot loader, but it is necessary to emerge bootcreator to create SmartFirmware boot menus.

Introduction
In order to find the boot devices, yaboot needs access to the device nodes created by udev on startup and the sysfs filesystem. These two filesystems are found at and  respectively. Early in the installation, these locations have already been bind-mounted into the chroot.

To set up yaboot, either use yabootconfig to automatically create a configuration file or manually configure the boot loader. When installing Gentoo on a G5 (where yabootconfig does not always work), or when the system needs to boot from FireWire or USB, then manually configuring yaboot is mandatory.

Default: Using yabootconfig
yabootconfig will auto-detect the partitions on the machine and will set up dual and triple boot combinations with Linux, Mac OS, and Mac OS X.

To use yabootconfig, the drive must have an Apple_Bootstrap partition, and must be configured to reflect the Linux partitions (note that the Bootstrap partition should not be in the fstab file). These steps should have already been completed before, but check before proceeding. Now, install yaboot.

Now exit the chroot and run. First, the program will confirm the location of the bootstrap partition. When using the suggested disk partitioning scheme, the bootstrap partition should be. Type if the output is correct. If not, double check the file. yabootconfig will then scan the system setup, create and run mkofboot. mkofboot is used to format the Apple_Bootstrap partition, and install the yaboot configuration file into it. After this enter the chroot again.

Verify the contents of. When making changes to (like setting the default/boot OS), make sure to rerun   to apply changes to the Apple_Bootstrap partition. Whenever ya change is made to, like when testing a new kernel, always remember to run  to update the bootstrap partition.

Alternative: Manual yaboot configuration
First, install yaboot on the system:

An example file is given below, but it will need to be altered to fit personal preference.

Once is configured, run   to format the Apple_bootstrap partition and install the settings. If is changed after the Apple_bootstrap partition has been created, then update the settings by running.

For more information on yaboot, take a look at the yaboot project.

Alternative: Using BootX
Since BootX boots Linux from within MacOS, the kernel will need to be copied from the Linux Partition to the MacOS partition. First, mount the MacOS partition from outside of the chroot. Use mac-fdisk -l to find the MacOS partition number, sda6 is used as an example here. Once the partition is mounted, we'll copy the kernel to the system folder so BootX can find it.

If genkernel is used, both the kernel and initrd will need to be copied to the MacOS partition.

Now that the kernel is copied over, we'll need to reboot to set up BootX.

Of course, don't forget to remove the bootable CD, otherwise the CD will be booted again instead of MacOS.

Once the machine has booted into MacOS, open the BootX control panel. When not using genkernel, select Options and uncheck Use specified RAM disk. If genkernel is used, ensure that the genkernel initrd is selected instead of the Installation CD initrd. If not using genkernel, there is now an option to specify the machine's Linux root disk and partition. Fill these in with the appropriate values. Depending upon the kernel configuration, additional boot arguments may need to be applied.

BootX can be configured to start Linux upon boot. If this is done, then the machine will boot into MacOS first and, during startup, BootX will load and start Linux. See the BootX home page for more information.

Alternative: Using Quik
quik allows OldWorld Macs to boot without MacOS. However, it isn't well supported and has a number of quirks. If possible, it is recommended that BootX is used instead since it is much more reliable and easier to set up than quik.

First, install quik:

Next, set it up. Edit and set the image to the kernel that was copied to the boot partition earlier on.

The file must be on the same disk as the quik boot images, however it can be on a different partition, although it is recommended to move it to the boot partition.

Now set the boot variables so that quik loads on boot. To do this, we'll use a program called nvsetenv. The variables vary from machine to machine, it's best to find the machine's quirks before attempting this.

Set to false to boot into OF, not all models can display the OF output:

Check the quirks page, there are many variations here:

For SCSI:

For ATA:

Next, the first item is the path to the kernel, the second is the root partition. Append any kernel options to the end of this line:

Set this to bye for MacOS and boot for Linux:

Now that we've set up the machine to boot, we'll need to make sure the boot images are installed correctly. Run. It should tell that it has installed the first stage QUIK boot block.

Alternative: Using BootCreator
First make sure to have bootcreator installed on the system:

Now copy the file into  and edit it to suit personal needs:

Below is a complete config file. vmlinux and initrd should be replaced by the kernel and initrd image names.

Finally the bootmenu must be transferred into Forth and copied to the boot partition, so that the SmartFirmware can read it. Therefore it is necessar to call bootcreator: