[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: More info on kernel 2.2 & debian bootdisks woes

Steve Dunham wrote:
> I looked into the source code and found that the "dbootstrap" process
> was running with stdin/stdout pointing to /dev/tty0, which is causing
> problems (could this be a kernel bug?).
> To see that this is the problem, do:
>   rm /dev/tty0
>   mknod /dev/tty0 c 4 1
> and kill the dbootstrap process.
> The code that is making dbootstrap attach to tty0 is in
> /usr/src/boot-floppies/utilities/busybox/init.c:
>         default:
>                 tty = ttyname(0);
>                 if (tty) {
>                         strcpy( console, tty );
>                         if (!strncmp( tty, "/dev/cua", 8 ))
>                                 serial_cons=1;
>                 }
>                 else
>                         /* falls back to /dev/tty1 if an error occurs */
>                         strcpy( console, default_console );
> As a hack to fix this, you can disable the "if" part of the above
> statement.  (IMHO, it's always wrong to use tty0, since it refers to
> the VC that is currently being displayed - if the user switch VC's
> then the output would go to the current one.  And ttyname(0) is
> returning "/dev/tty0".)

Ok, I thought it had something to do with the init code, but I didn't have
time to look at it until now.
I'm working right now on adding kernel revision detection code to init to
be able to support both 2.0 & 2.2 kernels with the same root.bin image.

> Also, I wonder about the code just above it, it opens /dev/cua0 or
> /dev/cua1 if the user specifies a serial console, these devices are
> depricated.  If you change those strings to ttyS0 and ttyS1, it may
> fix your serial console problems.
> Disabling the if part won't break serial consoles - the other parts of
> the case statement handle the serial console (although they do so
> incorrectly, since cua0 and cua1 no longer exist).

2.0 kernels use /dev/cuaN devices as serial console (see main.c, do_shell
function).  I need to keep that for them but I will switch to /dev/ttySN
for 2.2.

Thanks for your help, Steve.

 Eric Delaunay                 | "La guerre justifie l'existence des militaires.
 delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)

Reply to: