Subject: Re: Has anyone tried building -current as non-root from scratch recently?
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Tero Kivinen <kivinen@ssh.fi>
List: current-users
Date: 03/29/2001 19:44:49
simonb@wasabisystems.com (Simon Burge) writes:
> Greg A. Woods wrote:
> This doesn't help cross-compiles.  A better solution is to have a
> generic userland tool to build filesystem images so that there are
> no kernel dependancies at all.  This is part of the "There's work
> in progress..." bit that Luke mentioned.

I once created small program that will write files to the ffs floppy.
It could not create new files, nor extended existing files, but it
allowed you to replace existing files with another...

This program was quite small something like ~600 lines...

With this kind of tool you could populate a template floppy with new
binaries. This method does not allow adding of new programs to the
floppy, or changing the sizes of them, but if you have template
flopppy containing all the files you need, you could use this to fill
in the blanks on the floppy (it did allow you to truncate files to
proper length).

Those boot floppies usually only contain very few files, and the sizes
can be estimated quite well (or we could only add two files on the
boot floppy, the master-binary containing everything and a tar file,
which is untarred on the boot to the ramdisk containing everything
else (i.e most of the devices, all /etc config files, install scripts
etc).

This way the boot floppy would be:

/bin/sh -> symlink to /bin/tar
/bin/tar	  == master binary
/.profile	  == cd /; /bin/tar -xpf /rest.tar.gz; source /.profile
/rest.tar.gz	  == rest of the files
/dev/console	  == do we need any other devices? 

The disk size would be evenly split over the /bin/tar and
/rest.tar.gz, and they would be filled with zeros. The size of
/bin/tar and /rest.tar.gz could be quite big (2 MB each), so that
there is enough space for each. The ram disk could be something like 4
MB, filled with zeros. Then when the kernel boot image is build this
ramdisk will hopefully compress enough to fit on the floppy... If it
doesn't then we need to make either kernel, master binary or the
rest.tar.gz smaller and try again.

Making the ramdisk bigger also makes it easier to use the actual
floppy for resque disk also... 
-- 
kivinen@ssh.fi                               Work : +358 303 9870
SSH Communications Security                  http://www.ssh.fi/
SSH IPSEC Toolkit                            http://www.ssh.fi/ipsec/