Subject: Re: mfs root without using kernel's memory disk storage area?
To: Jeremy C. Reed <reed@reedmedia.net>
From: Luke Mewburn <lukem@wasabisystems.com>
List: netbsd-help
Date: 03/08/2002 16:54:19
On Thu, Mar 07, 2002 at 03:58:21PM -0800, Jeremy C. Reed wrote:
  | I want the "root on" to be a memory filesystem.
  | 
  | Using MEMORY_DISK_IS_ROOT doesn't seem like it will work for me due to the
  | 2.88MB limitation. Not enough room for mdsetimage (miscellaneous software
  | / root filesystem) and kernel. I don't want to use crunchgen and/or
  | symlinks.

The 2.88MB limitation is not a limit on the size of the memory disk,
it's a limit on the size of "floppy" file system image that the BIOS
can boot from the CD.  For NetBSD installation CD-ROMs, that contains
the "INSTALL" kernel which has a 2MB root file system stuffed into it,
and the result is gzip -9-ed. 

One possibly solution is to implement a "/boot" which is installed in
the 2.88MB "boot image" on the CD-ROM, and that "/boot" knows how to
find a NetBSD kernel on the ISO file system.  That NetBSD kernel can be
as big as you like (within reason, up to 32MB ?), and you can stuff
the memory disk into the tail end of that.

Your thoughts below seem sound.
I.e: 2.88MB "boot image" on the CD contains the kernel with a small
root file system containing an /etc/rc which does something like:
	- create an mfs on /newroot (e.g, 32MB)
	- mount cd on /cd
	- extract /cd/realroot.tar.gz into /newroot
	- umount /cd
	- chroot to /realroot and continue booting

If I recall correctly, the sparc installation does something like
this. The kernel contains a "micro root" which knows how to bring up a
miniroot :)

What's the objection to using crunchgen for the microroot and miniroot
file systems?  You save a lot of space by using it.

You can specify the size of the memory disk with MINIROOTSIZE.
(Arguably that should be MEMORY_DISK_SIZE. In fact, I might change
that now).


  | I already have a bootable CD-based system -- even with a VESA-ready X. I
  | am using "root on cd0a", but I want the speed of using a mfs for /bin,
  | /sbin, /etc, /tmp, /var. In other words, everything on mfs except /usr
  | (which is on CD). (I am going to use this CD for my classes, so I no
  | longer have to waste time installing the school's/student's computers.)
  | 
  | My ideas:
  | 
  | Build a small root image that has rc that creates a new mfs (or
  | memory disk) and then populates it with all the files. Then change the
  | "root on" to use it.
  | 
  | Or have "root on cd0" that  has an rc that creates a mfs and copies files
  | to it and then changes "root on" to it.
  | 
  | Can "chroot" be used to change the kernel's idea for "root on ?"?
  | 
  | Can I use MEMORY_DISK_IS_ROOT without using mdsetimage? (Point it to some
  | other bigger than 2.88MB image on the CD?)
  | 
  | Any other suggestions?
  | 
  |    Jeremy C. Reed
  |    http://www.reedmedia.net/

-- 
Luke Mewburn  <lukem@wasabisystems.com>  http://www.wasabisystems.com
Luke Mewburn     <lukem@netbsd.org>      http://www.netbsd.org
Wasabi Systems - NetBSD hackers for hire
NetBSD - the world's most portable UNIX-like operating system