[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about booting



On Wed, Aug 08, 2007 at 02:24:51AM +0100, Martín Ferrari wrote:
> I'm working on a tool for testing the Debian CDs for the Google Summer
> of Code (http://pancutan.alioth.debian.org/), this tool will run all
> sort of tests over the iso files, and I'm fairly lost about the
> different booting methods in powerpc (which I will inspect to be sure
> that the cd is bootable in all arches). So as people that know the
> architecture, maybe you can give me some pointers, sorry if this is
> offtopic here.
> 
> So far, I've found that:
> 
> - the /install folder is -hfs-blessed, but don't know what that means,
> - there is another chrp descriptor called ofboot.b, but I don't know what it is,
> - the yaboot boot loader is present, but I couldn't find what enables it,

These parts are used for the Mac subarchitecture, although I believe
yaboot and ofboot.b are also used on other types.

An HFS or HFS+ filesystem can have a single folder marked as blessed.
This is recorded in the equivalent of a super block on disk. The
firmware can use this as a shortcut to find the bootloader on the
filesystem instead of using a fixed block location method for loading
an operating system. For example, the boot-device setting in the
firmware on my PowerMac G5 is the following:

/ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0:2,\\:tbxi

This is the path to the device and the search path on the filesystem
on that device to find the bootloader. (Hypertransport, then PCI, then
the SATA controller, then one bus, then one disk, then a partition,
then a path on the filesystem on that disk.) In particular, the \\ near
the end means to look in the blessed folder on the filesystem. The rest
of the path is a special Mac shortcut that says to look for a 
particular file type (tbxi is a code for a bootloader). Older Mac ROM
code was hard-coded to only look in the blessed folder for the System
file.

Because of this, booting from a blessed folder on a CD could use a
boot path as simple as "cd:,\\:tbxi".

The ofboot.b file is a way to give boot options and configuration
to Open Firmware. I haven't used it on a CHRP system, but on a Mac
it allows you to set an icon for a drive and load a secondary
bootloader. The ofboot.b file is generally given the HFS file
type of tbxi to fit in with the default settings Apple sets. Here
are the relevant files on a real install:

# hmount /dev/sda2
Volume name is "bootstrap"
Volume was created on Sat Jul 10 23:10:57 2004
Volume was last modified on Sun Jul  3 13:43:28 2005
Volume has 649216 bytes free
# hls -l
f  tbxi/UNIX         0      3109 Jul  3  2005 ofboot.b
f  boot/UNIX         0    149740 Jul  3  2005 yaboot
f  conf/UNIX         0       714 Jul  3  2005 yaboot.conf
# 

The yaboot bootloader can be set directly in the firmware or it
can be referenced from the ofboot.b file. My system has the following
command set as one of the possibilities in ofboot.b:

: bootyaboot " Loading second stage bootstrap..." .printf 100 ms load-base release-load-area " /ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0:2,\\yaboot" $boot ;

This is telling the firmware to create a command bootyaboot that will
load and run the file yaboot in the blessed folder on the 2nd partition
on the SATA disk. The ofboot.b file also has a menu to choose a boot
method which can run this command based on the user input.

With an Open Firmware that can directly load an ELF file, the yaboot
file could be specified as the boot-file setting. This would mean
that the firmware would always load yaboot as the normal boot process.

        Brad Boyer
        flar@allandria.com



Reply to: