8.80. Kbd-2.7.1

The Kbd package contains key-table files, console fonts, and keyboard utilities.

Approximate build time: 0.1 SBU
Required disk space: 34 MB

8.80.1. Installation of Kbd

Create the PKGBUILD for the Kbd package with the following commands:

mkdir /sources/kbd
cd /sources/kbd
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="kbd"
pkgver="2.7.1"
pkgrel="1"
pkgdesc="The Kbd package contains key-table files, console fonts, and keyboard utilities."
arch=('x86'
      'x86_64')
url="https://kbd-project.org/"
license=('GPLv2')
groups=('core')
depends=('bash'
         'coreutils'
         'glibc'
         'linux-pam'
         'rootfs')
makedepends=('binutils'
             'bison'
             'check'
             'flex'
             'gcc'
             'gettext'
             'gzip'
             'make'
             'patch'
             'sed')
source=('https://www.kernel.org/pub/linux/utils/kbd/kbd-2.7.1.tar.xz'
        'https://www.linuxfromscratch.org/patches/lfs/development/kbd-2.7.1-backspace-1.patch')
md5sums=('f15673d9f748e58f82fa50cff0d0fd20'
         'f75cca16a38da6caa7d52151f7136895')

prepare(){
  cd "${pkgname}-${pkgver}"

  # The behaviour of the backspace and delete keys is not consistent
  # across the keymaps in the Kbd package. The following patch fixes this
  # issue for i386 keymaps
  patch -Np1 -i "${srcdir}/${pkgname}-${pkgver}-backspace-1.patch"

  # Remove the redundant resizeicons program (it requires the defunct svgalib to
  # provide the video mode files - for normal use setfont sizes the console
  # appropriately) together with its manpage.
  sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure
  sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
}

build(){
  cd "${pkgname}-${pkgver}"
  # Unlike in vanila LFS, we do not disable vclock as PAM is installed
  ./configure --prefix=/usr
  make
}

check(){
  cd "${pkgname}-${pkgver}"
  make check
}

package(){
  cd "${pkgname}-${pkgver}"
  make -j1 DESTDIR="${pkgdir}" install
  install -vdm755     "${pkgdir}/usr/share/doc/kbd-${pkgver}"
  cp -R -v docs/doc/* "${pkgdir}/usr/share/doc/kbd-${pkgver}"
}
REALEOF

The meaning of the configure option:

--disable-vlock

This option prevents the vlock utility from being built because it requires the PAM library, which isn't available in the chroot environment.

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp kbd-2.7.1-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/kbd-2.7.1-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Kbd package:

pacman -Syu
pacman -S kbd --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/kbd
cp PKGBUILD /srv/pacman/source/LFS/kbd
cd /sources
rm -rf kbd
[Note]

Note

For some languages (e.g., Belarusian) the Kbd package doesn't provide a useful keymap where the stock by keymap assumes the ISO-8859-5 encoding, and the CP1251 keymap is normally used. Users of such languages have to download working keymaps separately.

8.80.2. Contents of Kbd

Installed programs: chvt, deallocvt, dumpkeys, fgconsole, getkeycodes, kbdinfo, kbd_mode, kbdrate, loadkeys, loadunimap, mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to psfxtable), psfstriptable (link to psfxtable), psfxtable, setfont, setkeycodes, setleds, setmetamode, setvtrgb, showconsolefont, showkey, unicode_start, and unicode_stop
Installed directories: /usr/share/consolefonts, /usr/share/consoletrans, /usr/share/keymaps, /usr/share/doc/kbd-2.7.1, and /usr/share/unimaps

Short Descriptions

chvt

Changes the foreground virtual terminal

deallocvt

Deallocates unused virtual terminals

dumpkeys

Dumps the keyboard translation tables

fgconsole

Prints the number of the active virtual terminal

getkeycodes

Prints the kernel scancode-to-keycode mapping table

kbdinfo

Obtains information about the status of a console

kbd_mode

Reports or sets the keyboard mode

kbdrate

Sets the keyboard repeat and delay rates

loadkeys

Loads the keyboard translation tables

loadunimap

Loads the kernel unicode-to-font mapping table

mapscrn

An obsolete program that used to load a user-defined output character mapping table into the console driver; this is now done by setfont

openvt

Starts a program on a new virtual terminal (VT)

psfaddtable

Adds a Unicode character table to a console font

psfgettable

Extracts the embedded Unicode character table from a console font

psfstriptable

Removes the embedded Unicode character table from a console font

psfxtable

Handles Unicode character tables for console fonts

setfont

Changes the Enhanced Graphic Adapter (EGA) and Video Graphics Array (VGA) fonts on the console

setkeycodes

Loads kernel scancode-to-keycode mapping table entries; this is useful if there are unusual keys on the keyboard

setleds

Sets the keyboard flags and Light Emitting Diodes (LEDs)

setmetamode

Defines the keyboard meta-key handling

setvtrgb

Sets the console color map in all virtual terminals

showconsolefont

Shows the current EGA/VGA console screen font

showkey

Reports the scancodes, keycodes, and ASCII codes of the keys pressed on the keyboard

unicode_start

Puts the keyboard and console in UNICODE mode [Don't use this program unless your keymap file is in the ISO-8859-1 encoding. For other encodings, this utility produces incorrect results.]

unicode_stop

Reverts keyboard and console from UNICODE mode