Description of work systemd-udev-console-fb
============================================

This package is based on the method of loading console fonts, cast
Article https://wiki.archlinux.org/index.php/Fonts_%28Русский%29
Below is a brief retelling of the head and a description of the method used.


Theory
=======

After starting the Linux kernel creates and maintains a text console.

Text output in a character device /dev/console, is recorded in a special buffer in the memory together with information about the color.

To display the text on the screen using a different buffer that is loaded is specifically designed for the console bitmap monospaced font.

When initializing the console in the buffer is written the initial text, compiled into the kernel (as a rule, without the Cyrillic alphabet)
and later in the font buffer can be replaced by a setfont utility. Since the buffer is only the contents of the file with the font,
but not its name, the kernel does not know what font is loaded into it, and in the case of a console again, as happens when switching from a text mode
in freymbufer after the start of the corresponding video card drm-module, the font is reset to the initial value.

In addition to the "real" console, the kernel supports dynamically extensible set of virtual consoles /dev/tty1, tty2, etc., and the root virtual console /dev/console

Although the device for the first 59 virtual consoles are created in advance, console themselves with the submission remain in the nucleus only numbers.
In reality, they appear only after the first attempt to display them in the text. The screen displays all of the virtual console by the substitution of buffers in a single
"Real" console, with the font buffer when creating a new virtual console that is taken, that was the "real" at the time of creation.

As a result, if the font was downloaded to the real console to create a virtual console, in the future it will automatically apply to all virtual,
otherwise it does not happen, and each new virtual inherits the font from the previous visible, that is, one that has been loaded into the "real" in the moment.


The problem with systemd
===================

The package systemd for booting console font responsible program /lib/systemd/systemd-vconsole-setup, which loads the desired font.

Available console fonts in the system are located in /lib/kbd/consolefonts/, you can check them out by running setfont for each of them.

If your card is connected at boot drm-modules, such as i915 for intel, it leads to the start of the new framebuffer device 
(or a replacement of the old to the new) (/dev/fb0, etc.), and re-initialize the console to reset font.
If this happens already after systemd-vconsole-setup has loaded your font, you need to either re-download it, or provide the start-drm module known before loading the font.

This package applied the following recipe from the article. We defer loading the console font until initialized framebuffer.
To do this, a rule is created udev /lib/udev/rules.d/991-fb-systemd.rules such content:

  # Setup all vconsoles for a new framebuffer device
  KERNEL=="fb*", ACTION=="add", \
  RUN+="/bin/sh /lib/udev/all-vcs-set"

and a script that this rule will run /lib/udev/all-vcs-set:

   #!/bin/sh
  # We must load locale for $VCS util
   . /etc/sysconfig/i18n

  export LANG
  VCS=/lib/systemd/systemd-vconsole-setup
  # Setup the "real" (current) console first
  $VCS
  # Setup all other active consoles
  for VC in /dev/vcs[0-9]*
  do $VCS /dev/tty${VC#/dev/vcs}
  done


The script reads the locale that is required for normal operation of utility systemd-vconsole-setup from the file. /etc/sysconfig/i18n, and then performs
it for "real" console, and for each of the created at this point the virtual, if any.
To determine the initialized virtual consoles are devices used to text random access buffers respective consoles /dev/vcs*, which in contrast to /dev/tty* are only for existing consoles.
