console.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-scripts-console">
  8. <?dbhtml filename="console.html"?>
  9. <title>Configuring the Linux Console</title>
  10. <indexterm zone="ch-scripts-console">
  11. <primary sortas="d-console">console</primary>
  12. <secondary>configuring</secondary>
  13. </indexterm>
  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 copyright sign, the British pound sign and Euro symbol)
  17. will not be used and the keyboard is a U.S. one, skip this section. Without
  18. the configuration file, the <command>console</command> bootscript will do
  19. nothing.</para>
  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. HOWTOs can also help with this, see <ulink
  24. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. If still in
  25. doubt, look in the <filename class="directory">/usr/share/kbd</filename>
  26. directory for valid keymaps and screen fonts. Read
  27. <filename>loadkeys(1)</filename> and <filename>setfont(8)</filename> manual
  28. pages to determine the correct arguments for these programs.</para>
  29. <para>The <filename>/etc/sysconfig/console</filename> file should contain lines
  30. of the form: VARIABLE="value". The following variables are recognized:</para>
  31. <variablelist>
  32. <varlistentry>
  33. <term>KEYMAP</term>
  34. <listitem>
  35. <para>This variable specifies the arguments for the
  36. <command>loadkeys</command> program, typically, the name of keymap
  37. to load, e.g., <quote>es</quote>. If this variable is not set, the
  38. bootscript will not run the <command>loadkeys</command> program,
  39. and the default kernel keymap will be used.</para>
  40. </listitem>
  41. </varlistentry>
  42. <varlistentry>
  43. <term>KEYMAP_CORRECTIONS</term>
  44. <listitem>
  45. <para>This (rarely used) variable
  46. specifies the arguments for the second call to the
  47. <command>loadkeys</command> program. This is useful if the stock keymap
  48. is not completely satisfactory and a small adjustment has to be made. E.g.,
  49. to include the Euro sign into a keymap that normally doesn't have it,
  50. set this variable to <quote>euro2</quote>.</para>
  51. </listitem>
  52. </varlistentry>
  53. <varlistentry>
  54. <term>FONT</term>
  55. <listitem>
  56. <para>This variable specifies the arguments for the
  57. <command>setfont</command> program. Typically, this includes the font
  58. name, <quote>-m</quote>, and the name of the application character
  59. map to load. E.g., in order to load the <quote>lat1-16</quote> font
  60. together with the <quote>8859-1</quote> application character map
  61. (as it is appropriate in the USA), <!-- because of the copyright sign -->
  62. set this variable to <quote>lat1-16 -m 8859-1</quote>.
  63. If this variable is not set, the bootscript will not run the
  64. <command>setfont</command> program, and the default VGA font will be
  65. used together with the default application character map.</para>
  66. </listitem>
  67. </varlistentry>
  68. <varlistentry>
  69. <term>UNICODE</term>
  70. <listitem>
  71. <para>Set this variable to <quote>1</quote>, <quote>yes</quote> or
  72. <quote>true</quote> in order to put the
  73. console into UTF-8 mode. This is useful in UTF-8 based locales and
  74. harmful otherwise.</para>
  75. </listitem>
  76. </varlistentry>
  77. <varlistentry>
  78. <term>LEGACY_CHARSET</term>
  79. <listitem>
  80. <para>For many keyboard layouts, there is no stock Unicode keymap in
  81. the Kbd package. The <command>console</command> bootscript will
  82. convert an available keymap to UTF-8 on the fly if this variable is
  83. set to the encoding of the available non-UTF-8 keymap. Note, however,
  84. that dead keys (i.e., keys that don't produce a character by
  85. themselves, but put an accent onto a character procuced by the next
  86. key; there are no dead keys on the standard US keyboard) and composing
  87. (i.e., pressing Ctrl+. A E in order to produce the &AElig; character)
  88. will not work in UTF-8 mode without the special kernel patch.
  89. This variable is useful only in UTF-8 mode.</para>
  90. </listitem>
  91. </varlistentry>
  92. <varlistentry>
  93. <term>BROKEN_COMPOSE</term>
  94. <listitem>
  95. <para>Set this to <quote>0</quote> if you are going to apply the kernel patch in
  96. Chapter 8. Note that you also have to add the character set expected
  97. by composition rules in your keymap to the FONT variable after the
  98. <quote>-m</quote> switch. This variable is useful only in UTF-8 mode.</para>
  99. </listitem>
  100. </varlistentry>
  101. </variablelist>
  102. <para>Support for compiling the keymap directly into the kernel has been
  103. removed because there were reports that it leads to incorrect results.</para>
  104. <para>Some examples:</para>
  105. <itemizedlist>
  106. <listitem>
  107. <para>For a non-Unicode setup, only the KEYMAP and FONT variables are
  108. generally needed. E.g., for a Polish setup, one would use:</para>
  109. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  110. <literal># Begin /etc/sysconfig/console
  111. KEYMAP="pl2"
  112. FONT="lat2a-16 -m 8859-2"
  113. # End /etc/sysconfig/console</literal>
  114. EOF</userinput></screen>
  115. </listitem>
  116. <listitem>
  117. <para>As mentioned above, it is sometimes necessary to adjust a
  118. stock keymap slightly. The following example adds the Euro symbol to the
  119. German keymap:</para>
  120. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  121. <literal># Begin /etc/sysconfig/console
  122. KEYMAP="de-latin1"
  123. KEYMAP_CORRECTIONS="euro2"
  124. FONT="lat0-16 -m 8859-15"
  125. # End /etc/sysconfig/console</literal>
  126. EOF</userinput></screen>
  127. </listitem>
  128. <listitem>
  129. <para>The following is a Unicode-enabled example for Bulgarian, where a stock
  130. UTF-8 keymap exists and defines no dead keys or composition rules:</para>
  131. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  132. <literal># Begin /etc/sysconfig/console
  133. UNICODE="1"
  134. KEYMAP="bg_bds-utf8"
  135. FONT="LatArCyrHeb-16"
  136. # End /etc/sysconfig/console</literal>
  137. EOF</userinput></screen>
  138. </listitem>
  139. <listitem>
  140. <para>Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous
  141. example, bright colors are no longer available on the Linux console unless
  142. a framebuffer is used. If one wants to have bright colors without
  143. framebuffer and can live without characters not belonging to his language,
  144. it is still possible to use a language-specific 256-glyph font, as
  145. illustrated below.</para>
  146. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  147. <literal># Begin /etc/sysconfig/console
  148. UNICODE="1"
  149. KEYMAP="bg_bds-utf8"
  150. FONT="cyr-sun16"
  151. # End /etc/sysconfig/console</literal>
  152. EOF</userinput></screen>
  153. </listitem>
  154. <listitem>
  155. <para>The following example illustrates keymap autoconversion from
  156. ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode:</para>
  157. <screen role="nodump"><userinput>cat &gt; /etc/sysconfig/console &lt;&lt; "EOF"
  158. <literal># Begin /etc/sysconfig/console
  159. UNICODE="1"
  160. KEYMAP="de-latin1"
  161. KEYMAP_CORRECTIONS="euro2"
  162. LEGACY_CHARSET="iso-8859-15"
  163. BROKEN_COMPOSE="0"
  164. FONT="LatArCyrHeb-16 -m 8859-15"
  165. # End /etc/sysconfig/console</literal>
  166. EOF</userinput></screen>
  167. </listitem>
  168. <listitem>
  169. <para>For Chinese, Japanese, Korean and some other languages, the Linux
  170. console cannot be configured to display the needed characters. Users
  171. who need such languages should install the X Window System, fonts that
  172. cover the necessary character ranges, and the proper input method (e.g.,
  173. SCIM, it supports a wide variety of languages).</para>
  174. </listitem>
  175. </itemizedlist>
  176. <!-- Added because folks keep posting their console file with X questions
  177. to blfs-support list -->
  178. <note>
  179. <para>The <filename>/etc/sysconfig/console</filename> file only controls the
  180. Linux text console localization. It has nothing to do with setting the proper
  181. keyboard layout and terminal fonts in the X Window System, with ssh sessions
  182. or with a serial console.</para>
  183. </note>
  184. </sect1>