Subject: Re: Newbie looking to figure out how to do a port!
To: Peter Seebach <>
From: Nathan J. Williams <>
List: tech-ports
Date: 02/15/2006 12:27:16 (Peter Seebach) writes:

> But around here I find I don't really know that much about how the very very
> early parts of NetBSD's boot process happen.  It seems to me that it's
> probably reasonable to just use redboot instead of the native bootloader,
> so the kernel can be loaded into memory at whatever address I choose to link
> it at, but...

For systems like this, there generally isn't a "native bootloader" in
the sense of /boot on an i386 system; just have RedBoot load and jump
to the kernel. You need to pick an address above where RedBoot is, as
it doesn't relocate itself or anything like that.

> So far as I know, despite my near total ignorance of this part of the kernel,
> I'm not actually dumb, I just don't know enough yet to know which questions to
> ask.  Assuming that RedBoot can load an ELF kernel and transfer execution
> to _start, what should happen next?

__start, actually. Look in obs200_locore.S and read from there; there
are a couple of obvious addresses that may need tweaking, and from
there it jumps into initppc() in obs200_machdep.c. You should be able
to walk the code from there and find the bits that are
obs-specific. Once you have the console going (consinit()), you should
be able to debug your way to happiness; before that, you may need a
couple of debugging aids to figure out where your code is. LEDs can be
helpful here, as can hand-crafted routines to dump a few bytes on the
serial port in the state RedBoot left it in before consinit() runs.

        - Nathan