Subject: boot blocks - all platforms / kernel ramdisk load from file system
To: tech-misc@netbsd.org, <tech-kern@netbsd.org>
From: Christopher Tribo <t1345@hopi.dtcc.edu>
List: tech-kern
Date: 02/24/2003 10:44:12
Background:

	I want to make a multi-purpose fully standalone NetBSD firewall 
CD-ROM with etc on floppy. Ideally the boot process would go something 
like this (on i386): 

- El Torito CD-ROM in hard disk emulation mode loads kernel with MD 
ramdisk stuffed into kernel.
- /etc/rc mounts floppy drive to /etc && invokes the actual rc system 
contained on it
- /etc/fstab mounts cdrom file system
- /usr file system mounted ro as vnd0 from iso9660 fs via fstab. (requires 
hacking rc.d and/or extending mount?)


	This hits several big hurdles:

-i386, El Torito hard disk emulation mode has near-zero documentation. The 
documentation that does exist only makes mention of hacking together a FAT 
file system or reading a memory image directly into main memory and 
executing it. Neither are currently possible with NetBSD, the i386 boot 
blocks can't find the kernel on hd0a when I tried hard disk emulation 
mode. I did some searching through the archives and found that the boot 
blocks would have to be extended to work with either of this cases. 
There's also the question about putting ffs on a CD-ROM and being able to 
mount it. I know Ultrix was able to do this on PMAX somehow, but I don't 
know the specifics of it.

-macppc, here we run into limitations with OpenFirmware on old world 
machines (machines with floppy drives) that cannot boot a kernel larger 
than 3MB reliably. So stuffing the root ramdisk into the kernel is out.
There's also the small fact that there's no floppy disk driver for swim3 
yet. *sigh*

	So, I'm wondering if we can extend the boot blocks and the kernel 
itself to be able to find an MD image and mount it as the root file system 
from the boot loader (or any file system we support in the kernel) It 
would also be a good idea to add password protection to the boot blocks to 
prevent tampering. (on i386 at least)


i386 El Torito floppy disk emulation mode:
boot fd0a:netbsd root=cd0a:root.fs -a

macppc ISO9660/HFS hybrid (someday after a floppy disk driver is added):
0> boot cd:0,OFWBOOT.XCF root=cd:0,root.fs -a


	My reason for wanting this is so I can turn some antiquated i386 
hardware that can't do much else into a CD-ROM and floppy disk drive only 
firewall that can be thrown in a closet and not worried about. This would 
also have the byproduct of allowing a nearly complete GENERIC install 
kernel to be loaded on almost every platform we support without stuffing a 
ramdisk into the kernel.

	I do realize that there are other ways around this, like using a 
hard drive, ZIP drive or USB dongles or some such, neither of which are 
reliable or cost effective. The design goals of this project are make a 
64MB Pentium class or better machine with no hard disk drive run a full 
system that can be easilly modified and duplicated across dozens of 
machines.

	Thanks for reading my discombobulated thoughts, any help or 
suggestions are greatly appreciated.

 -- 
I'm trying to port NetBSD to my cup of tea, but it keeps kernel panicking 
on refill. This is odd, because I ported it to my toaster and my bookcase 
easily enough and it survives bread- and book-replacement fine.

Any hints?

Jared Earle - http://mail-index.netbsd.org/tech-ports/2002/07/04/0000.html