Subject: Re: phasing out mfs; make init(8) use tmpfs?
To: NetBSD Kernel Technical Discussion List <>
From: Greg A. Woods <>
List: tech-kern
Date: 02/18/2007 11:19:58
At Fri, 16 Feb 2007 17:04:40 +0000,
David Laight wrote:
> I sometimes wonder it init could just execute MAKEDEV with a flag to
> create an appropriate filesystem?

That's an _excellent_ idea!  I think I'll try it.  The only trick is
with getting any error messages from the running of the program out to
the as-yet non-existant console.  I suppose init could just slurp them
up and then spew them out afterwards, attempting to create a
/dev/console in the mount point directory if one doesn't already exist
there for a final attempt at not going dead silently.  Of course the
correct solution to the /dev/console chicken and egg problem would be
solved if the kernel were to craft an open file descriptor on the
console device it already knows and uses and handed that as stdin,
stdout, and stderr to init just as the shell would do for any other
program, or as init itself does for the programs it starts.  Init really
shouldn't have to know anything whatsoever about /dev/console or
/dev/consdev or anything like them, and they shouldn't have to exist for
init to run, or even for it to start a single user shell.

In fact init shouldn't even have to create /dev before starting
/etc/rc.  That should be done, if necessary, by /etc/rc (i.e. by one of
the first scripts it runs).  None of this magic should be iniside a
binary program, especially not the one with the responsibility of being
run as PID#1.

Either way this all goes very well along with my hopes that it will move
to /sbin too (which I've done since 1.6), and with MAKEDEV.local moving
to /etc too of course.

> The only place the memory footprint may matter is in the small install
> media - which is why the size of the mfs filesystem is limited.

That doesn't make any sense.  The MFS is created in memory (that can be
paged out), not on the install media itself (or any boot media for that
matter -- I use an MFS /dev exclusively for diskless machines too).

						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <>
Planix, Inc. <>       Secrets of the Weird <>