Bug#620041: About the new option --setup-dir of setupcon
In the new version of console-setup (1.72) setupcon has a new option
--setup-dir (for now it is undocumented). If you want to configure the
console (both the font, the encoding and the keyboard) during the initrd
phase, this can be achieved easily in the following way. Suppose
/tmp/initrd/ has the files of the future initrd image. Then run the
following command:
setupcon --setup-dir /tmp/initrd
This will create an extremely simple script /tmp/initrd/bin/setupcon
that you can use in order to configure the console. Additionaly, in
/tmp/initrd/etc/console-setup/ the files required for the configuration
will be copied.
Notice that among these files, there will be device files for tty1-tty6.
The configuration script of Ubuntu for the console uses mknod to create
such device files. The current method of console-setup is simpler to
implement (because the code is shared between Linux and kFreeBSD), it
will not be, however, difficult to change initrd/bin/setupcon to use
mknod and to remove the device files from the initrd image. Please
tell, if you want this change.
Lastly, setupcon will create a file /tmp/initrd/morefiles. This file
doesn't have to be included in the initrd image. Instead it lists the
utilities that must be included in the initrd image. Depending on
whether kbd or console-tools is installed this will be
/bin/kbd_mode
/bin/setfont
/usr/bin/loadkeys (notice that this is a symlink to /bin/loadkeys)
or
/usr/bin/kbd_mode
/usr/bin/consolechars
/bin/loadkeys
One advantage of the early console configuration is that there will be
no need to change the font during the execution of the boot scripts, the
screen will not flicker and the full history will be preserved on the
console. In order achieve this the boot scripts of console-setup have to
know that the console has been already configured by initrd. Please,
advice how this can be achieved. I suppose the following is one
possible method:
1. initrd creates an empty file /tmp/console-is-configured
2. the boot scripts of console-setup do not configure the console if
they see such a file.
3. They, however, remove this file (so these scripts can be used
normally after the system boots and /tmp is not poluted with unnecessary
file).
Anton Zinoviev
Reply to: