Re: New /dev/console and /dev/tty0

Miquel van Smoorenburg (miquels@cistron.nl)
29 Apr 1997 15:49:28 +0200


In article <yw04tcqf4ya.fsf@laurel.trs.ntc.nokia.com>,
Kohtala Marko <Marko.Kohtala@ntc.nokia.com> wrote:
>Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be> writes:
>
>> In summary, while we created an `automatic' /dev/console, we lost the ability
>> to access the current virtual console (formerly /dev/tty0), or am I missing
>> something??
>
>When I wrote the change, my thought was that /dev/console would
>continue to work as before (it already was automatic) when there are
>the virtual terminal devices. However, I failed to bring this thought
>into the code.

Hmm. This was originally part of my first serial console code.
I had an automatic console device with major/minor 4/255, a new one.
The old /dev/tty0 remained master virtual console device.
However Linus didn't like that at all so I removed it.

The solution I made was that the kernel would set an environment variable
called CONSOLE to the (guessed, ofcourse) name of the console device.
Init looks at this environment variable to decide which console to
open for boot. The first script that is spawned by init can link the
real console device to /dev/console after remounting the root fs rw.

This actually works very nice, better then I thought and looking back
Linus was right as usual :).

>The concept of console is a bit vague here and in the source. In my
>view console is the device for managing the machine and where kernel
>messages go and from which you can get the single user shell
>prompt.

That's not nessecary, init can look at $CONSOLE. And it has been doing
that for a long time so all current distributions have that ability.

>Now, when we have no /dev/tty[1-9]* devices, I thought that best is to
>have /dev/console go automatically to any existing console device. The
>c 4 0 is pairs nicely with c 5 0, which is the tty of the current
>process, so I thought I keep using that.

However we need a /dev/tty0. The debian distribution has already changed
all code (svgalib, X server) to use /dev/tty0 instead of /dev/console.
That's the way to go IMO.

>The only problem that I see is that programs rely on the old notion of
>console to find foreground virtual terminals. This can be alleviated
>by giving /dev/tty[1-9]* priority over serial consoles, so that they
>are /dev/console when both vt and serial consoles are used. Some

Yuck :)

>people might not want that, but they are minority and still not worse
>off than before the serial console change.

Why not use the $CONSOLE solution.

Another thing I'd like (and implemented some time ago, but probably
not clean enough) is the following kernel option:

console="ttyS1,9600n8,lp0,0,tty0,0"

That would use /dev/ttyS1 as "real" console but _also_ print any kernel
messages to /dev/lp0 and /dev/tty0. Not even that hard to implement.
Perhaps I'll do it if this weekend is as rainy again as the last :)

Mike.

-- 
|    Miquel van      |  "I need more space" "Well, why not move to Texas" |
| miquels@cistron.nl |  "No, on my account, stupid." "Stupid? Uh-oh.."    |
|   PGP fingerprint: FE 66 52 4F CD 59 A5 36  7F 39 8B 20 F1 D6 74 02     |