[02095ae] | 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 |
|
---|
| 8 | <sect1 id="ch-scripts-console">
|
---|
| 9 | <?dbhtml filename="console.html"?>
|
---|
| 10 | <title>Configuring the Linux Console</title>
|
---|
| 11 |
|
---|
| 12 | <indexterm zone="ch-scripts-console">
|
---|
| 13 | <primary sortas="d-console">console</primary>
|
---|
| 14 | <secondary>configuring</secondary></indexterm>
|
---|
| 15 |
|
---|
| 16 | <para>This section discusses how to configure the <command>console</command>
|
---|
| 17 | bootscript that sets up the keyboard map and the console font. If non-ASCII
|
---|
| 18 | characters (e.g., the British pound sign and Euro character) will not be
|
---|
| 19 | used and the keyboard is a U.S. one, skip this section. Without the
|
---|
| 20 | configuration file, the <command>console</command> bootscript will do
|
---|
| 21 | nothing.</para>
|
---|
| 22 |
|
---|
| 23 | <para>The <command>console</command> script reads the
|
---|
| 24 | <filename>/etc/sysconfig/console</filename> file for configuration
|
---|
| 25 | information. Decide which keymap and screen font will be used. Various
|
---|
| 26 | language-specific HOWTO's can also help with this (see <ulink
|
---|
| 27 | url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>. A pre-made
|
---|
| 28 | <filename>/etc/sysconfig/console</filename> file with known settings for
|
---|
| 29 | several countries was installed with the LFS-Bootscripts package, so the
|
---|
| 30 | relevant section can be uncommented if the country is supported. If still
|
---|
| 31 | in doubt, look in the <filename class="directory">/usr/share/kbd</filename>
|
---|
| 32 | directory for valid keymaps and screen fonts. Read
|
---|
| 33 | <filename>loadkeys(1)</filename> and <filename>setfont(8)</filename> to
|
---|
| 34 | determine the correct arguments for these programs. Once decided, create
|
---|
| 35 | the configuration file with the following command:</para>
|
---|
| 36 |
|
---|
[586feb7] | 37 | <screen><userinput>cat >${CLFS}/etc/sysconfig/console <<"EOF"
|
---|
[02095ae] | 38 | <literal>KEYMAP="<replaceable>[arguments for loadkeys]</replaceable>"
|
---|
| 39 | FONT="<replaceable>[arguments for setfont]</replaceable>"</literal>
|
---|
| 40 | EOF</userinput></screen>
|
---|
| 41 |
|
---|
| 42 | <para>For example, for Spanish users who also want to use the Euro
|
---|
| 43 | character (accessible by pressing AltGr+E), the following settings are
|
---|
| 44 | correct:</para>
|
---|
| 45 |
|
---|
[586feb7] | 46 | <screen><userinput>cat >${CLFS}/etc/sysconfig/console <<"EOF"
|
---|
[02095ae] | 47 | <literal>KEYMAP="es euro2"
|
---|
| 48 | FONT="lat9-16 -u iso01"</literal>
|
---|
| 49 | EOF</userinput></screen>
|
---|
| 50 |
|
---|
| 51 | <note>
|
---|
| 52 | <para>The <envar>FONT</envar> line above is correct only for the ISO
|
---|
| 53 | 8859-15 character set. If using ISO 8859-1 and, therefore, a pound sign
|
---|
| 54 | instead of Euro, the correct <envar>FONT</envar> line would be:</para>
|
---|
| 55 |
|
---|
| 56 | <screen><userinput>FONT="lat1-16"</userinput></screen>
|
---|
| 57 |
|
---|
| 58 | </note>
|
---|
| 59 |
|
---|
| 60 | <para>If the <envar>KEYMAP</envar> or <envar>FONT</envar> variable is not
|
---|
| 61 | set, the <command>console</command> initscript will not run the
|
---|
| 62 | corresponding program.</para>
|
---|
| 63 |
|
---|
| 64 | <para>In some keymaps, the Backspace and Delete keys send characters
|
---|
| 65 | different from ones in the default keymap built into the kernel. This
|
---|
| 66 | confuses some applications. For example, Emacs displays its help (instead
|
---|
| 67 | of erasing the character before the cursor) when Backspace is pressed.
|
---|
| 68 | To check if the keymap in use is affected (this works only for i386
|
---|
| 69 | keymaps):</para>
|
---|
| 70 |
|
---|
| 71 | <screen><userinput>zgrep '\W14\W' <replaceable>[/path/to/your/keymap]</replaceable></userinput></screen>
|
---|
| 72 |
|
---|
| 73 | <para>If the keycode 14 is Backspace instead of Delete, create the
|
---|
| 74 | following keymap snippet to fix this issue:</para>
|
---|
| 75 |
|
---|
[586feb7] | 76 | <screen><userinput>mkdir -p ${CLFS}/etc/kbd && cat > ${CLFS}/etc/kbd/bs-sends-del <<"EOF"
|
---|
[02095ae] | 77 | <literal> keycode 14 = Delete Delete Delete Delete
|
---|
| 78 | alt keycode 14 = Meta_Delete
|
---|
| 79 | altgr alt keycode 14 = Meta_Delete
|
---|
| 80 | keycode 111 = Remove
|
---|
| 81 | altgr control keycode 111 = Boot
|
---|
| 82 | control alt keycode 111 = Boot
|
---|
| 83 | altgr control alt keycode 111 = Boot</literal>
|
---|
| 84 | EOF</userinput></screen>
|
---|
| 85 |
|
---|
| 86 | <para>Tell the <command>console</command> script to load this
|
---|
| 87 | snippet after the main keymap:</para>
|
---|
| 88 |
|
---|
[586feb7] | 89 | <screen><userinput>cat >> ${CLFS}/etc/sysconfig/console <<"EOF"
|
---|
[02095ae] | 90 | <literal>KEYMAP_CORRECTIONS="/etc/kbd/bs-sends-del"</literal>
|
---|
| 91 | EOF</userinput></screen>
|
---|
| 92 |
|
---|
| 93 | <para>To compile the keymap directly into the kernel instead of setting it
|
---|
| 94 | every time from the <command>console</command> bootscript, follow the
|
---|
| 95 | instructions given in <xref linkend="ch-bootable-kernel" role="."/> Doing
|
---|
| 96 | this ensures that the keyboard will always work as expected, even when
|
---|
| 97 | booting into maintenance mode (by passing <option>init=/bin/sh</option> to
|
---|
| 98 | the kernel), because the <command>console</command> bootscript will not be
|
---|
| 99 | run in that situation. Additionally, the kernel will not set the screen font
|
---|
| 100 | automatically. This should not pose many problems because ASCII characters
|
---|
| 101 | will be handled correctly, and it is unlikely that a user would need to rely
|
---|
| 102 | on non-ASCII characters while in maintenance mode.</para>
|
---|
| 103 |
|
---|
| 104 | <para>Since the kernel will set up the keymap, it is possible to omit the
|
---|
| 105 | <envar>KEYMAP</envar> variable from the
|
---|
| 106 | <filename>/etc/sysconfig/console</filename> configuration file. It can
|
---|
| 107 | also be left in place, if desired, without consequence. Keeping it could
|
---|
| 108 | be beneficial if running several different kernels where it is difficult
|
---|
| 109 | to ensure that the keymap is compiled into every one of them.</para>
|
---|
| 110 |
|
---|
| 111 | </sect1>
|
---|