Help regarding the second stage loader

Philip Schulz ph.schulz at gmx.de
Tue Apr 10 17:00:20 UTC 2007


Hi,

on 10.04.2007 16:59 Uhr vinay hegde said the following:

> Can someone please let me know the place of the second
> stage bootloader for FreeBSD PPC kernel under the
> source trunk? I believe, it'll be something similar to
> what linux does (under arch/ppc/boot/simple,
> arch/ppc/boot/common and arch/ppc/kernel directories).

I don't know how Linux "officially" boots on PowerPC, however I load
yaboot which in turn loads the kernel. I don't think yaboot is
maintained with the kernel but rather as a separate project.


> I browsed thru' the FreeBSD boot directories
> (sys/boot/powerpc/loader directory), but couldn't find
> any second stage loader code. 
> 

FreeBSD's loader code is spread under sys/boot. Relevant parts are not
only sys/boot/powerpc/loader, but also the Forth-interpreter in
sys/boot/ficl. Additionally, the files in sys/boot/ofw contain code to
talk to Open Firmware, used for example to load the kernel, e.g. from 
disk or network. The sys/boot/common directory seems to contain the 
parts relevant for all platforms like the ELF loader.

The way FreeBSD/powerpc boots is slightly different from how FreeBSD
boots on a PC. You can load and start the kernel directly from Open
Firmware since it's an ELF file. However, that only works if the kernel
resides on a filesystem the Open Firmware implementation understands and
if you don't need to set any boot flags. Unfortunately, the
implementation found on Apples computers does not know UFS(2). So a
different approach (and I think that one is recommended) is to start the
loader which will be able load the kernel, also from the / filesystem,
and set boot flags (verbose boot, boot to single user, etc.).

So in short: There is no second stage bootloader, only the loader and 
the kernel. Someone please correct me if I'm wrong.

HTH,

Phil.

-- 
Don't fix it if it ain't broke.



More information about the freebsd-ppc mailing list