Problems with output to console

Steven Scholz steven.scholz at
Sat Dec 17 15:58:23 UTC 2005


> Read init/init.c (which is, alas, a mess o' suckage).
> static char console[CONSOLE_BUFF_SIZE] = _PATH_CONSOLE;
> (That's from some header file).
> static void console_init(void)
> {
> ...
>     if ((s = getenv("CONSOLE")) != NULL || (s = getenv("console")) != NULL) {
>         safe_strncpy(console, s, sizeof(console));
> And the read on for the full horror of serial console detection and tty and 
> such...  It gets ugly quickly...

I wonder how I could set CONSOLE or console!?
If I do it in /etc/profile it is much too late!
So which environment is used in console_init()?
The default one that is setup by libbb/setup_environment.c ?

I noticed that when /dev/ttyS0 does not exist, busybox uses /dev/console
and I see the output from my application as expected.

 init: Starting pid 124, console /dev/console: '/opt/imc/start_imc'

But if it exists busybox uses /dev/ttyS0 as console

 init: Starting pid 127, console /dev/ttyS0: '/opt/imc/start_imc'

Fair enough. But I still don't understand why I don't see any outputs
from start_imc when the console is /dev/ttyS0!

Is it why /dev/console is a different device then /dev/ttyS0 (chardev
4,64 vs. 5,1) although it is both the same serial port?
Or is it because I start a shell on this port and thus /dev/ttyS0 can't
no longer be used as a console for applications started early in the
boot process?

PLEASE shed some light, Rob.

Thanks a million!


More information about the busybox mailing list