[Soekris] NetBSD + flashcard layout strategy

David Young dyoung at ojctech.com
Fri Nov 29 20:57:18 UTC 2002


Jim,

I have been dealing with similar issues in NetBSD. Here are my findings,
so far.

Following a how-to for making a bootable FreeBSD CD-ROM, I have put /dev,
/etc, /var, /tmp, and /home onto their own ramdisks. I keep their contents
in a file /mfs.tgz, which I extract early in the bootstrap procedure. I
place / and /usr on the same read-only CompactFlash volume.

I do not think it is still necessary for me to put /dev onto a ramdisk,
because NetBSD 1.6 will do that automatically when it detects that /
is read-only. I think that it runs MAKEDEV and everything....

I put /etc onto ramdisk because sshd likes to write keys in there,
and dhclient likes to re-write /etc/resolv.conf, etc.

I put /var and /tmp in ramdisk for obvious reasons. For my convenience,
/home, too, goes on a small ramdisk.

I introduce a new dependency in /etc/rc.d, called mountcritmem, which
mounts the memory filesystems and extracts /mfs.tgz into them. Every
occurrence of dependency root, I replace with mountcritmem. I would not
do it that way, now. Instead, I would rename the 'root' dependency to
'roroot' and call my mountcritmem script 'root'.

More answers in-line.

On Fri, Nov 29, 2002 at 09:14:25AM -0500, Jim Miller wrote:
> 
> 1) "no namelist" on netstat - I have no kernel image in the root
>    ramdisk and cannot put one there since the kernel image contains
>    the root filesystem 

  This is solved if / is a read-only fs containing the kernel, and you
  extract /var, /tmp, /etc, /home, /dev from a tar file into ramdisks.

> 
> 2) /dev needs to be read-write no matter what? Lots of complaints
>    during the boot process if it is not.  Tried to put a minimal /dev
>    in the root memory disk image and then mount a new one over top of
>    it later but that confuses many programs.  Seems the /dev I boot
>    with has to stay there forever.

  /dev does need to be read-write. I believe init(1) creates it for you
  if /dev is read-only and if there is no /dev/console....

> 
> 3) is it possible to pare down the memory disk to contain only / and
>    /dev, and have everything else on flashcard filesystems that can be
>    mounted r/o to prevent write-cycle damage to the card?  If so, when
>    during boot would /usr/lib, /var, /usr/bin, etc have to become
>    available?

  /var is probably needed early. Consider making /var, /etc, ...,
  ramdisks as I describe above. In /etc/rc.d, read mountcritlocal and
  mountcritremote, which might answer some of your questions.

> 
> 4) the ramdisk is huge - 12MB since it contains /bin and /sbin which are
>    apparently necessary to enter a meaningful single user mode.

  Possibly my approach will help with this....

BTW, NetBSD's new system packages (syspkg) are useful for paring down
base.tgz to the bare minimum for your application. Syspkg is not "all
there" yet, but it's nearly enough complete that I think I can take
advantage.

Dave

-- 
David Young             OJC Technologies
dyoung at ojctech.com      Engineering from the Right Brain
                        Urbana, IL * (217) 278-3933



More information about the Soekris-tech mailing list