Modifying init to create /dev/console ?

Robert Schwebel robert at schwebel.de
Wed Mar 21 07:41:13 UTC 2007


On Tue, Mar 13, 2007 at 10:15:33PM +0100, Denis Vlasenko wrote:
> Delete relevant kernel messages in the source:
> 
> init/main.c
> 
>         if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
>                 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
> 
>         (void) sys_dup(0);
>         (void) sys_dup(0);

Uuuh, crude. I'm wondering if it would be possible to implement the hack
currently done in userspace in kernel; in the end all the kernel does
her is to get a file descriptor for character device 5,1 and it only
needs the filesystem entry because it uses sys_open(), which is path
based.

> > Ah, and a regression: you don't get kernel messages any more on that
> > console, because although init has a console now, the kernel does
> > not.
> 
> What does it mean - "kernel does not have a console"?  Console is
> still there, and kernel can print to it, regardless whether
> /dev/console exist or not, opened or not.

When booting with a serial console and not running a syslogd, I'm
usually seeing kernel messages in the serial terminal. With the hack, I
don't.

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9




More information about the busybox mailing list