Doc/keytab-lilo

From Syslinux Wiki
Jump to: navigation, search

The content of doc/keytab-lilo.txt (6.04-pre1, with minor modifications):


This is the documentation for the keytab-lilo.pl program. It was taken verbatim from the LILO-20 README file; only this header was added.


LILO program code, documentation and auxiliary programs are Copyright 1992-1997 Werner Almesberger. All rights reserved.

Redistribution and use in source and binary forms of parts of or the whole original or derived work are permitted provided that the original work is properly attributed to the author. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. This work is provided "as is" and without any express or implied warranties.


To use a LILO keyboard table with Syslinux, specify the KBDMAP command in syslinux.cfg, for example:

       KBDMAP path/to/de.ktl


See also Directives/kbdmap, kbdmap.c32, Config#KBDMAP.



Keyboard translation

The PC keyboard emits so-called scan codes, which are basically key numbers. The BIOS then translates those scan codes to the character codes of the characters printed on the key-caps. By default, the BIOS normally assumes that the keyboard has a US layout. Once an operating system is loaded, this operating system can use a different mapping.

At boot time, LILO only has access to the basic services provided by the BIOS and therefore receives the character codes for an US keyboard. It provides a simple mechanism to re-map the character codes to what is appropriate for the actual layout.*


* The current mechanism isn't perfect, because it sits on top of the scan code to character code translation performed by the BIOS. This means that key combinations that don't produce any useful character on the US keyboard will be ignored by LILO. The advantage of this approach is its simplicity.

Compiling keyboard translation tables

LILO obtains layout information from the keyboard translation tables Linux uses for the text console. They are usually stored in /usr/lib/kbd/keytables. LILO comes with a program keytab-lilo.pl that reads those tables and generates a table suitable for use by the map installer. keytab-lilo.pl invokes the program loadkeys to print the tables in a format that is easy to parse.*

* On some systems, only root can execute loadkeys. It is then necessary to run keytab-lilo.pl as root too.

keytab-lilo.pl is used as follows:

keytab-lilo.pl [ -p <old_code>=<new_code> ] ...
  [<path>]<default_layout>[.<extension>] ]
   [<path>]<kbd_layout>[.<extension>] ]

 -p <old_code>=<new_code>
   Specifies corrections ("patches") to the mapping obtained from the
  translation table files. E.g. if pressing the upper case "A" should
  yield an at sign, -p 65=64 would be used. The  -p  option can be
  repeated any number of times. The codes can also be given as
  hexadecimal or as octal numbers if they are prefixed with 0x or 0,
  respectively.
<path>  The directory in which the file resides. The default path is
  /usr/lib/kbd/keytables.
<extension>  Usually the trailing .map, which is automatically added if
  the file name doesn't contain dots.
<default_layout>  Is the layout which specifies the translation by the
  BIOS. If none is specified, us is assumed.
<kbd_layout>  Is the actual layout of the keyboard.

keytab-lilo.pl writes the resulting translation table as a binary string to standard output. Such tables can be stored anywhere with any name, but the suggested naming convention is /boot/<kbd>.ktl ("Keyboard Table for Lilo"), where <kbd> is the name of the keyboard layout.

Example:

 keytab-lilo.pl de >/boot/de.ktl