Subject: Re: OFW bootloader needs OF_claim() before OF_read()?
To: None <port-macppc@netbsd.org>
From: Kirill Levchenko <klevchen@cs.ucsd.edu>
List: port-macppc
Date: 05/03/2004 18:26:51
On Friday, April 30, 2004, at 06:20  AM, Brian R. Gaeke wrote:

> I still haven't succeeded in completely loading a netbsd kernel
> using ofwboot.xcf on my G5, but I noticed that the OF_read() call was
> failing (return value = 0xffffffff, or -1) when it was trying to read
> the kernel text section into memory starting at address 0x100000.
>
> If I insert OF_claim() calls in loadfile_elf32.c just before every
> READ() call, such that all the area that is being read into is first
> claimed, then I get much farther in the loading process - it seems
> to be able to read all the kernel text, data & bss, but then it
> fails to read the symbol table, apparently. This failure I haven't
> figured out yet.
>
> Anyway, I'm kind of fuzzy on the intended semantics of OF_claim().
> Is it supposed to be true that you need to OF_claim() any memory
> which you are going to OF_read() into?  Is there a reference for
> this sort of information?

You need to claim any memory you use (think of claim like malloc). The 
reference for this is the OpenFirmware specification (search for 
of1275.pdf on Google).

However you only need claim in virtual mode, so try it in real mode. 
for this, do

	setenv real-mode? true
	reset-all

Kirill