Subject: Re: building an embedded NetBSD
To: None <>
From: Ross Patterson <Ross.Patterson@CatchFS.Com>
List: current-users
Date: 05/06/2003 15:56:21
On Tuesday 06 May 2003 03:00 pm, Paul Dokas wrote:
> Can anyone please shed a little light on
> how the i386 boot floppies are actually created?  

Check out /usr/src/distrib/i386/floppies/*.  There you'll find a bunch of 
subdirs, named ramdisk-*, kernel-*, and bootfloppy-*.  The basic process is:

	1) "(cd ramdisk-<name> && make)" to create the memory-disk filesystem image.

	2) "(cd kernel-<name> && make)" to insert that filesystem image into a space 
reserved in the kernel by the MEMORY_DISK_* options.

	3) "(cd bootfloppy-<name> && make)" to build a bootable floppy disk image 
containing that kernel (and therefore your disk image as well).

	4) Somehow get your floppy image into your boot device (assuming you're not 
actually going to boot the floppy drive).

We use this process to build a bootable CD-ROM that runs our product-install 
process (instead of sysinst et al.).  NetBSD 1.6 made the process a lot 
easier than it used to be, now the only "fun" part is figuring out exactly 
what we want on that memory filesystem.  Step 4 is pretty simple for this 
case, because mkisofs takes a bootfloppy-image and makes it the bootable 
portion of the CD-ROM.

These memory filesystems tend to be quite small, and therefore frequently use 
an unusal technique called "crunchgen" to build one large staticly-linked 
executable containing as many of the desired commands as possible.  This 
saves on disk space quite a bit, and it's where most of the complexity in the 
ramdisk-* subdirs comes from (e.g., the "list" file).
Ross A. Patterson
Chief Technology Officer
CatchFIRE Systems, Inc.
5885 Trinity Parkway, Suite 220
Centreville, VA  20120
(703) 563-4164