Sun Open Firmware - insiders?

Arno Kletzander Arno_1983 at
Fri Dec 23 03:19:38 CST 2005

Just a quick progress indication:

My attempt of looking at the source of "boot" came to a halt at a
point a few word levels down in the code there's a [compile] 
directive followed by just fragments of text (the exact line is 
"[compile] ot image fai"). The debugger, which I'm learning to use
according to the instructions in the Quick Reference, gets turned
off right there and the usual messages ("Boot device: <foo>" etc.)
start to appear.

I've also read into the "FCode 3.x Reference Manual" (available for
free download from Sun) and found the following (quote):

> OpenBoot performs the following steps during the boot process:
> (...)
> The bootpath and bootargs properties in the /chosen node of the 
> device tree are set with the selected values.

At that point I decided to take a look at that node and its 
properties, amongst which I found to be "gateway-ip", "server-ip" 
and "client-ip", all initialized to "00 00 00 00". Those are most 
probably set according to the results of the rarp request. I can
modify them with
ok " "(<4 bytes adr>)" encode-bytes " <whatever>-ip" property

The "Writing FCode 3.x Programs" manual also has a lot of info 
about the netboot procedure (quote):

> TFTP Booting Support Package 
> The /obp-tftp package implements the Internet Trivial File 
> Transfer Protocol (TFTP) for use in network booting. It is 
> typically used by a network device driver for its first stage 
> network boot protocol. Again, load is the most important method 
> defined by this package. 
> This package uses the read and write methods of its parent, and
> defines the following methods: 
> Table 4-5 TFTP Package Methods 
> ----------------------------------------------------------------
> Name   Stack diagram  Description
> -----------------------------------------------------------------
> open   (-- flag)      Prepares the package for subsequent use,
>                       returning -1 if the operation succeeds and
>                       0 otherwise.
> close  (--)           Frees all resources that were allocated by
>                       open.
> load   (adr -- size)  Reads the default stand-alone program from
>                       the default TFTP server, putting the program
>                       at memory address adr and returning its
>                       length size. 
>                       For the standard Sun TFTP booting protocol, 
>                       RARP (Reverse Address Resolution Protocol)
>                       is used to acquire the IP address 
>                       corresponding to the system's MAC address 
>                       (equivalent to its Ethernet address). From 
>                       the IP address, the default file name is 
>                       constructed, of the form <Hex-IP-Address>.
>                       <architecture> (for example, C0092E49.SUN4C).
>                       Then obp-tftp tries to TFTP read that file, 
>                       first trying the server that responded to the
>                       RARP request, and if that fails, then 
>                       broadcasting the TFTP read request.
> -------------------------------------------------------------------

Obviously this method is called after I enter "boot net" (manually 
invoking it yields the same messages that usually come after "Boot
device: <foo>"), but I'm yet failing to see how control is transferred
between the two (also need to read more about how an instance of this
package is created as a child to le) and in order not to miss steps 
which set up critical variables or properties, I need to know what (if
anything) happens after the [compile] directive and before 
"/packages/obp-tftp/load" is executed.

The code inside that "load" seems pretty modular after all, with calls
like "do-rarp" and "tftpread", which I'm also going to take a closer look at
over the next few days. At least I hope I'll get to...

Season's greetings to everybody,

Arno Kletzander
Stud. Hilfskraft Informatik Sammlung Erlangen

10 GB Mailbox, 100 FreeSMS/Monat
+++ GMX - die erste Adresse für Mail, Message, More +++

More information about the cctalk mailing list