Search This Blog

Wednesday, 28 October 2009

How to yaboot

As I'm not going to renew ppclinux.info And it's been suffering some down time. I though I'd mirror some of the main points of interest here. 

www.ppclinux.co.uk will still work for another year

ref: http://www.ppclinux.co.uk/wiki/maclin/Yaboot

Yaboot

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.
1. 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
ofpath /dev/sda3
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 mac-fdisk
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
ybin uses 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
A simple /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.
enablecdboot
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
enableofboot
enablenetboot
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
5. MULTIBOOTING
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.
·······
DOCUMENTATION
http://yaboot.ozlabs.org/
http://www.alaska.net/~erbenson/
http://penguinppc.org/bootloaders/yaboot/index.shtml
http://www.alaska.net/~erbenson/yaboot/
USEFUL LINKS
http://www.my2bits.org/?p=49
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:
type:
rescue 
Enter your language
Enter you keyboard layout
Enter your key map
Enter hostname
Enter domain name
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.
KEYS:

CTL+ALT F2 
This will give you a console with a prompt like this #
CODE:

mac-fdisk -l

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.
KEYS:

CTL+ALT F1 
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"
Hopefully :) a message saying "Succesfully installed yaboot" will apear
From the next menu select "Reboot the system"