[klibc] initramfs howto

Daniel Thaler daniel at dthaler.de
Wed Aug 10 05:09:59 PDT 2005

Russell King wrote:
> On Wed, Aug 10, 2005 at 11:11:26AM +0200, Andreas Jellinghaus wrote:
>>I believe that is wrong: the kernel will try to open /dev/console first
>>and not even run init, if that fails. so two files are needed:
>>/dev/console and /init.
> No.  If /dev/console doesn't exist, /init doesn't get fd0,1,2
> automatically opened for it, but /init is still run by the kernel.
> What this means is that /init needs to be extra careful about its
> startup, and do something with fd0,1,2 if it wishes to ensure that
> it doesn't unintentionally read or write files that it's opened via
> stdin/stdout/stderr.
> That could mean that /init creates /dev/console itself, and then
> tries to open it.  Or it could mean that /init creates /dev/null
> and uses that instead.

So how about adding this, as I assume others might wonder about /dev/console too:

"Before starting /init the kernel will also try to open /dev/console to provide
fd0,1,2 to /init. If /dev/console does not exist /init will still be run, but
will need to be extra careful about its startup or create and open /dev/console


More information about the klibc mailing list