Problems with output to console

Rob Landley rob at landley.net
Sun Dec 11 06:07:47 UTC 2005


On Saturday 10 December 2005 04:41, Steven Scholz wrote:
> Hi all,
>
> I have two different ARM based boards (different CPUs, both Linux
> 2.6.14) running BusyBox v1.00.
>
> I want a little application (started by a script that is started by
> inittab) to output stuff using printf() on my serial console.
>
> foobar.c is
> int main (void)
> {
>         printf("Hello World (printf)!\n");
>         return 0;
> }
>
> My /etc/inittab has
>
> ::sysinit:/opt/imc/start_imc
> ::askfirst:-/bin/sh
>
> On one board I see the output. This one has /dev/ttySMX0 (204,41) as
> serial console. On the other board I do _not_ see the output. This has
> /dev/ttyS0 (4,64) as serial console.
>
> When I start foobar directly in inittab it works on both.
>
> When I create a link "ln -s /dev/ttySMX0 /dev/ttyS0" on the first board,
> then I cant see the output there anymore.
>
> Could someone please explain to me what's going on here.

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 rewrote all this once.  Need to do it again in 2.2...

> Cheers,
>
> Steven

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list