linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] A stand-alone boot loader for PReP
@ 2003-05-31 20:36 Leigh Brown
  2003-05-31 21:49 ` Ethan Benson
  0 siblings, 1 reply; 7+ messages in thread
From: Leigh Brown @ 2003-05-31 20:36 UTC (permalink / raw)
  To: linuxppc-dev


Hi,

[If you bore easily: http://www.solinno.co.uk/leigh/pablo/pablo-0.2.tar.gz ]

Ever since I got Linux going on my PReP box I've been unhappy about the
boot loader.  There is no lilo or yaboot equivalent for PReP and it's a
pain.  For the past several months I've been trying to devise a way of
making a bootloader similar to lilo or yaboot, and this is the best I've
been able to come up with.

PABLO, the "PReP Architecture Boot LOader", has a great name, and in fact
that's probably the best thing about it right now.  Although it's far
from finished, I have actually managed to boot with it, which is a start.

At this point I'm interested in feedback on the basic concept and
implementation, especially if there is some fatal flaw that I've not
noticed.

The boot loader code (which is 90% the same as the old loader) has been
changed to be fully relocatable.  Instead of relocating the loader on
startup it fixes up the relocation entries.  The loader now compiles
into a standalone ELF executable with no attached kernel images.  The
ELF header is stripped off and the loader is written to disk when the
boot image is created.

The pablo frontend itself works much in the same way as lilo (I
modelled the config file on lilo's).  When you run pablo it reads the
config file, locates the kernel images specified in the config and
creates an appropriate prep image that it writes directly to the
prep boot partition (or any file you like).  I haven't implemented
ramdisk and System.map just yet, but the support is in there.  It
does support multiple images and I've used it boot dual-boot between
a 2.4 and 2.5 kernel.

The boot image construction takes advantage of the fact that the
PReP spec specifies an offset into the boot image at which execution
of the code starts.  The boot image is written as shown below (sorry
for the crappy ascii art):

+----------------------------+ 0x0000
|                            |
| x86 compatible boot sector |
|                            |
+----------------------------+ 0x0100
|              ENTRY POINT >-+----+
|                            |    |
|        PReP header         |    |
|                            |    |
+----------------------------+    |
|      Table of contents     |    |
+----------------------------+    |
|                            |    |
|         vmlinux.gz         |    |
|                            |    |
+----------------------------+    |
|                            |    |
|         ramdisk            |    |
|                            |    |
+----------------------------+    |
              .                   |
              .                   |
              .                   |
+----------------------------+ <--+
|                            |
|          loader            |
|                            |
+----------------------------+

The offset points to the first address of the boot loader.  The table
of contents contains a list of offsets to the various kernel images
and so on contained within the boot image.  The images are written
after the table of contents.  The loader itself must be written last
to avoid the BSS area overlapping other areas of the boot image.

When the boot loader starts it uses the passed offset to the start
of the boot image to determine where the table of contents resides.
It then uses the table of contents to display a prompt, select the
appropriate kernel and so on.  The table of contents also holds
default arguments for each image, that will be passed to the running
kernel via BI_RECS.

You can download it from here:

http://www.solinno.co.uk/leigh/pablo/pablo-0.2.tar.gz

That's it really.  Any feedback is appreciated.

Cheers,

Leigh.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] A stand-alone boot loader for PReP
  2003-05-31 20:36 [RFC] A stand-alone boot loader for PReP Leigh Brown
@ 2003-05-31 21:49 ` Ethan Benson
  2003-06-01 13:57   ` Leigh Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Ethan Benson @ 2003-05-31 21:49 UTC (permalink / raw)
  To: linuxppc-dev


On Sat, May 31, 2003 at 09:36:41PM +0100, Leigh Brown wrote:
>
> [If you bore easily: http://www.solinno.co.uk/leigh/pablo/pablo-0.2.tar.gz ]
>
> Ever since I got Linux going on my PReP box I've been unhappy about the
> boot loader.  There is no lilo or yaboot equivalent for PReP and it's a
> pain.  For the past several months I've been trying to devise a way of
> making a bootloader similar to lilo or yaboot, and this is the best I've
> been able to come up with.

I have been working (slowly due to lack of time) on a complete rewrite
of yaboot, the plan is for it to support any OF based hardware (not
limited to powerpc), and to design it in a general way so it can
accomidate the various ways different architectures boot.

to start with im writing a prom-libc library so all the usual stdc
stuff doesn't have to be reinvented crappilly like every other loader
seems to do, as well as get the prom specific stuff out of bootloaders
and into a common place (it also should allow for a bootloader which
is designed well enough to be more easily portable to different prom
types so long as prom-libc has support). it will also allow the
bootloader to be written much more like ordinary unix C programs,
making them more portable (don't port the loader, port prom-libc).

my goal is to eliminate the need for a different bootloader for every
variation of hardware, i particularly hate how there is a dozen
different loaders all with different user interfaces just for powerpc,
much less other architectures.

I would much appreciate help with the yaboot2.0 project, if anyone is
interested contact me privatly, or on the yaboot-devel list
(http://lists.penguinppc.org/yaboot-devel).

--
Ethan Benson
http://www.alaska.net/~erbenson/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] A stand-alone boot loader for PReP
  2003-05-31 21:49 ` Ethan Benson
@ 2003-06-01 13:57   ` Leigh Brown
  2003-06-01 22:12     ` Ethan Benson
  0 siblings, 1 reply; 7+ messages in thread
From: Leigh Brown @ 2003-06-01 13:57 UTC (permalink / raw)
  To: linuxppc-dev


Ethan Benson said:
>
> On Sat, May 31, 2003 at 09:36:41PM +0100, Leigh Brown wrote:
>>
>> [If you bore easily:
>> http://www.solinno.co.uk/leigh/pablo/pablo-0.2.tar.gz ]
>>
>> Ever since I got Linux going on my PReP box I've been unhappy about
>> the boot loader.  There is no lilo or yaboot equivalent for PReP and
>> it's a pain.  For the past several months I've been trying to devise a
>> way of making a bootloader similar to lilo or yaboot, and this is the
>> best I've been able to come up with.
>
> I have been working (slowly due to lack of time) on a complete rewrite
> of yaboot, the plan is for it to support any OF based hardware (not
> limited to powerpc), and to design it in a general way so it can
> accomidate the various ways different architectures boot.
>
> to start with im writing a prom-libc library so all the usual stdc stuff
> doesn't have to be reinvented crappilly like every other loader seems to
> do, as well as get the prom specific stuff out of bootloaders and into a
> common place (it also should allow for a bootloader which is designed
> well enough to be more easily portable to different prom types so long
> as prom-libc has support). it will also allow the
> bootloader to be written much more like ordinary unix C programs,
> making them more portable (don't port the loader, port prom-libc).
>
> my goal is to eliminate the need for a different bootloader for every
> variation of hardware, i particularly hate how there is a dozen
> different loaders all with different user interfaces just for powerpc,
> much less other architectures.

Unfortunately I think a PReP boot loader is largely orthogonal to an
OF based loader.  Even PReP boxes that have OF don't support enough
services for yaboot (in any form) to work.  Most PReP boxes don't
have OF or even allow any firmware calls from within the boot loader.
With PReP everything you need to bring up the O/S has to be held on
the boot partition and loaded into memory at boot time.

Cheers,

Leigh.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] A stand-alone boot loader for PReP
  2003-06-01 13:57   ` Leigh Brown
@ 2003-06-01 22:12     ` Ethan Benson
  2003-06-02  8:26       ` Remco Post
  2003-06-02 17:40       ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Ethan Benson @ 2003-06-01 22:12 UTC (permalink / raw)
  To: linuxppc-dev


On Sun, Jun 01, 2003 at 02:57:07PM +0100, Leigh Brown wrote:
>
> Ethan Benson said:
> >
> > On Sat, May 31, 2003 at 09:36:41PM +0100, Leigh Brown wrote:
> >>
> >> [If you bore easily:
> >> http://www.solinno.co.uk/leigh/pablo/pablo-0.2.tar.gz ]
> >>
> >> Ever since I got Linux going on my PReP box I've been unhappy about
> >> the boot loader. There is no lilo or yaboot equivalent for PReP and
> >> it's a pain. For the past several months I've been trying to devise
> >> a way of making a bootloader similar to lilo or yaboot, and this is
> >> the best I've been able to come up with.
> >
> > I have been working (slowly due to lack of time) on a complete
> > rewrite of yaboot, the plan is for it to support any OF based
> > hardware (not limited to powerpc), and to design it in a general way
> > so it can accomidate the various ways different architectures boot.
> >
> > to start with im writing a prom-libc library so all the usual stdc
> > stuff doesn't have to be reinvented crappilly like every other
> > loader seems to do, as well as get the prom specific stuff out of
> > bootloaders and into a common place (it also should allow for a
> > bootloader which is designed well enough to be more easily portable
> > to different prom types so long as prom-libc has support). it will
> > also allow the bootloader to be written much more like ordinary unix
> > C programs, making them more portable (don't port the loader, port
> > prom-libc).
> >
> > my goal is to eliminate the need for a different bootloader for
> > every variation of hardware, i particularly hate how there is a
> > dozen different loaders all with different user interfaces just for
> > powerpc, much less other architectures.
>
> Unfortunately I think a PReP boot loader is largely orthogonal to an
> OF based loader. Even PReP boxes that have OF don't support enough
> services for yaboot (in any form) to work. Most PReP boxes don't have
> OF or even allow any firmware calls from within the boot loader. With
> PReP everything you need to bring up the O/S has to be held on the
> boot partition and loaded into memory at boot time.

then why do you have a of1275 interface in your loader?

basically prep OF is more broken then apple's oldworld? now thats
impressive...

--
Ethan Benson
http://www.alaska.net/~erbenson/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] A stand-alone boot loader for PReP
  2003-06-01 22:12     ` Ethan Benson
@ 2003-06-02  8:26       ` Remco Post
  2003-06-02 17:40       ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Remco Post @ 2003-06-02  8:26 UTC (permalink / raw)
  To: Ethan Benson; +Cc: linuxppc-dev


On Sun, 1 Jun 2003 14:12:49 -0800
Ethan Benson <erbenson@alaska.net> wrote:

>
> On Sun, Jun 01, 2003 at 02:57:07PM +0100, Leigh Brown wrote:
> > Unfortunately I think a PReP boot loader is largely orthogonal to an
> > OF based loader. Even PReP boxes that have OF don't support enough
> > services for yaboot (in any form) to work. Most PReP boxes don't have
> > OF or even allow any firmware calls from within the boot loader. With
> > PReP everything you need to bring up the O/S has to be held on the
> > boot partition and loaded into memory at boot time.
>
> then why do you have a of1275 interface in your loader?
>
> basically prep OF is more broken then apple's oldworld? now thats
> impressive...
>

Well, I happen to own a motorola powerstack 2, I don't think there is
anything to do with OF in there....

--
Met vriendelijke groeten,

Remco Post

SARA - Stichting Academisch Rekencentrum Amsterdam    http://www.sara.nl
High Performance Computing  Tel. +31 20 592 8008    Fax. +31 20 668 3167

"I really didn't foresee the Internet. But then, neither did the computer
industry. Not that that tells us very much of course - the computer industry
didn't even foresee that the century was going to end." -- Douglas Adams

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] A stand-alone boot loader for PReP
  2003-06-01 22:12     ` Ethan Benson
  2003-06-02  8:26       ` Remco Post
@ 2003-06-02 17:40       ` Tom Rini
  2003-06-03  6:43         ` Ethan Benson
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2003-06-02 17:40 UTC (permalink / raw)
  To: linuxppc-dev


On Sun, Jun 01, 2003 at 02:12:49PM -0800, Ethan Benson wrote:
>
> On Sun, Jun 01, 2003 at 02:57:07PM +0100, Leigh Brown wrote:
> >
> > Ethan Benson said:
> > >
> > > On Sat, May 31, 2003 at 09:36:41PM +0100, Leigh Brown wrote:
> > >>
> > >> [If you bore easily:
> > >> http://www.solinno.co.uk/leigh/pablo/pablo-0.2.tar.gz ]
> > >>
> > >> Ever since I got Linux going on my PReP box I've been unhappy about
> > >> the boot loader. There is no lilo or yaboot equivalent for PReP and
> > >> it's a pain. For the past several months I've been trying to devise
> > >> a way of making a bootloader similar to lilo or yaboot, and this is
> > >> the best I've been able to come up with.
> > >
> > > I have been working (slowly due to lack of time) on a complete
> > > rewrite of yaboot, the plan is for it to support any OF based
> > > hardware (not limited to powerpc), and to design it in a general way
> > > so it can accomidate the various ways different architectures boot.
> > >
> > > to start with im writing a prom-libc library so all the usual stdc
> > > stuff doesn't have to be reinvented crappilly like every other
> > > loader seems to do, as well as get the prom specific stuff out of
> > > bootloaders and into a common place (it also should allow for a
> > > bootloader which is designed well enough to be more easily portable
> > > to different prom types so long as prom-libc has support). it will
> > > also allow the bootloader to be written much more like ordinary unix
> > > C programs, making them more portable (don't port the loader, port
> > > prom-libc).
> > >
> > > my goal is to eliminate the need for a different bootloader for
> > > every variation of hardware, i particularly hate how there is a
> > > dozen different loaders all with different user interfaces just for
> > > powerpc, much less other architectures.
> >
> > Unfortunately I think a PReP boot loader is largely orthogonal to an
> > OF based loader. Even PReP boxes that have OF don't support enough
> > services for yaboot (in any form) to work. Most PReP boxes don't have
> > OF or even allow any firmware calls from within the boot loader. With
> > PReP everything you need to bring up the O/S has to be held on the
> > boot partition and loaded into memory at boot time.
>
> then why do you have a of1275 interface in your loader?
>
> basically prep OF is more broken then apple's oldworld? now thats
> impressive...

I suspect it's because some PReP boxes (IBM ones, _mostly_) have
OpenFirmware.  And yes, there's a few versions of OF that are as funky,
if not funkier, than the one Apple uses.  But, as the 2.5 kernel shows,
the OF code can be shared.  The problem is that not all PReP boxes
support OF, so yaboot2 won't work on them.  Unless you're up for
allowing non-OF machines. :)

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] A stand-alone boot loader for PReP
  2003-06-02 17:40       ` Tom Rini
@ 2003-06-03  6:43         ` Ethan Benson
  0 siblings, 0 replies; 7+ messages in thread
From: Ethan Benson @ 2003-06-03  6:43 UTC (permalink / raw)
  To: linuxppc-dev


On Mon, Jun 02, 2003 at 10:40:32AM -0700, Tom Rini wrote:
>
> I suspect it's because some PReP boxes (IBM ones, _mostly_) have
> OpenFirmware.  And yes, there's a few versions of OF that are as funky,
> if not funkier, than the one Apple uses.  But, as the 2.5 kernel shows,
> the OF code can be shared.  The problem is that not all PReP boxes
> support OF, so yaboot2 won't work on them.  Unless you're up for
> allowing non-OF machines. :)

i am not opposed to it, prom-libc is designed so the prom specific
stuff is simply a sysdep, it can be ported to pretty much any prom on
any architecture.  so long as the bootloader (yaboot) avoids using low
level prom calls wherever possible it will be easily portable to any
new arch prom-libc is ported to.

--
Ethan Benson
http://www.alaska.net/~erbenson/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-06-03  6:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-31 20:36 [RFC] A stand-alone boot loader for PReP Leigh Brown
2003-05-31 21:49 ` Ethan Benson
2003-06-01 13:57   ` Leigh Brown
2003-06-01 22:12     ` Ethan Benson
2003-06-02  8:26       ` Remco Post
2003-06-02 17:40       ` Tom Rini
2003-06-03  6:43         ` Ethan Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).