Subject: Re: ofwboot.xcf issues
To: Luke Mewburn <lukem@NetBSD.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: port-macppc
Date: 11/30/2003 16:38:50
--4jXrM3lyYWu4nBt5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Nov 30, 2003 at 11:29:17PM +1100, Luke Mewburn wrote:
> On Sat, Nov 29, 2003 at 02:41:45PM +0900, Izumi Tsutsui wrote:
>   | What I said is that we have to sync DEFAULT_ENTRY_POINT in bootxx
>   | and RELOC (which is also passed to ld for TEXT address) in ofwboot.
>=20
> How hard is it to parse RELOC out of ofwboot ?

How hard is it to rip values out of a binary (objcopy -O binary) file? :-) =
=20
That's what ofwboot is, and that's what we'd have to do. We could do the
trick of finding magic values, like how installboot encodes block numbers
in bootxx.

> If it's easy, then installboot/arch/macppc.c could read "boot" from
> the root of the file system, parse RELOC, frob an extended version
> of the shared_bbinfo params block in bootxx (to replace DEFAULT_ENTRY_POI=
NT),
> and then the two values would be in sync.

Modulo the "how do we store it" problem, that would work.

If we did the structure with magic values, something like:

uint32_t	entry_point_magic[3] =3D {ENTRY_MAGIC_1, ENTRY_MAGIC_2,=20
					start};

in C would do the trick.

> Of course, if possible we actually want to move away from the "bbinfo"
> style bootblock to one where bootxx knows how to read the file system
> to find /boot, so this approach wouldn't work for that goal.

I'm not really sure how much space we have/don't have. So I don't know if=
=20
a bootxx_fs approach would work. It'd be nice if we could make it work.

> Another approach is to pass the DEFAULT_ENTRY_POINT from bootxx to
> ofwboot via a register or flag, and have a DEFAULT if that isn't set.
> Do all macppc boxes use bootxx to load ofwboot, or just the older OF1
> and OF2 boxes?

Problem is that DEFAULT_ENTRY_POINT is the entry point of ofwboot! bootxx
will always know where it reads in ofwboot and thus it can always jump to
the right point. Since we use pre-relocated code, though, we have to have=
=20
loaded the code in the same place that the linker expected it to be=20
placed.

I'm not sure, but if we could make ofwboot a completely-pic module that=20
has no unresolved relocations, then we could make it work w/o=20
DEFAULT_ENTRY_POINT.

Take care,

Bill

--4jXrM3lyYWu4nBt5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQE/yo2aWz+3JHUci9cRAqsTAJ43bv4nXmsMx3frqCN6JTSLj+Jm9QCdE0d6
DKTX1hUm7VLOWdbYl+06ji0=
=nW3p
-----END PGP SIGNATURE-----

--4jXrM3lyYWu4nBt5--