Ignore:
Timestamp:
01/06/2006 02:59:05 AM (19 years ago)
Author:
Jeremy Huntwork <jhuntwork@…>
Children:
e1ca33a
Parents:
1714f1a
Message:

Merged recent changes from trunk to lfs-alpha. Fixed typo.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/alphabetical/BOOK@7248 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter07/console.xml

    r1714f1a r46a2e9c  
    11<?xml version="1.0" encoding="ISO-8859-1"?>
    2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
     2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
     3  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
    34  <!ENTITY % general-entities SYSTEM "../general.ent">
    45  %general-entities;
    56]>
     7
    68<sect1 id="ch-scripts-console">
    7 <title>Configuring the Linux Console</title>
    8 <?dbhtml filename="console.html"?>
    9 
    10 <indexterm zone="ch-scripts-console">
    11 <primary sortas="d-console">console</primary>
    12 <secondary>configuring</secondary></indexterm>
    13 
    14 <para>This section discusses how to configure the <command>console</command>
    15 bootscript that sets up the keyboard map and the console font. If non-ASCII
    16 characters (e.g., the British pound sign and Euro character) will not be used
    17 and the keyboard is a U.S. one, skip this section. Without the configuration
    18 file, the <command>console</command> bootscript will do nothing.</para>
    19 
    20 <para>The <command>console</command> script reads the
    21 <filename>/etc/sysconfig/console</filename> file for configuration information.
    22 Decide which keymap and screen font will be used. Various language-specific
    23 HOWTO's can also help with this (see <ulink
    24 url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. A pre-made
    25 <filename>/etc/sysconfig/console</filename> file with known settings for several
    26 countries was installed with the LFS-Bootscripts package, so the relevant
    27 section can be uncommented if the country is supported. If still in doubt, look
    28 in the <filename class="directory">/usr/share/kbd</filename> directory for valid
    29 keymaps and screen fonts. Read <filename>loadkeys(1)</filename> and
    30 <filename>setfont(8)</filename> to determine the correct arguments for
    31 these programs. Once decided, create the configuration file with the following
    32 command:</para>
    33 
    34 <screen><userinput>cat &gt;/etc/sysconfig/console &lt;&lt;"EOF"
    35 <literal>KEYMAP="<replaceable>[arguments for loadkeys]</replaceable>"
    36 FONT="<replaceable>[arguments for setfont]</replaceable>"</literal>
    37 EOF</userinput></screen>
    38 
    39 <para>For example, for Spanish users who also want to use the Euro
    40 character (accessible by pressing AltGr+E), the following settings are
    41 correct:</para>
    42 
    43 <screen role="nodump"><userinput>cat &gt;/etc/sysconfig/console &lt;&lt;"EOF"
    44 <literal>KEYMAP="es euro2"
    45 FONT="lat9-16 -u iso01"</literal>
    46 EOF</userinput></screen>
    47 
    48 <note><para>The <envar>FONT</envar> line above is correct only for the ISO 8859-15
    49 character set. If using ISO 8859-1 and, therefore, a pound sign
    50 instead of Euro, the correct <envar>FONT</envar> line would be:</para>
    51 
    52 <screen role="nodump"><userinput>FONT="lat1-16"</userinput></screen></note>
    53 
    54 <para>If the <envar>KEYMAP</envar> or <envar>FONT</envar> variable is not set, the
    55 <command>console</command> initscript will not run the corresponding
    56 program.</para>
    57 
    58 <para>In some keymaps, the Backspace and Delete keys send characters different
    59 from ones in the default keymap built into the kernel. This confuses some
    60 applications. For example, Emacs displays its help (instead of erasing the
    61 character before the cursor) when Backspace is pressed. To check if the keymap
    62 in use is affected (this works only for i386 keymaps):</para>
    63 
    64 <screen role="nodump"><userinput>zgrep '\W14\W' <replaceable>[/path/to/your/keymap]</replaceable></userinput></screen>
    65 
    66 <para>If the keycode 14 is Backspace instead of Delete, create the
    67 following keymap snippet to fix this issue:</para>
    68 
    69 <screen role="nodump"><userinput>mkdir -pv /etc/kbd &amp;&amp; cat &gt; /etc/kbd/bs-sends-del &lt;&lt;"EOF"
    70 <literal>                  keycode  14 = Delete Delete Delete Delete
    71               alt keycode  14 = Meta_Delete
    72         altgr alt keycode  14 = Meta_Delete
    73                   keycode 111 = Remove
    74     altgr control keycode 111 = Boot
    75       control alt keycode 111 = Boot
    76 altgr control alt keycode 111 = Boot</literal>
    77 EOF</userinput></screen>
    78 
    79 <para>Tell the <command>console</command> script to load this
    80 snippet after the main keymap:</para>
    81 
    82 <screen role="nodump"><userinput>cat &gt;&gt;/etc/sysconfig/console &lt;&lt;"EOF"
    83 <literal>KEYMAP_CORRECTIONS="/etc/kbd/bs-sends-del"</literal>
    84 EOF</userinput></screen>
    85 
    86 <para>To compile the keymap directly into the kernel instead of
    87 setting it every time from the <command>console</command> bootscript,
    88 follow the instructions given in <xref linkend="ch-bootable-kernel" role="."/>
    89 Doing this ensures that the keyboard will always work as expected,
    90 even when booting into maintenance mode (by passing
    91 <parameter>init=/bin/sh</parameter> to the kernel), because the
    92 <command>console</command> bootscript will not be run in that
    93 situation. Additionally, the kernel will not set the screen font
    94 automatically. This should not pose many problems because ASCII characters
    95 will be handled correctly, and it is unlikely that a user would need
    96 to rely on non-ASCII characters while in maintenance mode.</para>
    97 
    98 <para>Since the kernel will set up the keymap, it is possible to omit
    99 the <envar>KEYMAP</envar> variable from the
    100 <filename>/etc/sysconfig/console</filename> configuration file. It can
    101 also be left in place, if desired, without consequence.  Keeping it
    102 could be beneficial if running several different kernels where it is
    103 difficult to ensure that the keymap is compiled into every one of
    104 them.</para>
     9  <?dbhtml filename="console.html"?>
     10
     11  <title>Configuring the Linux Console</title>
     12
     13  <indexterm zone="ch-scripts-console">
     14    <primary sortas="d-console">console</primary>
     15    <secondary>configuring</secondary>
     16  </indexterm>
     17
     18  <para>This section discusses how to configure the <command>console</command>
     19  bootscript that sets up the keyboard map and the console font. If non-ASCII
     20  characters (e.g., the copyright sign, the British pound sign and Euro symbol)
     21  will not be used and the keyboard is a U.S. one, skip this section. Without
     22  the configuration file, the <command>console</command> bootscript will do
     23  nothing.</para>
     24
     25  <para>The <command>console</command> script reads the
     26  <filename>/etc/sysconfig/console</filename> file for configuration information.
     27  Decide which keymap and screen font will be used. Various language-specific
     28  HOWTOs can also help with this, see <ulink
     29  url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
     30  doubt, look in the <filename class="directory">/usr/share/kbd</filename>
     31  directory for valid keymaps and screen fonts. Read
     32  <filename>loadkeys(1)</filename> and <filename>setfont(8)</filename> manual
     33  pages to determine the correct arguments for these programs.</para>
     34
     35  <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
     36  of the form: VARIABLE="value". The following variables are recognized:</para>
     37
     38  <variablelist>
     39
     40    <varlistentry>
     41      <term>KEYMAP</term>
     42      <listitem>
     43        <para>This variable specifies the arguments for the
     44        <command>loadkeys</command> program, typically, the name of keymap
     45        to load, e.g., <quote>es</quote>. If this variable is not set, the
     46        bootscript will not run the <command>loadkeys</command> program,
     47        and the default kernel keymap will be used.</para>
     48      </listitem>
     49    </varlistentry>
     50
     51    <varlistentry>
     52      <term>KEYMAP_CORRECTIONS</term>
     53      <listitem>
     54        <para>This (rarely used) variable
     55        specifies the arguments for the second call to the
     56        <command>loadkeys</command> program. This is useful if the stock keymap
     57        is not completely satisfactory and a small adjustment has to be made. E.g.,
     58        to include the Euro sign into a keymap that normally doesn't have it,
     59        set this variable to <quote>euro2</quote>.</para>
     60      </listitem>
     61    </varlistentry>
     62
     63    <varlistentry>
     64      <term>FONT</term>
     65      <listitem>
     66        <para>This variable specifies the arguments for the
     67        <command>setfont</command> program. Typically, this includes the font
     68        name, <quote>-m</quote>, and the name of the application character
     69        map to load. E.g., in order to load the <quote>lat1-16</quote> font
     70        together with the <quote>8859-1</quote> application character map
     71        (as it is appropriate in the USA), <!-- because of the copyright sign -->
     72        set this variable to <quote>lat1-16 -m 8859-1</quote>.
     73        If this variable is not set, the bootscript will not run the
     74        <command>setfont</command> program, and the default VGA font will be
     75        used together with the default application character map.</para>
     76      </listitem>
     77    </varlistentry>
     78
     79    <varlistentry>
     80      <term>UNICODE</term>
     81      <listitem>
     82        <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
     83        <quote>true</quote> in order to put the
     84        console into UTF-8 mode. This is useful in UTF-8 based locales and
     85        harmful otherwise.</para>
     86      </listitem>
     87    </varlistentry>
     88
     89    <varlistentry>
     90      <term>LEGACY_CHARSET</term>
     91      <listitem>
     92        <para>For many keyboard layouts, there is no stock Unicode keymap in
     93        the Kbd package. The <command>console</command> bootscript will
     94        convert an available keymap to UTF-8 on the fly if this variable is
     95        set to the encoding of the available non-UTF-8 keymap. Note, however,
     96        that dead keys (i.e., keys that don't produce a character by
     97        themselves, but put an accent onto a character procuced by the next
     98        key; there are no dead keys on the standard US keyboard) and composing
     99        (i.e., pressing Ctrl+. A E in order to produce the &AElig; character)
     100        will not work in UTF-8 mode without the special kernel patch.
     101        This variable is useful only in UTF-8 mode.</para>
     102      </listitem>
     103    </varlistentry>
     104
     105    <varlistentry>
     106      <term>BROKEN_COMPOSE</term>
     107      <listitem>
     108        <para>Set this to <quote>0</quote> if you are going to apply the kernel patch in
     109        Chapter 8. Note that you also have to add the character set expected
     110        by composition rules in your keymap to the FONT variable after the
     111        <quote>-m</quote> switch. This variable is useful only in UTF-8 mode.</para>
     112      </listitem>
     113    </varlistentry>
     114
     115  </variablelist>
     116
     117  <para>Support for compiling the keymap directly into the kernel has been
     118  removed because there were reports that it leads to incorrect results.</para>
     119
     120  <para>Some examples:</para>
     121
     122  <itemizedlist>
     123
     124    <listitem>
     125      <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
     126      generally needed. E.g., for a Polish setup, one would use:</para>
     127
     128<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
     129<literal># Begin /etc/sysconfig/console
     130
     131KEYMAP="pl2"
     132FONT="lat2a-16 -m 8859-2"
     133
     134# End /etc/sysconfig/console</literal>
     135EOF</userinput></screen>
     136    </listitem>
     137
     138    <listitem>
     139      <para>As mentioned above, it is sometimes necessary to adjust a
     140      stock keymap slightly. The following example adds the Euro symbol to the
     141      German keymap:</para>
     142
     143<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
     144<literal># Begin /etc/sysconfig/console
     145
     146KEYMAP="de-latin1"
     147KEYMAP_CORRECTIONS="euro2"
     148FONT="lat0-16 -m 8859-15"
     149
     150# End /etc/sysconfig/console</literal>
     151EOF</userinput></screen>
     152    </listitem>
     153
     154    <listitem>
     155      <para>The following is a Unicode-enabled example for Bulgarian, where a stock
     156      UTF-8 keymap exists and defines no dead keys or composition rules:</para>
     157
     158<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
     159<literal># Begin /etc/sysconfig/console
     160
     161UNICODE="1"
     162KEYMAP="bg_bds-utf8"
     163FONT="LatArCyrHeb-16"
     164
     165# End /etc/sysconfig/console</literal>
     166EOF</userinput></screen>
     167    </listitem>
     168
     169    <listitem>
     170      <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
     171      example, bright colors are no longer available on the Linux console unless
     172      a framebuffer is used. If one wants to have bright colors without
     173      framebuffer and can live without characters not belonging to his language,
     174      it is still possible to use a language-specific 256-glyph font, as
     175      illustrated below.</para>
     176
     177<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
     178<literal># Begin /etc/sysconfig/console
     179
     180UNICODE="1"
     181KEYMAP="bg_bds-utf8"
     182FONT="cyr-sun16"
     183
     184# End /etc/sysconfig/console</literal>
     185EOF</userinput></screen>
     186    </listitem>
     187
     188    <listitem>
     189      <para>The following example illustrates keymap autoconversion from
     190      ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
     191
     192<screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
     193<literal># Begin /etc/sysconfig/console
     194
     195UNICODE="1"
     196KEYMAP="de-latin1"
     197KEYMAP_CORRECTIONS="euro2"
     198LEGACY_CHARSET="iso-8859-15"
     199BROKEN_COMPOSE="0"
     200FONT="LatArCyrHeb-16 -m 8859-15"
     201
     202# End /etc/sysconfig/console</literal>
     203EOF</userinput></screen>
     204    </listitem>
     205
     206    <listitem>
     207      <para>For Chinese, Japanese, Korean and some other languages, the Linux
     208      console cannot be configured to display the needed characters. Users
     209      who need such languages should install the X Window System, fonts that
     210      cover the necessary character ranges, and the proper input method (e.g.,
     211      SCIM, it supports a wide variety of languages).</para>
     212    </listitem>
     213
     214  </itemizedlist>
     215
     216  <!-- Added because folks keep posting their console file with X questions
     217  to blfs-support list -->
     218  <note>
     219    <para>The <filename>/etc/sysconfig/console</filename> file only controls the
     220    Linux text console localization. It has nothing to do with setting the proper
     221    keyboard layout and terminal fonts in the X Window System, with ssh sessions
     222    or with a serial console.</para>
     223  </note>
    105224
    106225</sect1>
    107 
Note: See TracChangeset for help on using the changeset viewer.