bitkeeper revision 1.929 (40beeffatmTqXw9_IGgwiDQCZdOKhA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 3 Jun 2004 09:31:38 +0000 (09:31 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 3 Jun 2004 09:31:38 +0000 (09:31 +0000)
Got rid of xencons0 and /dev/xen/cons entirely. DOM0 now attaches
to /dev/ttyS0; all others attach to /dev/tty1. The default
attachment can be changed using the 'xencons=' boot-parameter
switch.

README.CD
docs/Console-HOWTO.txt
docs/Xen-HOWTO.txt
xenolinux-2.4.26-sparse/arch/xen/drivers/console/console.c

index 83d8bfa84d0757f09099ac99fe9ff71cef7d307b..75f7d41ca3fbc62031feab06220af3a9b81fe968 100644 (file)
--- a/README.CD
+++ b/README.CD
@@ -544,20 +544,16 @@ remove ttyN from /etc/inittab for domains>0.  Due to a bug in the RH9
 /etc/rc.sysinit script #'ing the lines out of /etc/inittab won't work
 as it ignores the '#' and tries to access them anyway.
 
-Every Xenolinux instance owns a bidirectional 'virtual
-console'. Boot-time output will be directed to this console by default
-for all domain other than 0 (because the console name is tty0); domain
-0 requires you to specify 'console=xencons0' as a boot parameter. It
-is also possible to log in via the virtual console --- once again, for
-most domains your normal startup scripts will work as normal (e.g., by
-running mingetty on tty1-7). For domain 0, you must connect to the
-special 'xencons' device node:
- # mkdir -p /dev/xen
- # mknod /dev/xen/cons c 4 123
- # echo "c:2345:respawn:/sbin/mingetty --noclear xen/cons" >>/etc/inittab
-If you wish to permit root logins via the special DOM0 node then you
-must also add 'xen/cons' to the list of trusted ttys in
-/etc/securetty.
+Every Xenolinux instance owns a bidirectional 'virtual console'.
+The device node to which this console is attached can be configured
+by specifying 'xencons=' on the OS command line:
+ 'xencons=off'  --> disable virtual console
+ 'xencons=tty'  --> attach console to /dev/tty1 (tty0 at boot-time)
+ 'xencons=ttyS' --> attach console to /dev/ttyS0
+The default is to attach to /dev/tty1, and also to create dummy
+devices for /dev/tty2-63 to avoid warnings from many standard distro
+startup scripts. The exception is domain 0, which by default attaches
+to /dev/ttyS0.
 
 Note that, because domains>0 don't have any privileged access at all,
 certain commands in the default boot sequence will fail e.g. attempts
index d62f7191174b1397f48221a2d64b3c80d7739df9..4abdf529211adef63edd2757a3f6790f53f1d25c 100644 (file)
@@ -1,7 +1,7 @@
     New console I/O infrastructure in Xen 1.3
     =========================================
 
-    Keir Fraser, University of Cambridge, 22nd March 2004
+    Keir Fraser, University of Cambridge, 3rd June 2004
 
  I thought I'd write a quick note about using the new console I/O
  infrastructure in Xen 1.3. Significant new features compared with 1.2,
   - a new terminal client (replaces the use of telnet in character mode)
   - proper handling of terminal emulation
 
+Accessing the virtual console from within the guest OS
+------------------------------------------------------
+ Every Xenolinux instance owns a bidirectional 'virtual console'.
+ The device node to which this console is attached can be configured
+ by specifying 'xencons=' on the OS command line:
+  'xencons=off'  --> disable virtual console
+  'xencons=tty'  --> attach console to /dev/tty1 (tty0 at boot-time)
+  'xencons=ttyS' --> attach console to /dev/ttyS0
+ The default is to attach to /dev/tty1, and also to create dummy
+ devices for /dev/tty2-63 to avoid warnings from many standard distro
+ startup scripts. The exception is domain 0, which by default attaches
+ to /dev/ttyS0.
+
 Domain 0 virtual console
 ------------------------
  The virtual console for domain 0 is shared with Xen's console. For
  example, if you specify 'console=com1' as a boot parameter to Xen,
  then domain 0 will have bi-directional access to the primary serial
  line. Boot-time messages can be directed to the virtual console by
- specifying 'console=xencons0' as a boot parameter to Xenolinux.
+ specifying 'console=ttyS0' as a boot parameter to Xenolinux.
 
 Connecting to the virtual console
 ---------------------------------
@@ -33,18 +46,9 @@ Logging in via virtual console
  'getty' is running. In most domains the virtual console is named tty1
  so standard startup scripts and /etc/inittab should work
  fine. Furthermore, tty2-63 are created as dummy console devices to
- suppress warnings from standard startup scripts.
-
- In domain 0 we avoid conflict with the 'real' console by registering
- the virtual console with a special device number. A suitable device
- node must therefore be created, and a new line added to inittab:
-  # mkdir -p /dev/xen
-  # mknod /dev/xen/cons c 4 123
-  # echo "c:2345:respawn:/sbin/mingetty --noclear xen/cons" >>/etc/inittab
- Additionally, if you wish to allow root logins via the virtual
- console, then 'xen/cons' must be added to the trusted tty list in
- /etc/securetty. On some systems you *may* also need to modify the
- file /etc/securettys (note the final 's').
+ suppress warnings from standard startup scripts. If the OS has
+ attached the virtual console to /dev/ttyS0 then you will need to
+ start a 'mingetty' on that device node.
 
 Virtual console for other domains
 ---------------------------------
index 8e61559347b63a78887127a2f1dcc4cdbb371108..7fe5842bd31f66e165ce17511cd83cbd66d7bf8c 100644 (file)
@@ -282,7 +282,12 @@ starting the domain.
 Boot-time output will be directed to this console by default, because
 the console name is tty0. It is also possible to log in via the
 virtual console --- once again, your normal startup scripts will work
-as normal (e.g., by running mingetty on tty1-7).
+as normal (e.g., by running mingetty on tty1-7).  The device node to
+which the virtual console is attached can be configured by specifying
+'xencons=' on the OS command line: 
+ 'xencons=off' --> disable virtual console
+ 'xencons=tty' --> attach console to /dev/tty1 (tty0 at boot-time)
+ 'xencons=ttyS' --> attach console to /dev/ttyS0
 
 
 Manage Running Domains
index 0d2a0ab9f63ce2b3248dd71751fd72928120788b..91b97e83d96da12a505fbbb5aba29c6ba0658e17 100644 (file)
 #include <asm/ctrl_if.h>
 
 /*
- * NB. /dev/xencons[0-9]+ are only exported by domain 0.
- * All other domains use the normal /dev/tty[0-9]+ device nodes.
- * Only /dev/tty1 is currently hooked up to real I/O -- all others are
- * dummies to suppress warnings from standard distro startip scripts.
+ * Modes:
+ *  'xencons=off'  [XC_OFF]:     Console is disabled.
+ *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
+ *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
+ *                 [XC_DEFAULT]: DOM0 -> XC_SERIAL ; all others -> XC_TTY.
+ * 
+ * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
+ * warnings from standard distro startup scripts.
  */
-#define XENCONS_TTY_MINOR   123
+static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
+
+static int __init xencons_setup(char *str)
+{
+    if ( !strcmp(str, "tty") )
+        xc_mode = XC_TTY;
+    else if ( !strcmp(str, "ttyS") )
+        xc_mode = XC_SERIAL;
+    else if ( !strcmp(str, "off") )
+        xc_mode = XC_OFF;
+    return 1;
+}
+__setup("xencons", xencons_setup);
 
 /* The kernel and user-land drivers share a common transmit buffer. */
 #define WBUF_SIZE     4096
@@ -99,36 +115,38 @@ static void kcons_write_dom0(
 
 static kdev_t kcons_device(struct console *c)
 {
-    return MKDEV(TTY_MAJOR, 1);
-}
-
-static kdev_t kcons_device_dom0(struct console *c)
-{
-    return MKDEV(TTY_MAJOR, XENCONS_TTY_MINOR);
+    return MKDEV(TTY_MAJOR, (xc_mode == XC_SERIAL) ? 64 : 1);
 }
 
 static struct console kcons_info = {
+    device:  kcons_device,
     flags:   CON_PRINTBUFFER,
-    index:   -1,
+    index:   -1
 };
 
 void xen_console_init(void)
 {
     if ( start_info.flags & SIF_INITDOMAIN )
     {
-        strcpy(kcons_info.name, "xencons");
-        kcons_info.device = kcons_device_dom0;
-        kcons_info.write  = kcons_write_dom0;
+        if ( xc_mode == XC_DEFAULT )
+            xc_mode = XC_SERIAL;
+        kcons_info.write = kcons_write_dom0;
     }
     else
     {
-        strcpy(kcons_info.name, "tty");
-        kcons_info.device = kcons_device;
-        kcons_info.write  = kcons_write;
+        if ( xc_mode == XC_DEFAULT )
+            xc_mode = XC_TTY;
+        kcons_info.write = kcons_write;
     }
 
-    kcons_info.write = 
-        (start_info.flags & SIF_INITDOMAIN) ? kcons_write_dom0 : kcons_write;
+    if ( xc_mode == XC_OFF )
+        return;
+
+    if ( xc_mode == XC_SERIAL )
+        strcpy(kcons_info.name, "ttyS");
+    else
+        strcpy(kcons_info.name, "tty");
+
     register_console(&kcons_info);
 }
 
@@ -527,7 +545,6 @@ static int __init xencons_init(void)
     memset(&xencons_driver, 0, sizeof(struct tty_driver));
     xencons_driver.magic           = TTY_DRIVER_MAGIC;
     xencons_driver.major           = TTY_MAJOR;
-    xencons_driver.num             = MAX_NR_CONSOLES;
     xencons_driver.type            = TTY_DRIVER_TYPE_SERIAL;
     xencons_driver.subtype         = SERIAL_TYPE_NORMAL;
     xencons_driver.init_termios    = tty_std_termios;
@@ -538,15 +555,20 @@ static int __init xencons_init(void)
     xencons_driver.termios         = xencons_termios;
     xencons_driver.termios_locked  = xencons_termios_locked;
 
-    if ( start_info.flags & SIF_INITDOMAIN )
+    if ( xc_mode == XC_OFF )
+        return 0;
+
+    if ( xc_mode == XC_SERIAL )
     {
-        xencons_driver.name        = "xencons";
-        xencons_driver.minor_start = XENCONS_TTY_MINOR;
+        xencons_driver.name        = "ttyS";
+        xencons_driver.minor_start = 64;
+        xencons_driver.num         = 1;
     }
     else
     {
         xencons_driver.name        = "tty";
         xencons_driver.minor_start = 1;
+        xencons_driver.num         = MAX_NR_CONSOLES;
     }
 
     xencons_driver.open            = xencons_open;