Yaboot is an OpenFirmware bootloader for Open Firmware based machines. It is known to work on "NewWorld" class PowerMacs (iMac and all machines released after it), RS/6000, and possibly other OF based CHRP machines. "OldWorld" PowerMacs (with the built-in MacOS ROM) are not supported.
This is a short how to, in order to understand how to fix your boot problems.
ofpath is a utility to determine the OpenFirmware path of a device.
If you want to know the OpenFirmware path of a device, e.g. /dev/sda3, just run
2. A minimal PPC-Linux Partition Table (without any MacOS) on /dev/sda looks like this
# type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Bootstrap bootstrap 1600 @ 64 (800.0k) NewWorld bootblock /dev/sda3 Apple_UNIX_SVR2 myLinux 85852160 @ 1664 ( 40.9G) Linux native /dev/sda4 Apple_UNIX_SVR2 swap 8000820 @ 202238668 ( 3.8G) Linux swap
Yaboot is on the second partition, the Bootstrap Partition. Do not mount it!
You can edit a partition table in Linux with
3. There are three ways to install yaboot on a Apple_Bootstrap Partition:
ybin is the bootloader installer for PowerPC based machines
ybin installs the bootloader according to the parameters in /etc/yaboot.conf
ofpath to find the path to the bootstrap partition and to any defined macos or macosx partitions.
mkofboot is a symlink to
ybin, with the difference that initializes the bootstrap partition prior to running
ybin to install the bootloader on it
yabootconfig creates a default configuration file and then runs
mkofboot to complete the bootloader installation
4. The yaboot configuration file
/etc/yaboot.conf in a dual-boot system with Linux and MacOSX looks like this
boot=/dev/sda2 device=/ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0: partition=3 root=/dev/sda3 timeout=100 install=/usr/lib/yaboot/yaboot magicboot=/usr/lib/yaboot/ofboot enablecdboot macosx=/dev/sdb3 image=/boot/vmlinux label=Linux read-only initrd=/boot/initrd.img image=/boot/vmlinux.old label=old read-only initrd=/boot/initrd.img.old
boot= the bootstrap partition
device= openfirmware path to the root partition
partition= number of the root partition
root= the device name of the root partition
timeout= Sets a timeout in seconds for keyboard input. If no key is pressed for the specified time, the first image is automatically booted.
macosx= device name of the MacOSX partition
There are more interesting options (for a complete list see 'man yaboot.conf') such as
macos= device name of the MacOS9 partition
password= to specify a password for starting the system
defaultos= to specify from wich os the computer starts
After any changes of the yaboot.conf file, in order to make yaboot aware of the new 'situation', you need to run always
sudo ybin -v
For any other Linux-OS you install, the yaboot installer specifies in the yaboot.conf file following parameters:
image=/ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0:4,/boot/vmlinux label=sda4-Linux root=/ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0:4 append="root=/dev/sda4 ro quiet splash" initrd=/ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0:4,/boot/initrd.img
image= the openfirmware path to the kernel-image (or to its symlink)
label= the name of the Linux kernel to display at the second yaboot prompt
root= the openfirmware path to the root partition
append= any options to pass to the kernel before starting
initrd= the openfirmware path to initrd
When you start the computer, at the yaboot prompt, you can choose which OS you want to boot from (Linux, MacOSX, MacOS) or if you want to boot from a CD (if in yaboot.conf there is the option enablecdboot). After you choose to start from Linux, if you hit the TAB key, you will find a list of the different Linux-Kernels for each installed Linux Distro. With the option 'label' in the list above, you can specify the name for each of them.
Usually you do not need to configure your yaboot.conf file. But it can happens, that the Linux Installer fails to detect other Linux Distros installed on the computer (for me, when installing Fedora 10, the installer did not detect my Debian and Ubuntu partitions). Since I never had a problem with the Debian Installer, if I want to install different Linux Distros, I run Debian after the Installation of the others - it detectes the other MacOS or LinuxOS's always correctly.
HOW TO RECOVER A BROKEN YABOOT IF YOU ALREADY HAVE A SUCCESSFUL DEBIAN INSTALL.
Place a Debian CD in the tray and boot with the C key held down.
After the white open firmware screen you should get the black yaboot screen with a prompt like this. boot:
rescue <hit enter>
Enter your language
Enter you keyboard layout
Enter your key map
Enter hostname <if you don't know or care just hit enter>
Enter domain name <if you don't know just enter "local" minus qoutes then hit enter>
Then you are given a list of partitions on your machine and asked for your root partition select your root partiton.
If you dont know which partition is your root partition do this. Note sometimes the ALT and OPT keys are inter changable depending which part of the world you live.
CTL+ALT F2 <all at the same time>
This will give you a console with a prompt like this #
This will list all partitons, as an example mine is below. look down YOUR list until you see your root partition
/dev/hda type name length base ( size ) system@ /dev/hda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/hda2 Apple_Bootstrap untitled 1954 @ 64 (977.0k) NewWorld bootblock /dev/hda3 Apple_UNIX_SVR2 root 18554688 @ 2018 ( 8.8G) Linux native /dev/hda4 Apple_UNIX_SVR2 swap 976563 @ 18556706 (476.8M) Linux swap /dev/hda5 Apple_UNIX_SVR2 home 62500001 @ 19533269 ( 29.8G) Linux native /dev/hda6 Apple_UNIX_SVR2 untitled 78038390 @ 82033270 ( 37.2G) Linux native /dev/hda7 Apple_Free Extra 14868 @ 160071660 ( 7.3M) Free space
On mine /dev/hda3 is root. Note yours down.
CTL+ALT F1 <all at the same time>
This will put you back into rescure mode and you can select your root partition
From the next menu, using the up and down arrows select "Reinstall yaboot boot loader" <hit enter>
Hopefully 🙂 a message saying "Succesfully installed yaboot" will apear <hit enter>
From the next menu select "Reboot the system" <hit enter>
Newworld PowerMacs (iBook, PowerMac G4, iMac, etc.) should be booted using the yaboot booter for best results. This guide explains how to setup yaboot and create a boot menu between Mac OS and Linux. This guide assumes you have Linux already installed, and want to install yaboot.
Creating a Bootstrap Partition
Newworld Macs (which are based on the CHRP standard) require a "blessed" CHRP openfirmware script to boot on a HFS or HFS+ partition. If you look on your Mac OS partitions, with a program that can see invisible files, you will find this CHRP openfirmware script in your Mac OS System Folder with the name tbxi.
This means, in almost all cases, you need a special bootstrap partition for Linux, as Linux can not reside on a HFS or a HFS+ partition, it requires a ext2 partition.
This "bootstrap" partition should be around 5 to 10 MB. Other guides recommend more space, but it is not necessary, and just a waste of disk space. The format doesn't matter, as we will reformat it in Linux.
First you should be aware where your partitions are. They are referenced in Linux by /dev/hdaX where X is the partition number. You can get a list of partition numbers by opening up a terminal window and typing the following:
su (this will switch you into "root" mode, you'll have to enter your root password)
/sbin/pdisk -l /dev/hda
The partition numbers are the leftmost numbers in the list.
Then you'll need the latest version of ybin/yaboot at http://www.penguinppc.org/projects/yaboot/
Should be a file of type yaboot-X.Y.Z.tar.gz, where X.Y.Z is the version number.
Once downloaded, do the following:
cd tar -zxvpf yaboot-X.Y.Z.tar.gz cd yaboot-X.Y.Z make su make install
Okay, now we can get started...
First we have to prepare the BootStrap partition. Do the following:
/sbin/pdisk /dev/hda (You will now enter the interactive pdisk program)
Type p to get the partition map (Write down the partition number, the first block (the number after the @), the block length (the number in front of the @))
Type d (Delete a partition)
Enter the number of your bootstrap partition
Type C (Create new partition)
Enter the first block number
Enter the block length
Enter "Apple_Bootstrap" as name of partition
Enter "Apple_Bootstrap" as type of partition
Type w to save the changes
Type q to quit pdisk
Now all you have to do is this:
/usr/local/sbin/yabootconfig (This will automatically create the bootstrap partition, format it correctly, copy all the necessary files to it and configure it to boot into Linux by default)
In order to make your computer multi-OS bootable, we have to edit (as root) your /etc/yaboot.conf file.
Add the following lines to the file: (You can move with the arrow keys)
macos=/dev/hdaX (Where X is the number of your MacOS9 partition)
macosx=/dev/hdaZ (Where Z is the number of your MacOSX partition)
Set the defaultos= line to your prefered OS:
Your file should now look more or less like this:
## yaboot.conf generated by yabootconfig 1.0.3 ## ## run: "man yaboot.conf" for details. Do not make changes until you have!! ## ## For a dual-boot menu, add one or more of: ## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ boot=/dev/hda13 device=hd: partition=12 root=/dev/hda12 timeout=30 delay=10 install=/usr/local/lib/yaboot/yaboot magicboot=/usr/local/lib/yaboot/ofboot default=linux defaultos=linux macos=/dev/hda9 macos=/dev/hda10 image=/boot/vmlinux-2.4 label=linux read-only
To update your bootmanager, type /usr/local/sbin/ybin -v
Okay, you should be all set now. Reboot.
From now on, you will be prompted for the OS you want to boot on startup. Press m for MacOS, x for MacOS X, l for Linux, etc. and it will be booted.
More Kernel Arguments
If you want to pass arguments to the kernel (for video settings, keyboard, etc.) use append= at the end of the yaboot.conf file. Don't forget to rerun ybin each time you modify yaboot.conf.