Commit 2e8ecb9db0bcc19e1cc8bb51e9252fe6a86a9863

Authored by Bill Nottingham
Committed by Linus Torvalds
1 parent 430d275a39

add CONFIG_VT_UNICODE

As of now, the kernel defaults to non-unicode and XLATE for the keyboard.
We've been changing this in Fedora, but that requires patching the defaults
in the kernel.

The attached introduces CONFIG_VT_UNICODE, which sets the console in
unicode mode by default on boot, including both the virtual terminal and
the keyboard driver.

Signed-off-by: Bill Nottingham <notting@redhat.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 6 changed files with 27 additions and 5 deletions Side-by-side Diff

drivers/char/Kconfig
... ... @@ -36,6 +36,23 @@
36 36 If unsure, say Y, or else you won't be able to do much with your new
37 37 shiny Linux system :-)
38 38  
  39 +config VT_UNICODE
  40 + bool "Virtual console is Unicode by default"
  41 + depends on VT
  42 + default n
  43 + ---help---
  44 + If you say Y here, the virtual terminal will be in UTF-8 by default,
  45 + and the keyboard will run in unicode mode.
  46 +
  47 + If you say N here, the virtual terminal will not be in UTF-8 by
  48 + default, and the keyboard will run in XLATE mode.
  49 +
  50 + This can also be changed by passing 'default_utf8=<0|1>' on the
  51 + kernel command line.
  52 +
  53 + Historically, the kernel has defaulted to non-UTF8 and XLATE mode.
  54 + If unsure, say N here.
  55 +
39 56 config VT_CONSOLE
40 57 bool "Support for console on virtual terminal" if EMBEDDED
41 58 depends on VT
drivers/char/keyboard.c
... ... @@ -1381,7 +1381,7 @@
1381 1381 kbd_table[i].lockstate = KBD_DEFLOCK;
1382 1382 kbd_table[i].slockstate = 0;
1383 1383 kbd_table[i].modeflags = KBD_DEFMODE;
1384   - kbd_table[i].kbdmode = VC_XLATE;
  1384 + kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
1385 1385 }
1386 1386  
1387 1387 error = input_register_handler(&kbd_handler);
drivers/char/sysrq.c
... ... @@ -108,12 +108,12 @@
108 108 struct kbd_struct *kbd = &kbd_table[fg_console];
109 109  
110 110 if (kbd)
111   - kbd->kbdmode = VC_XLATE;
  111 + kbd->kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
112 112 }
113 113 static struct sysrq_key_op sysrq_unraw_op = {
114 114 .handler = sysrq_handle_unraw,
115 115 .help_msg = "unRaw",
116   - .action_msg = "Keyboard mode set to XLATE",
  116 + .action_msg = "Keyboard mode set to system default",
117 117 .enable_mask = SYSRQ_ENABLE_KEYBOARD,
118 118 };
119 119 #else
... ... @@ -158,7 +158,11 @@
158 158 static void set_palette(struct vc_data *vc);
159 159  
160 160 static int printable; /* Is console ready for printing? */
161   -static int default_utf8;
  161 +#ifdef CONFIG_VT_UNICODE
  162 +int default_utf8 = 1;
  163 +#else
  164 +int default_utf8;
  165 +#endif
162 166 module_param(default_utf8, int, S_IRUGO | S_IWUSR);
163 167  
164 168 /*
drivers/char/vt_ioctl.c
... ... @@ -1125,7 +1125,7 @@
1125 1125 void reset_vc(struct vc_data *vc)
1126 1126 {
1127 1127 vc->vc_mode = KD_TEXT;
1128   - kbd_table[vc->vc_num].kbdmode = VC_XLATE;
  1128 + kbd_table[vc->vc_num].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE;
1129 1129 vc->vt_mode.mode = VT_AUTO;
1130 1130 vc->vt_mode.waitv = 0;
1131 1131 vc->vt_mode.relsig = 0;
include/linux/vt_kern.h
... ... @@ -87,6 +87,7 @@
87 87 extern char con_buf[CON_BUF_SIZE];
88 88 extern struct mutex con_buf_mtx;
89 89 extern char vt_dont_switch;
  90 +extern int default_utf8;
90 91  
91 92 struct vt_spawn_console {
92 93 spinlock_t lock;