• Gerd Knorr's avatar
    [PATCH] uml: terminal cleanup · 8723ef96
    Gerd Knorr authored
    This is a major cleanup of the uml terminal drivers and console handling
    (console as in "where the kernel messages go to", not as in "linux
    virtual terminals").  The changes in detail:
    
     (1) There is a new console driver calles "stderr" which (as the name
         implies) simply dumps all kernel messages to stderr.  That one
         is registered very early in the boot process via console_initcall()
         and will print every almost kernel message instantly: Both very
         early in the boot process and very late in shutdown.
         Note that this is not enabled by default, see below for details.
    
     (2) Ditched the early-console-init hackery in stdio_console.c
         (open_console(NULL) + related stuff) into the waste basket, not
         needed any more as you can use the new stderr console driver to
         get the kernel messages if your kernel crashes very early in the
         boot process.
    
     (3) Handle console initialitation for the uml stdio console and
         virtual serial lines the normal way using the console->setup()
         function.  Now all kernel messages appear on your console device
         once it is initialized without any dirty tricks.
    
     (4) The (2) changes allow a number of further cleanups:  As we don't
         open a line without a tty_struct any more we can ...
          * hook struct line into tty->driver_data
          * pass around tty_struct instead of struct line everythere
          * get rid of some trivial wrappers in ssl.c and stdio_console.c
            because we can get struct line via tty_struct all the time now.
    
     (5) Change the ordering in the arch/um/drivers/Makefile and thus
         the link and initialization order to make sure the stdio console
         and not the virtual serial line is the default console device.
    
     (6) Fixed a number of Documentation/CodingStyle issues within the
         code (not systematically, but usually just the places I was
         touching anyway or where it bugged me while browsing the code
         because it was hard to read).
    
    Looks like that cleanup also fixed some strange tty issues I've seen in
    the past (like console getty not responding to input sometimes, suse's
    /sbin/blogd causing trouble).
    
    Finally some usage notes for using the new stderr console:
    
    If the stderr console is enabled, then it is the default console device
    because it registeres very early in the boot process.  But as it isn't
    linked to a tty device this makes init unhappy, you'll see "can't open
    initial console" error messages.  Because you usually don't want that
    the stderr console is turned off by default.  That also maintains the
    behavior that /dev/tty0 is the first console device registered and thus
    the default console.
    
    There are basically two useful use cases for the stderr console:
    
     (1) Your kernel dies before the normal console device is initialized
         and thus you don't see any messages.  Just enable the stderr
         console to see them by adding "stderr=1" to the kernel command line.
    
     (2) You want to have the kernel messages on both stderr and your
         console terminal device.  Try something like this:
    
    	$ ./linux stderr=1 console=stderr console=ttyS0 ssl0=xterm
    
         This example sets up the console on a virtual serial line and
         pops up an xterm for that.
    Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    8723ef96
ssl.c 5.71 KB