Disclaimer :
This handbook has been replaced by a newer version and is not maintained anymore.
|
[ << ]
[ < ]
[ Home ]
[ > ]
[ >> ]
10. Configuring the Bootloader
Content:
10.a. Choosing a Bootloader
Introduction
Now that the kernel is configured and compiled, you'll need a bootloader
to start your new linux installation. The bootloader that you use will
depend upon the type of PPC machine you have.
If you are using a NewWorld Apple or IBM machine, you need to use
yaboot. OldWorld Apple machines have two options,
BootX (recommended) and quik.
The Pegasos does not require a bootloader, but you will need to emerge
bootcreator to create SmartFirmware boot menus.
10.b. Default: Using yaboot
Introduction
Important:
yaboot can only be used on NewWorld Apple and IBM systems!
|
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 /dev and sys respectively. To do this,
you will need to "bind mount" these filesystems from the Installation CD's root
to the /dev and /sys mount points inside the chroot.
If you have already bind mounted these filesystems, there is no need to do it
again.
Code Listing 2.1: Bind-mounting the device and sysfs filesystems |
# exit # this will exit the chroot
# mount -o bind /dev /mnt/gentoo/dev
# mount -o bind /sys /mnt/gentoo/sys
# chroot /mnt/gentoo /bin/bash
# /usr/sbin/env-update && source /etc/profile
|
To set up yaboot, you can use yabootconfig to automatically create a
configuration file for you. If you are installing Gentoo on a G5 (where
yabootconfig does not always work), or you plan to boot from firewire
or USB, you will need to manually configure yaboot.
Note:
You will need to manually edit the yaboot.conf when using genkernel, even if
yabootconfig is used. The kernel image section of yaboot.conf should be
modified as follows (using vmlinux and initrd as the name of kernel and
initrd image):
|
Code Listing 2.2: Adding genkernel boot arguments to yaboot.conf |
image=/boot/kernel-genkernel-ppc-2.6.19-gentoo-r5
label=Linux
root=/dev/ram0
partition=3
initrd=/boot/initramfs-genkernel-ppc-2.6.19-gentoo-r5
append="real_root=/dev/hda3 init=/linuxrc"
read-only
|
Default: Using yabootconfig
yabootconfig will auto-detect the partitions on your machine and will
set up dual and triple boot combinations with Linux, Mac OS, and Mac OS X.
To use yabootconfig, your drive must have an Apple_Bootstrap partition,
and /etc/fstab must be configured to reflect your Linux
partitions (note that the Bootstrap partition should not be in your
fstab). These steps should have already been completed before, but check
/etc/fstab before proceeding. Now, install yaboot.
Code Listing 2.3: Installing yaboot from GRP |
# emerge --usepkg yaboot
|
Now exit the chroot and run yabootconfig --chroot /mnt/gentoo. First,
the program will confirm the location of the bootstrap partition. If you are
using the suggested disk partitioning scheme, your bootstrap partition should
be /dev/hda2. Type Y if the output is correct. If not, double check your
/etc/fstab. yabootconfig will then scan your system setup,
create /etc/yaboot.conf and run mkofboot for you.
mkofboot is used to format the Apple_Bootstrap partition, and install
the yaboot configuration file into it. After this enter the chroot again.
Code Listing 2.4: Re-enter the chroot |
# chroot /mnt/gentoo /bin/bash
# /usr/sbin/env-update && source /etc/profile
|
You should verify the contents of /etc/yaboot.conf. If you make
changes to /etc/yaboot.conf (like setting the default/boot OS),
make sure to rerun ybin -v to apply changes to the Apple_Bootstrap
partition. Whenever you make a change to yaboot.conf, like when testing a new
kernel, always remember to run ybin -v to update the bootstrap
partition.
Now continue with Rebooting the System.
Alternative: Manual yaboot Configuration
First, install yaboot on your system:
Code Listing 2.5: Installing yaboot from GRP |
# emerge --usepkg yaboot
|
An example yaboot.conf file is given below, but you will need to
alter it to fit your needs. G5 users and users booting from firewire and USB
should be aware that their disks are seen as SCSI disks by the Linux kernel, so
you will need to substitute /dev/hda with /dev/sda).
Code Listing 2.6: /etc/yaboot.conf |
boot=/dev/hda2
device=hd:
delay=5
defaultos=macosx
timeout=30
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot
image=/boot/kernel-2.6.19-gentoo-r5
label=Linux
root=/dev/hda3
partition=3
read-only
macos=/dev/hda13
macosx=/dev/hda12
enablecdboot
enableofboot
|
Once yaboot.conf is configured, run mkofboot -v to format
the Apple_bootstrap partition and install the settings. If you change
yaboot.conf after the Apple_bootstrap partition has been created, you can
update the settings by running ybin -v
Code Listing 2.7: Setting up the bootstrap partition |
# mkofboot -v
|
For more information on yaboot, take a look at the yaboot project. For
now, continue the installation with Rebooting the
System.
10.c. Alternative: BootX
Important:
BootX can only be used on OldWorld Apple systems with MacOS 9 or earlier!
|
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.
Code Listing 3.1: Copying the kernel to the MacOS partition |
# exit
cdimage ~# mkdir /mnt/mac
cdimage ~# mount /dev/sda6 /mnt/mac -t hfs
cdimage ~# cp /mnt/gentoo/usr/src/linux/vmlinux "/mnt/mac/System Folder/Linux Kernels/kernel-2.6.19-gentoo-r5"
|
If genkernel is used, both the kernel and initrd will need to be copied to the
MacOS partition.
Code Listing 3.2: Copying the Genkernel kernel and initrd to the MacOS partition |
# exit
cdimage ~# mkdir /mnt/mac
cdimage ~# mount /dev/sda6 /mnt/mac -t hfs
cdimage ~# cp /mnt/gentoo/boot/kernel-genkernel-ppc-2.6.19-gentoo-r5 "/mnt/mac/System Folder/Linux Kernels"
cdimage ~# cp /mnt/gentoo/boot/initramfs-genkernel-ppc-2.6.19-gentoo-r5 "/mnt/mac/System Folder"
|
Now that the kernel is copied over, we'll need to reboot to set up BootX.
Code Listing 3.3: Unmounting all partitions and rebooting |
cdimage ~# cd /
cdimage ~# umount /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo/sys /mnt/gentoo /mnt/mac
cdimage ~# reboot
|
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. If you're
not using genkernel, select Options and uncheck Use specified RAM
disk. If you are using genkernel, 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 you do this, you will first
see your machine boot into MacOS then, during startup, BootX will load and start
Linux. See the BootX home
page for more information.
Important:
Make sure that you have support for HFS and HFS+ filesystems in your kernel,
otherwise you will not be able to upgrade or change the kernel on your MacOS
partition.
|
Now reboot again and boot into Linux, then continue with Finalizing your Gentoo Installation.
10.d. Alternative: quik
quik allows OldWorld Macs to boot without MacOS. However, it isn't well
supported and has a number of quirks. If you have the option, it is recommended
that you use BootX instead since it is much more reliable and easier to set up
than quik.
First, we'll need to install quik:
Code Listing 4.1: Emerge quik from GRP |
# emerge --usepkg quik
|
Next, we'll need to set it up. Edit /etc/quik.conf and set your
image to the kernel that we copied to your boot partition.
Code Listing 4.2: Configuring quik.conf |
# Example of quik.conf
init-message = "Gentoo 2007.0\n"
partition = 2
root = /dev/hda4
timeout = 30
default = gentoo
image = /kernel-2.6.19-gentoo-r5
label = gentoo
|
Your quik.conf file must be on the same disk as the quik boot images,
however it can be on a different partition on the same disk, although it is
recommended to move it to your boot partition.
Code Listing 4.3: Moving quik.conf to /boot |
# mv /etc/quik.conf /boot/quik.conf
|
We will now set your boot variables so that quik loads on boot. To do this,
we'll use a program called nvsetenv. The variables that you want to
set vary from machine to machine, it's best to find your machine's
quirks
before attempting this.
Code Listing 4.4: Setting the boot variables |
# nvsetenv auto-boot true
# nvsetenv output-device video
# nvsetenv input-device kbd
# nvsetenv boot-device scsi/sd@1:0
# nvsetenv boot-device ata/ata-disk@0:0
# nvsetenv boot-file /boot/kernel-2.6.19-gentoo-r5 root=/dev/hda4
# nvsetenv boot-command boot
|
Note:
It is also possible to change your boot variables from MacOS. Depending upon
the model, either bootvars or
Apple System Disk should be used. Please see the quik quirks page above
for more information.
|
Now that we've set up our machine to boot, we'll need to make sure the boot
images are installed correctly. Run quik -v -C /boot/quik.conf. It
should tell you that it has installed the first stage QUIK boot block.
Note:
If something has gone wrong, you can always reset your PRAM back to the default
values by holding down command + option + p + r before powering on your
machine. This will clear the values you set with nvsetenv and should allow you
to boot either a MacOS bootdisk or a Linux bootdisk.
|
Now, continue the installation with
Rebooting the System.
10.e. Alternative: BootCreator
Important:
BootCreator will build a nice SmartFirmware bootmenu written in Forth for the
Pegasos.
|
First make sure you have bootcreator installed on your system:
Code Listing 5.1: Installing bootcreator from GRP |
# emerge --usepkg bootcreator
|
Now copy the file /etc/bootmenu.example into
/etc/bootmenu and edit it to suit your needs:
Code Listing 5.2: Edit the bootcreator config file |
# cp /etc/bootmenu.example /etc/bootmenu
# nano -w /etc/bootmenu
|
Below is a complete /etc/bootmenu config file. vmlinux and
initrd should be replaced by your kernel and initrd image names.
Code Listing 5.3: bootcreator config file |
[VERSION]
1
[TITLE]
Boot Menu
[SETTINGS]
AbortOnKey = false
Timeout = 9
Default = 1
[SECTION]
Local HD -> Morphos (Normal)
ide:0 boot2.img ramdebug edebugflags="logkprintf"
[SECTION]
Local HD -> Linux (Normal)
ide:0 kernel-2.6.19-gentoo-r5 video=radeonfb:1024x768@70 root=/dev/hda3
[SECTION]
Local HD -> Genkernel (Normal)
ide:0 kernel-genkernel-ppc-2.6.19-gentoo-r5 root=/dev/ram0 real_root=/dev/hda3 init=/linuxrc initrd=initramfs-genkernel-ppc-2.6.19-gentoo-r5
|
Finally the bootmenu must be transferred into Forth and copied to
your boot partition, so that the SmartFirmware can read it. Therefore you have
to call bootcreator:
Code Listing 5.4: Install the bootmenu |
# bootcreator /etc/bootmenu /boot/menu
|
Note:
Be sure to have a look into the SmartFirmware's settings when you reboot, that
menu is the file that will be loaded by default.
|
For now, continue the installation with Rebooting the
System.
10.f. Rebooting the System
Exit the chrooted environment and unmount all mounted partitions. Then type in
that one magical command you have been waiting for: reboot.
Code Listing 6.1: Exiting the chroot, unmounting all partitions and rebooting |
# exit
livecd ~# umount /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo/sys /mnt/gentoo
livecd ~# reboot
|
Once rebooted in your Gentoo installation, finish up with Finalizing your Gentoo Installation.
[ << ]
[ < ]
[ Home ]
[ > ]
[ >> ]
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-2.5 license. The Gentoo Name and Logo Usage Guidelines apply.
|