lbmk/config/grub/keymap
Leah Rowe 37817e6bcb GRUB: insert only 1 keymap per board, in cbfs
There is no need to add multiple keymap files, because
GRUB can load keymaps from CBFS. The current build logic
is designed to avoid building multiple GRUB binaries,
which are expensive computationally because each one
would then have to be compressed for each board.

This patch provides the best of both worlds: less space
used in flash like in the old lbmk design (1 keymap per
board), but retaining the current build speeds and therefore
not re-introducing the slowness of lbmk's previous GRUB
build logic.

The grub.cfg file has been modified, accordingly. It now
only loads a keymap.gkb file from CBFS, by default. It does
this, only if that file exists; if not, GRUB already defaults
to US Qwerty layout anyway.

ALSO: compress all keymap gkb files with xz -6

GRUB automatically decompresses files when accessed.
This results in about 2KB of flash space saved in CBFS.

Here is real-world data, showing the increased flash space:

< fallback/payload               0x3eb80    simple elf     548821 none
< keymap.cfg                     0xc4bc0    raw                16 none
< (empty)                        0xc4c00    null         11633316 none
---
> fallback/payload               0x3eb80    simple elf     546787 none
> keymap.gkb                     0xc43c0    raw               344 none
> (empty)                        0xc4540    null         11635044 none

This was taken by diffing the cbfstool "print" output,
both before and after. The *after* result is with this change.
11633316. In this example, 1728 bytes have been saved. Therefore,
with compression taken into account, this patch saves about 1.7KB
of space in CBFS.

This change means that lbmk can now scale to support hundreds
of keymaps, without increasing the amount of flash space used,
in each given image. Since the keymap files are compressed in
lbmk.git, in advance, we spend no additional time on compression
at build time. The resulting change in build speed in negligible.

Adding your own keymap.gkb file was already possible, for changing
the keymap in libreboot images, if you didn't want to change the
memdisk (and thus re-compile grub.elf). Now, this is the default
behaviour, and the only way to do it. It's much more efficient.

The original keymap files can be restored, by running unxz.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-01-18 00:27:33 +00:00
..
colemak.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
deqwertz.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
esqwerty.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
frazerty.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
frdvbepo.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
itqwerty.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
svenska.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
trqwerty.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
ukdvorak.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
ukqwerty.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
usdvorak.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00
usqwerty.gkb GRUB: insert only 1 keymap per board, in cbfs 2024-01-18 00:27:33 +00:00