Subject: Re: PR 7170 -- init and /dev/console
To: Michael Lyle <mlyle@recourse.net>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 04/23/2001 09:13:34
On Fri, 20 Apr 2001, Michael Lyle wrote:

> On Fri, Apr 20, 2001 at 10:18:13AM -0700, Bill Studenmund wrote:
> > ?? While I see how not needing /dev/console will help, the kernel still
> > wants to mount a file system as root. And it wants to run init off of one.
> 
> Yes, but it's trivial for people to work around that if they want to..  The
> main thing is, if you don't have a filesystem, how do you get access to 
> hardware (existing drivers) from user space?  As someone who's done
> development for embedded systems in a past life there's ways I could see
> using this.

?? What's so hard about having a file system? Check out how the install
kernels work. They are one kernel, booted off of a floppy (or the net on
some architectures or a CD), which also contains an embedded root file
system. Yes, it's read-only, but it contains all of the programs needed to
install NetBSD. It also contains device nodes.

> > If the goal is to fix the problem, I think a cleaner fix is to:
> > 
> > 1) Have the kernel pass in an open file descriptor on say fd 1 which
> > is hooked to the console device. fd 1 and fd 2 weould be fine too.
> 
> To do this.. either additional facility needs to be put into the vnode/fd
> code to hand-craft file descriptors or init-main.c has to understand way
> too much about the inner workings of file descriptors in my opinion.

The vnode code needs no changing.

Hand-crafting a file descriptor isn't hard. Yes, init_main.c shouldn't
know about it, but it's not a hard thing to do. And as Greg pointed out,
the comments in init_main.c agree it's the right thing to do.

Take care,

Bill