Skip to contentSkip to conversation

boot loader

parisc-linux Paul Bame 3 participants 4 messages Oct 22, 1999

lore
Share & tools
lore

Paul Bame

author
#0 lore raw

Here's a sketch of a new (really, mostly stolen from other places like the existing boot_code code) boot loader for parisc. It's aimed at solving some of our current problems (like linking ramdisks into the kernel) and being good enough to live on for a while, and be easily replaced if it starts to smell bad.

In order to use HP boot firmware, our disk layout has to look at least somewhat like a LIF volume (as it does today), so it makes sense to use LIF for a few other things too. LIF is a very simple file system layout -- almost as simple as the one we were going to use for ramdisks.

My proposal is to have a LIF volume on the beginning of any disk from which one might boot. Make that LIF volume at least 2Mb, and maybe 10Mb if you want to store several kernels and ramdisk images. Here are the files it would hold:

IPL Pretty much the boot loader we're using today
with some LIF intelligence added
vmlinuz The kernel image, put there with the 'lifcp'
command. Could have several kernels on the LIF volume and boot any of them.
cmdline The default, or the last?, command line used
to boot Linux. Could possibly have several different command lines in one or several files but the UI for this needs thought.
ramdisk One or more files containing ramdisk images
ptable Partition table -- see below

During boot, the IPL is same as today. It presents a command line just like today, from the 'cmdline' file if one is available. On the command line you can select which kernel to boot if you have more than one and enter the normal Linux command-line parameters. There'll be some little extension to handle specifying which ramdisk image you want, which is stripped off by the IPL and not passed to the kernel in that form. The HP firmware would continue to be used, as it is today, to select whether you want to interact with the boot loader command line or not.

When the command line is committed, the ramdisk and kernel are loaded just like they are today (using the same code probably) the kernel is told how to find the ramdisk image (need to learn how this is done).

Non-bootable disks can skip the LIF volume header altogether, though they might want it just in case they want to be bootable in the future.

Partition Table

I suggest we place the partition table at a fixed low address on the disk such that it can appear as a file in the LIF file system on disks which have them, and be in the same location on non-LIF disks just there wouldn't be any LIF sugar around it. This way the table's always in the same place which is easy for the tools which use it, and it's a LIF file too which might be convenient. Alex suggests we re-use maybe the sparc partition table format?

Development Cycle

After building a new kernel, you'd have to
'lifcp <the-kernel-image> /dev/sda:vmlinuz' instead of doing 'mkImage' like we do today. It's also cool that the ramdisk isn't linked into the kernel.

If you already have HP-UX

The existing HP-UX LIF volume header has less than 300k of free space, so it wouldn't be large enough to hold vmlinuz, therefore you can't boot from an existing HP-UX volume. Which means if you want to keep your HP-UX disk intact, you'll have to add another disk for Linux, and I think the firmware can handle booting from one of several disks just fine.

Tools

lifinit and lifcp should already be able to handle the LIF stuff, so no new C code required to build the LIF volumes. We can probably talk HP into open sourcing the LIF commands, and if not can grab the ones from OpenBSD. For now we can use the ones on HP-UX. [I suspect the HP ones are not byte-order safe (yet).]

Future

It's relatively easy to replace IPL (and vmlinuz for that matter) in the scheme above with wonderful new stuff when we figure out what that is. The firmware and existing disk headers wouldn't have to change to accomodate a new boot loader.

The Name

BTW the current contender for the name, instead of hilo, is palo for PArisc LOader. It is also a reminder of of Palo Alto which is where HP began.

Comments?

-Paul Bame

#1 lore raw

Hi,

Quoted 5 lines

My proposal is to have a LIF volume on the beginning of any disk from which one might boot. Make that LIF volume at least 2Mb, and maybe 10Mb if you want to store several kernels and ramdisk images. Here are the files it would hold:

Quoted 11 lines

IPL Pretty much the boot loader we're using today
with some LIF intelligence added
vmlinuz The kernel image, put there with the 'lifcp'
command. Could have several kernels on the LIF volume and boot any of them.
cmdline The default, or the last?, command line used
to boot Linux. Could possibly have several different command lines in one or several files but the UI for this needs thought.
ramdisk One or more files containing ramdisk images
ptable Partition table -- see below

As long as you don't want to use LIF utilities to access those files, lowercase should be okay.

The LIF tools won't accept lowercase filenames.
Why care? Because you could possibly boot HP-UX and use the LIF tools to manipulate the vmlinuz file, for example.

Example:

Oz(su) /: lifcp test /dev/dsk/c0t0d0:vmlinuz
lifcp: Cannot create vmlinuz ; improperly formatted LIF name
Oz(su) /:

(BTW, the lifcp "-t" option won't help)

I'd suggest using uppercase, and making the IPL smart enough to allow user-entry of lowercase (which gets mapped to uppercase)

Quoted 4 lines

After building a new kernel, you'd have to
'lifcp <the-kernel-image> /dev/sda:vmlinuz' instead of doing 'mkImage' like we do today. It's also cool that the ramdisk isn't linked into the kernel.

Note: my lifcp test was on 10.20

Quoted 5 lines

lifinit and lifcp should already be able to handle the LIF stuff, so no new C code required to build the LIF volumes. We can probably talk HP into open sourcing the LIF commands, and if not can grab the ones from OpenBSD. For now we can use the ones on HP-UX. [I suspect the HP ones are not byte-order safe (yet).]

If that happens, we could support lowercase.

Quoted 5 lines

The Name

BTW the current contender for the name, instead of hilo, is palo for PArisc LOader. It is also a reminder of of Palo Alto which is where HP began.

Great name!

Signature · 2 lines
Stan Sieler                                          [email protected]
                                         http://www.allegro.com/sieler/
#3 lore raw
In reply to Paul Bame
Quoted 7 lines · Paul Bame

Here's a sketch of a new (really, mostly stolen from other places like the existing boot_code code) boot loader for parisc. It's aimed at solving some of our current problems (like linking ramdisks into the kernel) and being good enough to live on for a while, and be easily replaced if it starts to smell bad.

...

Quoted 6 lines

BTW the current contender for the name, instead of hilo, is palo for PArisc LOader. It is also a reminder of of Palo Alto which is where HP began.

Comments?

My only comments are "keep it small and simple" and don't spend a lot of time on it. This was my "philosophy" when I first wrote the bootloader -- after all, it is just a bootloader. The whole idea was to spend a day or two writing it, so we could get to the _interesting_ stuff -- the kernel. In fact, the only reason I wrote a bootloader (instead of lifting the one from, say, mklinux) was to have a compact and simple one.

However, I'm all for cleaning it up a bit. The original code was actually quite nice and well-commented, especially considering the haste in which it was written. It has since degraded a shade after some hacking by others (as well as gaining functionality -- ELF loading, for example -- by the way, does that actually work?).
As far as naming goes, PALO, HILO, doesn't really matter to me although PALO is as cute as any. I like my original, verbose and iconoclastic name "PARISC/Linux Bootstrap v0.1" :).

If you're really fired up, help out on the kernel. I'm confident Alex and Chris can find something that needs to be written! (I'm looking for time myself -- between more than full-time work at Cygnus, grad school at Rice, and 3 kids, I'm having trouble helping out much these days).

Have fun, jason.

#2 lore raw
In reply to Stan Sieler

Re:

Quoted 3 lines

The LIF tools won't accept lowercase filenames.
Why care? Because you could possibly boot HP-UX and use the LIF tools to manipulate the vmlinuz file, for example.

...

Quoted 1 line

Note: my lifcp test was on 10.20

I also tested on HP-UX 11.00, with the same result.

Signature · 2 lines
Stan Sieler                                          [email protected]
                                         http://www.allegro.com/sieler/