From 37817e6bcb7c7272d7c70c3afe89a5b3b2604824 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 17 Jan 2024 23:54:53 +0000 Subject: 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 --- config/grub/config/grub.cfg | 4 ---- config/grub/keymap/colemak.gkb | Bin 2572 -> 488 bytes config/grub/keymap/deqwertz.gkb | Bin 2572 -> 508 bytes config/grub/keymap/esqwerty.gkb | Bin 2572 -> 492 bytes config/grub/keymap/frazerty.gkb | Bin 2572 -> 496 bytes config/grub/keymap/frdvbepo.gkb | Bin 2572 -> 516 bytes config/grub/keymap/itqwerty.gkb | Bin 2572 -> 488 bytes config/grub/keymap/svenska.gkb | Bin 2572 -> 488 bytes config/grub/keymap/trqwerty.gkb | Bin 2572 -> 476 bytes config/grub/keymap/ukdvorak.gkb | Bin 2572 -> 372 bytes config/grub/keymap/ukqwerty.gkb | Bin 2572 -> 488 bytes config/grub/keymap/usdvorak.gkb | Bin 2572 -> 364 bytes config/grub/keymap/usqwerty.gkb | Bin 2572 -> 344 bytes 13 files changed, 4 deletions(-) (limited to 'config') diff --git a/config/grub/config/grub.cfg b/config/grub/config/grub.cfg index efc10aa4..17576b5f 100644 --- a/config/grub/config/grub.cfg +++ b/config/grub/config/grub.cfg @@ -38,10 +38,6 @@ fi if [ -f (cbfsdisk)/keymap.gkb ]; then keymap (cbfsdisk)/keymap.gkb -elif [ -f (cbfsdisk)/keymap.cfg ]; then - source (cbfsdisk)/keymap.cfg -else - keymap usqwerty fi function try_user_config { diff --git a/config/grub/keymap/colemak.gkb b/config/grub/keymap/colemak.gkb index 6756bd73..d357816b 100644 Binary files a/config/grub/keymap/colemak.gkb and b/config/grub/keymap/colemak.gkb differ diff --git a/config/grub/keymap/deqwertz.gkb b/config/grub/keymap/deqwertz.gkb index a0c8e5ae..4928d026 100644 Binary files a/config/grub/keymap/deqwertz.gkb and b/config/grub/keymap/deqwertz.gkb differ diff --git a/config/grub/keymap/esqwerty.gkb b/config/grub/keymap/esqwerty.gkb index 18bb537f..6ce76330 100644 Binary files a/config/grub/keymap/esqwerty.gkb and b/config/grub/keymap/esqwerty.gkb differ diff --git a/config/grub/keymap/frazerty.gkb b/config/grub/keymap/frazerty.gkb index c048cec5..f8455154 100644 Binary files a/config/grub/keymap/frazerty.gkb and b/config/grub/keymap/frazerty.gkb differ diff --git a/config/grub/keymap/frdvbepo.gkb b/config/grub/keymap/frdvbepo.gkb index c90b37cf..20702607 100644 Binary files a/config/grub/keymap/frdvbepo.gkb and b/config/grub/keymap/frdvbepo.gkb differ diff --git a/config/grub/keymap/itqwerty.gkb b/config/grub/keymap/itqwerty.gkb index f247cd17..db10a54c 100644 Binary files a/config/grub/keymap/itqwerty.gkb and b/config/grub/keymap/itqwerty.gkb differ diff --git a/config/grub/keymap/svenska.gkb b/config/grub/keymap/svenska.gkb index ec627db2..75ca762d 100644 Binary files a/config/grub/keymap/svenska.gkb and b/config/grub/keymap/svenska.gkb differ diff --git a/config/grub/keymap/trqwerty.gkb b/config/grub/keymap/trqwerty.gkb index 090454e9..452100d5 100644 Binary files a/config/grub/keymap/trqwerty.gkb and b/config/grub/keymap/trqwerty.gkb differ diff --git a/config/grub/keymap/ukdvorak.gkb b/config/grub/keymap/ukdvorak.gkb index c793cae8..76b9e380 100644 Binary files a/config/grub/keymap/ukdvorak.gkb and b/config/grub/keymap/ukdvorak.gkb differ diff --git a/config/grub/keymap/ukqwerty.gkb b/config/grub/keymap/ukqwerty.gkb index 8e5ff299..5f513d85 100644 Binary files a/config/grub/keymap/ukqwerty.gkb and b/config/grub/keymap/ukqwerty.gkb differ diff --git a/config/grub/keymap/usdvorak.gkb b/config/grub/keymap/usdvorak.gkb index 41301efd..ef88232c 100644 Binary files a/config/grub/keymap/usdvorak.gkb and b/config/grub/keymap/usdvorak.gkb differ diff --git a/config/grub/keymap/usqwerty.gkb b/config/grub/keymap/usqwerty.gkb index 5fb78d33..0ea130f2 100644 Binary files a/config/grub/keymap/usqwerty.gkb and b/config/grub/keymap/usqwerty.gkb differ -- cgit v1.2.1