[patch 1/2] uml/xen: make the vt subsystem a runtime option

From: Gerd Knorr
Date: Tue Dec 13 2005 - 10:06:15 EST


Hi,

This patch enables the VT console to be disabled at runtime even if it is built into the kernel. The UML framebuffer driver (patch follows) depends on this. Xen will need that one too.

please apply,

Gerd Subject: [patch] xen vt runtime
From: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>

This patch enables the VT console to be disabled at runtime even if it is
built into the kernel. Arch xen needs this to avoid trying to initialise a VT
in virtual machine that doesn't have access to the console hardware.

Signed-off-by: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
Signed-off-by: Gerd Knorr <kraxel@xxxxxxx>
Index: linux-2.6.14/drivers/char/tty_io.c
===================================================================
--- linux-2.6.14.orig/drivers/char/tty_io.c 2005-12-02 11:58:50.000000000 +0100
+++ linux-2.6.14/drivers/char/tty_io.c 2005-12-02 12:03:13.000000000 +0100
@@ -132,6 +132,8 @@ LIST_HEAD(tty_drivers); /* linked list
vt.c for deeply disgusting hack reasons */
DECLARE_MUTEX(tty_sem);

+int console_use_vt = 1;
+
#ifdef CONFIG_UNIX98_PTYS
extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */
extern int pty_limit; /* Config limit on Unix98 ptys */
@@ -1825,7 +1827,7 @@ retry_open:
goto got_driver;
}
#ifdef CONFIG_VT
- if (device == MKDEV(TTY_MAJOR,0)) {
+ if (console_use_vt && device == MKDEV(TTY_MAJOR,0)) {
extern struct tty_driver *console_driver;
driver = console_driver;
index = fg_console;
@@ -3014,6 +3016,8 @@ static int __init tty_init(void)
#endif

#ifdef CONFIG_VT
+ if (!console_use_vt)
+ goto out_vt;
cdev_init(&vc0_cdev, &console_fops);
if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
@@ -3022,6 +3026,7 @@ static int __init tty_init(void)
class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");

vty_init();
+ out_vt:
#endif
return 0;
}