Description: HowTo for yaboot The bootloader for NewWorld PowerMacs
Keywords: boot bootloader yaboot ybin GNU Linux GNU/Linux OpenFirmware dual-boot dualboot multi-boot multiboot bootmenu menu bootstrap Apple_Bootstrap partition lilo

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ next ]

# HOWTO-Booting with Yaboot on PowerPC
Chapter 6 - Customizing Your Boot Configuration

To customize your `yaboot` installation, use any text editor such as `vi` or `nano` (or `nano-tiny` in the Debian installer) to edit the `yaboot.conf` file. If you used `yabootconfig` to create the initial `yaboot.conf`, it will already contain a basic configuration to boot the linux system.

The `yaboot.conf` has numerous options; see the `yaboot.conf` man page for details. I will briefly cover the most popular items here. The file controls both `yaboot` operation during tha actual boot, and `ybin` operation while saving the configuration to the boot partition.

Lines in the file beginning with `#` are interpreted as comments. Each option or parameter must be specified on a separate line. Don't use any extra spaces within or following parameter definitions. Also, the file must have unix newlines; be sure to save as a unix type file if you create or edit it within MacOS.

## 6.1 Linux Style Device Paths

For those unfamiliar with Linux device naming, partition paths are in the form of `/dev/xxx#` where xxx is the Linux device name and # represents the partition number. Typical Linux device names are:

           Name   Device Type
           ----   --------------------------------------------------
           hda    internal ide drive (primary controller, master disk)
           hdb    internal ide drive (primary controller, slave disk)
           hdc    secondary controller, master disk (often used for CD-ROM)
           hdd    secondary controller, slave disk (often used for Zip drive)
           sda    first SCSI disk (SCSI ID address-wise)
           sdb    second SCSI disk
           scd0   first CD-ROM (or sr0)
           fd0    first floppy drive
           fd1    second floppy drive

## 6.2 OpenFirmware Device Paths

A utility for finding the OpenFirmware device path corresponding to a given Linux device path is provided: `ofpath`. `ybin` uses `ofpath` internally to convert Linux device names you use in `yaboot.conf` to OpenFirmware equivalents. Example: `ofpath /dev/hda` (should return hd:). You can also figure out OpenFirmware device paths yourself, see Recovering From Misconfiguration below.

## 6.3 Required Settings

The bootstrap partition is identified with `boot=boot-partition`, where boot-partition is the Linux-style path to the bootstrap partition. If you followed our partitioning recommendations on your internal hard disk, that would be `boot=/dev/hda2`.

For PowerMacs, a magicboot line such as `magicboot=/usr/local/lib/yaboot/ofboot` is also required. Several models cannot execute a straight ELF, and need a CHRP script (which this line in the `yaboot.conf` makes available).

The `partition=`, `image=`, and `root=` settings (under kernel image settings below) are also required.

## 6.4 Boot Menu Options

A CHRP script (`ofboot`) has been provided which `ybin` will modify using `yaboot.conf` settings, to display a very handy multi-OS boot menu.

If you are setting up a multi-OS boot menu, you'll need to identify the partitions where each OS lives. You can use Linux-style or OpenFirmware partition paths. Here are some examples illustrating the possibilities:

              macos=/dev/hda10
              macosx=/dev/hda12
              darwin=hd:9
              bsd=zip:1

When using `macosx=`, if you have OSX installed on a UFS partition, then point the macosx to the OSX bootstrap partition, not the UFS root. Don't be tempted to use the OSX bootstrap partition for `ybin`, however — you still need a separate Apple_Bootstrap partition.

When using `bsd=`, on the other hand, point to the BSD root partition, not a bsd bootstrap partition. To use `bsd=`, you also need to have the bsd bootloader (ofwboot) available in `/usr/local/lib/yaboot/` when running `ybin`.

If nothing is selected from the boot menu when it appears, the system launches `yaboot` to start Linux. To launch another OS when no key is pressed, add a `defaultos=` line, for example `defaultos=macos` or `defaultos=bsd`.

## 6.5 Kernel Image Settings

Kernel images to be launched by yaboot can be kept on any partition, in an ext2, ext3, XFS, ReiserFS, or HFS/HFS+ filesystem. Yaboot will need to know the kernel partition number and filesystem path.

The `yaboot.conf` file has two sections; most options are in the global section at the top of the file, and options pertaining to separate kernel images are grouped together below. Most kernel image options may be specified either globally or locally; a global option is overridden if it is re-specified in a kernel image section. Each kernel image section begins with an `image=/` line specifying the filesystem path to that kernel image; the first `image=/` line marks the end of the global section.

Yaboot must know the device, partition number, and filesystem path for the kernel image that is to be loaded and started. However, `device=` is usually not necessary, because if you don't specify it `yaboot` assumes it will find the kernel on the same device it was booted from, which is quite often true. You should always supply the kernel partition number, for example `partition=3`, and of course the image path (for example `image=/boot/vmlinux` ). If your kernel image is at the root level of the partition, don't forget to include the leading slash when specifying the image path (`image=vmlinux` will probably fail).

It's worth noting that `yaboot` locates the kernel image within a partition's filesystem without regard to where that partition will eventually be mounted within the Linux root filesystem. So, for example, if you've placed a kernel image or symlink at /boot/vmlinux, but /boot is actually a separate partition on your system, then the image path for `yaboot` will just be `image=/vmlinux`.

You must also specify the Linux partition path for the root partition, for example `root=/dev/hda3`. This parameter is passed to the kernel when it starts up to let it know where its root filesystem is located. Many other options are available to pass additional boot parameters to the kernel (`append=`), specify initial ramdisk size (`ramdisk=`), load a ramdisk image (`initrd=`), and others. Refer to the yaboot.conf man page for details on kernel image options.

Here's a simple but complete example `yaboot.conf` with one kernel image section:

           # Where's the bootstrap partition
           boot=/dev/hda2
           # CHRP script spec
           magicboot=/usr/lib/yaboot/ofboot
           # Dual boot with MacOS
           macos=hd:14
           # How long to wait at the OS boot menu (seconds)
           delay=5

           # How long to wait at the boot: prompt (tenths of a second)
           timeout=50
           # Globally identified root partition
           root=/dev/hda3
           # The device where the kernel lives
           device=hd:

           # Kernel image section begins here
           # Specify the filesystem path to the kernel image, symlinks are OK
           image=/vmlinux
               # Specify the partition number where this path is valid
               partition=3
               # Add a label, you can type this at the boot: prompt to load this kernel
               label=Linux
               # Specify the type of root fs mounting, read-only allows fsck to run
               read-only

           ## You must run ybin for changes to take effect!!!!!!!

To netboot a kernel image via tftp, use `image=/tftpboot/vmlinux` (the path on the tftp server) and `device=enet:10.0.0.1` (substituting the tftp boot server IP address).

Normally the first image specified in the `yaboot.conf` will be the image booted if no entry is made at the boot: prompt. To have another image loaded by default, add a `default=label` line in the global section.

## 6.6 Optional and Cool Settings

Yaboot and your multiboot menu can throw a splash of color into your life! Use `fgcolor=` and `bgcolor=` lines to set your screen to wake you up in the morning with black, blue, light-blue, green, light-green, cyan, light-cyan, red, light-red, purple, light-purple, brown, light-gray, dark-gray, yellow, and white. Make fgcolor and bgcolor the same if you'd really like a challenge.

Add any or all of enableofboot, enablenetboot, or enablecdboot to add the respective options to your OS boot menu: boot from OpenFirmware, the network, or CDROM.

Use Set delay= (in seconds) to determine how long the multiboot OS menu should wait before booting the default OS. `timeout=` (in tenths of seconds) to set how long yaboot should wait at the boot: prompt for you to choose a kernel image before booting the first image in the file or the `default=` image.

Booting password protection is available using a `password=` line. When you add `password=`, a password will be required for all booting. Automatic booting is not possible unless a `restricted` line is added.

If `restricted` is added in the global section, kernel images defined in `yaboot.conf` may be booted as long as no arguments are added at the boot: prompt. This is useful for unattended booting, while preventing the instant rootshell problems of console access (though OpenFirmare passwords are also needed to make this really secure, along with locking the case). To boot an undefined image, or any image with additional arguments, a password will be required.

The `password=` line may either be a plaintext password or an MD5 hash (the same format as the Linux `/etc/shadow` file). To make an md5 hash use the following perl snippet:

             $ perl -e 'printf("%s\n", crypt("secret", "\$1\$saltstrg"))'

The saltstrg should be a random string, for example one generated by

             makepasswd --chars=8

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ next ]

HOWTO-Booting with Yaboot on PowerPC