Subject: "helper kernels" that can load GENERIC, etc.
To: None <current-users@netbsd.org>
From: Andrew Gillham <gillhaa@ghost.whirlpool.com>
List: current-users
Date: 03/13/2000 17:08:54
Hello,

What is the feasibility of having "helper kernels" that can boot
another kernel from other media?  e.g. the BIOS supports ABC, but I need
to boot from XYZ, so I load a helper from ABC that has a driver for
XYZ that subsequently loads a full GENERIC kernel.
Cisco routers do something like this with the "boot" images (usually
in 'bootflash:') that then can pull down a full image via Frame-Relay
or anything else.
My application for this?  Well, initially it would be for my nice new
Netpliance Iopener, but I think it would be applicable to other ports.

I can think of a few immediate gains:
	Netbooting from USB (e.g. my Iopener)
	Booting from USB (e.g. ZIP, hard-drive, CDROM)
	Booting from a software RAID volume. (e.g. raidframe)
	Booting from a CCD stripe.
	Netbooting GENERIC on a NIC with no netboot code.
	Booting from NTFS or other "foriegn" filesystems.

I am mixing up the use of the term "booting" here though.  What I
mean is that the kernel is *loaded and executed* from the media, but
instead of being loaded by the second stage boot, it is loaded by the
helper kernel.  In turn, the helper kernel may be located on a floppy,
a FAT partition, a non-RAID volume, in FLASH (my Iopener), anywhere a
normal kernel would be loaded from.

I am not extremely familiar with how/where the kernel loads, but in theory
couldn't a kernel be built and linked to either relocate to a non-normal
location, or to be loaded there by the second stage?  Then the helper
kernel would probe all of the devices, but instead of trying to mount a
root filesystem, it would try to load a full kernel into the normal spot,
and turn control over to it.  Seems like the biggest hurdle would be
getting the kernel to cleanly shutdown and turn over control.

I'm thinking this would almost be like the Amiga hack of copying a new
kernel into /dev/XXXX to reboot with a new kernel.  (If I'm remembering
this correctly) 

A very, very minimal kernel could be built that contains exactly the
driver and filesystem needed to load the real kernel, and could be much
smaller, and easier to stuff into FLASH/ROM/floppy, etc.

Is this totally impossible?  Would trying to build a standalone USB 'boot'
be easier?  I'm thinking that this two-stage kernel idea would allow
more devices to be bootable since *all* kernel drivers would be usable for
booting, not just those that are pared down enough.

Obviously there is the overall issue of locating the helper kernel, but
for the systems listed above, a small, static, hardly ever changing helper
would be wonderful.

I am not familiar with the Netwinder, but I would think this is more or
less what the "Linux kernel firmware" on them does?

-Andrew
-- 
-----------------------------------------------------------------
Andrew Gillham                            | This space left blank
gillham@whirlpool.com                     | inadvertently.
I speak for myself, not for my employer.  | Contact the publisher.