[POST-6.1] Console script with UTF-8 support
Alexander E. Patrakov
patrakov at ums.usu.ru
Mon Apr 4 07:17:10 PDT 2005
Attached is the updated "console" bootscript with support for both UTF-8 and
traditional 8-bit modes. 8-bit mode is the default. Documentation is below,
please ask questions if it is not clear enough. If you think you can
improve readability of the script, please do.
With this script, the "-I '\033\(K'" option in /etc/inittab for agetty is no
longer needed. Don't forget to set LANG and LC_ALL properly
My previous experiments with dev.d handlers are considered failed because
that handler is called too late and /etc/issue is displayed improperly if
it contains national characters. Distros sometimes make the console setup a
part of /etc/profile, I decided not to do that for now since if all users
have the same preferred console settings, the bootscript does its job.
This script reads the configuration file, /etc/sysconfig/console. This file
should contain lines of the form: VARIABLE="value". The following variables
the arguments you want to pass to the "setfont" program. If not set, the
"setfont" program is not called.
the arguments you want to pass to the "loadkeys" program. Typically this is
the name of the keymap, e.g. "ru-ms". If this variable is not set, the
"loadkeys" program is not called. If you want to take the composition rules
only from the keymap, without merging them with the kernel default rules,
prepend "-c", as in KEYMAP="-c es euro2" (not sure that "es" is a good
example here, I just wanted to demonstrate the ability to specify arbitrary
loadkeys command line parameters).
some stock keymaps are not perfect. In such case, create a file with
corrections to that keymap, store it somewhere in /etc/kbd, and set this
variable to its full path. The "loadkeys" program will be called with that
filename as an argument. The book already contains a
KEYMAP_CORRECTIONS="/etc/kbd/bs-sends-del" example. If you don't need any
corrections, don't set this variable.
(i.e. if you have a working /etc/sysconfig/console file from LFS 6.0, it
will still work).
In addition, the following variables are useful only in UTF-8 mode:
set this variable to "1", "yes" or "true" to activate the UTF-8 mode. If
this variable is not set or set to any other value, the traditional 8-bit
mode is used.
most keymaps are stored on disk in 8-bit charsets, not in UTF-8, and
therefore are unusable in their original form in the UTF-8 mode. The script
is able to convert them to UTF-8 on the fly, but it needs to know the
original charset of the keymap to do the conversion properly. That charset
is typically found at the top of the keymap file in the declaration similar
to: charset "iso-8859-2". In that case, set LEGACY_CHARSET="8859-2" in
order to convert that keymap from iso-8859-2 to UTF-8. If this variable is
not set, no conversion is done.
Maybe it's better to rename that to KEYMAP_CHARSET.
By default, if the UTF-8 mode is active and this variable is unset, the
script disables all dead keys and compose sequences because the vanilla
kernel gives wrong results anyway (it emits valid iso-8859-1 or other 8-bit
encoding instead of valid UTF-8, even in UTF-8 mode; see
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=143014 and its
duplicates). If you have patched the kernel according to the instructions in
the script, set this variable to "false" and append
"-m the_value_of_legacy_charset" to FONT to get working compose sequences.
Questions that are likely to be asked:
Q: why isn't this patch in the kernel?
A: it's a temporary hack, not a real solution -- but it works.
Q: does this kernel patch do any harm to non-UTF-8 users?
Q: fonts with 8-pixel height look wrong on ATI video cards
A: That is ATI hardware bug. 2.4 kernels managed to avoid triggering it,
though. Don't use such fonts with ATI cards.
Q: where is the Chinese support?
A: e.g. in the zhcon program (beyond BLFS). Chinese users don't run loadkeys
Q: I have set FONT to "LatArCyrHeb-16" or "drdos8x16", and the output of the
bootscripts that run before "console" is turned to garbage.
A: The problem is that the bootscripts use bold colors by default, and that
doesn't survive transition from a 8-bit to a 9-bit font on
non-framebuffer console. Use a framebuffer or replace "\\033[1;" with
"\\033[0;" in the lines from "SUCCESS" to "BRACKET"
in /etc/rc.d/init.d/functions. Or better, ask Nathan Coulson to create an
official configuration file for that palette :)
Q: is it all that has to be done in order to get working UTF-8 in LFS?
A: no, one has to adjust instructions for ncurses and man (both can be made
harmless for non-UTF-8 users) and to add optional --disable-nls type
flags to some other packages. Also one has to mark some broken packages
Alexander E. Patrakov
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2651 bytes
Desc: not available
More information about the lfs-dev