Re: console on Niagara in 6.0.1

2011-03-22 Thread David Miller
From: Jurij Smakov 
Date: Tue, 22 Mar 2011 23:04:02 +

> If you could compile and run it on your machine, it would be very 
> interesting to see whether you'll get /dev/ttyS0 or /dev/ttyHV0 (on my 
> machine sunsab driver is used, and it's using 'ttyS' as prefix for 
> both). At least, this potentially allows us to do a proper fix in the
> next release.

The test program correctly gives /dev/ttyS0 on my machine.


-- 
To UNSUBSCRIBE, email to debian-sparc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110322.181403.39196928.da...@davemloft.net



Re: console on Niagara in 6.0.1

2011-03-22 Thread Jurij Smakov
On Tue, Mar 22, 2011 at 02:58:05AM -0700, David Miller wrote:
> From: Jurij Smakov 
> Date: Tue, 22 Mar 2011 09:34:32 +
> 
> > You may end up with console set to /dev/console if detection logic 
> > failed and a fall-through value has been used here:
> > 
> > http://git.debian.org/?p=d-i/rootskel.git;a=blob_plain;f=src/sbin/reopen-console-linux;hb=HEAD
> > 
> > Can you post dmesg output from this machine, booted via a serial 
> > console?
> 
> Device probing via dmesg parsing, wonderful... :-/ This really isn't
> going to ever work reliably.

Yeah, it's not great. In fact, I've found that it does not work on
my system either, no getty is put on the serial console. I'll 
investigate.
 
> So this code is going to see "ttyHV0" get enabled:
> 
> [0.00] console [tty0] enabled, bootconsole disabled
> [102839.004039] console [ttyHV0] enabled
> 
> But that doesn't tell you the serial device name under /dev
> 
> Not even close.
> 
> The device for console named ttyHV0 on this machine happens to be
> /dev/ttyS0, but it could have been /dev/ttyS1, or /dev/ttyS2, or
> similar depending upon the order in which the various serial drivers
> probed.
> 
> Console name to serial device name is not a 1 to 1 relationship.
> They can be, and are often, completely different.
> 
> The console name string is used for matching for kernel command
> line directives, but that's it.  You cannot use it to determine
> the /dev/* name for the underlying device.
> 
> As a result you now will have to add logic to this script so that it
> knows that this "ttyHV?" thing allocates from the "ttyS?" space, and
> then you will have to add code which figures out which index in the
> ttyS? space it got.
> 
> And there are a bunch of other serial device drivers which have the
> same issue.

I did not find a better way to find it for the squeeze kernel, but it 
appears that 2.6.38 supports a TIOCGDEV ioctl, which one can use on 
/dev/console to get the real device. With the following program

#include 
#include 
#include 
#include 
#include 

#define TIOCGDEV_IOR('T',0x32, unsigned int)

main () {
int fd = 0;
unsigned int u, tty_major, tty_minor;
   
fd = open("/dev/console", O_WRONLY, 0);
if (fd  < 0) { 
perror("open");
return(1);
}
if (ioctl(fd, TIOCGDEV, &u) < 0) {
perror("ioctl");
return(2);
}
tty_major = (u >> 8) & 0xfff;
tty_minor = (u & 0xff) | ((u >> 12) & 0xfff00);
printf("%d:%d\n",tty_major, tty_minor);
}

I get:

jurij@debian:~$ uname -a
Linux debian 2.6.38-1-sparc64-smp #1 SMP Thu Mar 17 02:39:31 UTC 2011 sparc64 
GNU/Linux
jurij@debian:~$ gcc console.c 
jurij@debian:~$ sudo ./a.out 
4:64
jurij@debian:~$ ls -al /dev/ttyS0
crw--- 1 root root 4, 64 Mar 22 22:43 /dev/ttyS0
jurij@debian:~$ 

If you could compile and run it on your machine, it would be very 
interesting to see whether you'll get /dev/ttyS0 or /dev/ttyHV0 (on my 
machine sunsab driver is used, and it's using 'ttyS' as prefix for 
both). At least, this potentially allows us to do a proper fix in the
next release.

Best regards,
-- 
Jurij Smakov   ju...@wooyd.org
Key: http://www.wooyd.org/pgpkey/  KeyID: C99E03CC


-- 
To UNSUBSCRIBE, email to debian-sparc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110322230402.ga3...@droopy.oc.cox.net



Re: console on Niagara in 6.0.1

2011-03-22 Thread David Miller
From: Jurij Smakov 
Date: Tue, 22 Mar 2011 09:34:32 +

> You may end up with console set to /dev/console if detection logic 
> failed and a fall-through value has been used here:
> 
> http://git.debian.org/?p=d-i/rootskel.git;a=blob_plain;f=src/sbin/reopen-console-linux;hb=HEAD
> 
> Can you post dmesg output from this machine, booted via a serial 
> console?

Device probing via dmesg parsing, wonderful... :-/ This really isn't
going to ever work reliably.

So this code is going to see "ttyHV0" get enabled:

[0.00] console [tty0] enabled, bootconsole disabled
[102839.004039] console [ttyHV0] enabled

But that doesn't tell you the serial device name under /dev

Not even close.

The device for console named ttyHV0 on this machine happens to be
/dev/ttyS0, but it could have been /dev/ttyS1, or /dev/ttyS2, or
similar depending upon the order in which the various serial drivers
probed.

Console name to serial device name is not a 1 to 1 relationship.
They can be, and are often, completely different.

The console name string is used for matching for kernel command
line directives, but that's it.  You cannot use it to determine
the /dev/* name for the underlying device.

As a result you now will have to add logic to this script so that it
knows that this "ttyHV?" thing allocates from the "ttyS?" space, and
then you will have to add code which figures out which index in the
ttyS? space it got.

And there are a bunch of other serial device drivers which have the
same issue.


-- 
To UNSUBSCRIBE, email to debian-sparc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110322.025805.57471409.da...@davemloft.net



Re: console on Niagara in 6.0.1

2011-03-22 Thread Jurij Smakov
On Mon, Mar 21, 2011 at 08:31:19PM -0700, David Miller wrote:
> From: Jurij Smakov 
> Date: Mon, 21 Mar 2011 11:51:30 +
> 
> > 4. Run '/bin/sh -x /usr/lib/finish-install.d/90console' and post the 
> > output somewhere.
> 
> This doesn't log anything because executing 90console actualy spawns
> debconf/frontend to execute the script.
> 
> So I inspected things by hand:
> 
> 1) readlink on /proc/$(pidof debian-installer)/fd/0 evaluates to 
> "/dev/console"
> 2) "mapdevfs" returns /dev/console
> 
> This is hitting the "Pass unknown devices without changes" path
> in debian-installer/devfs.c:di_system_devfs_map_fron
> 
> This code seems to assume that the installer will have the underlying
> device openned, but instead it is /dev/console which it will have.
> 
> Code needs to be added, somewhere, to translate /dev/console to
> whatever the underlying device is.  Or to detect the serial console
> in some other manner.

You may end up with console set to /dev/console if detection logic 
failed and a fall-through value has been used here:

http://git.debian.org/?p=d-i/rootskel.git;a=blob_plain;f=src/sbin/reopen-console-linux;hb=HEAD

Can you post dmesg output from this machine, booted via a serial 
console?

Best regards,
-- 
Jurij Smakov   ju...@wooyd.org
Key: http://www.wooyd.org/pgpkey/  KeyID: C99E03CC


-- 
To UNSUBSCRIBE, email to debian-sparc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110322093432.ga2...@droopy.oc.cox.net