From bee4c289caa547f216693dd012c847fc5f8ac8b6 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 16 Jul 2020 04:26:24 -0700 Subject: [PATCH] implement keyboard layout selector in bootloader --- config/buildroot/board/librem13v4/grub.cfg | 27 +++++++++++++++++++ .../buildroot/board/librem13v4/post-build.sh | 7 ++++- .../configs/airgap_librem13v4_defconfig | 4 +-- .../rootfs_overlay/etc/init.d/S03keymap | 22 +++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 config/buildroot/board/librem13v4/grub.cfg create mode 100755 config/buildroot/rootfs_overlay/etc/init.d/S03keymap diff --git a/config/buildroot/board/librem13v4/grub.cfg b/config/buildroot/board/librem13v4/grub.cfg new file mode 100644 index 0000000..47f3857 --- /dev/null +++ b/config/buildroot/board/librem13v4/grub.cfg @@ -0,0 +1,27 @@ +set default="0" +set timeout="10" + +menuentry "Buildroot (qwerty)" { + linux /boot/bzImage root=/dev/sr0 keymap=qwerty/us + initrd /boot/initrd +} + +menuentry "Buildroot (dvorak)" { + linux /boot/bzImage root=/dev/sr0 keymap=dvorak + initrd /boot/initrd +} + +menuentry "Buildroot (colemak)" { + linux /boot/bzImage root=/dev/sr0 keymap=colemak/en-latin9 + initrd /boot/initrd +} + +menuentry "Buildroot (qwertz)" { + linux /boot/bzImage root=/dev/sr0 keymap=qwertz/de + initrd /boot/initrd +} + +menuentry "Buildroot (azerty)" { + linux /boot/bzImage root=/dev/sr0 keymap=azerty/fr + initrd /boot/initrd +} diff --git a/config/buildroot/board/librem13v4/post-build.sh b/config/buildroot/board/librem13v4/post-build.sh index 5820e24..5c90c8f 100755 --- a/config/buildroot/board/librem13v4/post-build.sh +++ b/config/buildroot/board/librem13v4/post-build.sh @@ -2,5 +2,10 @@ set -u set -e +set -x -echo "post-build.sh was run" +BOARD_DIR="$(dirname $0)" + +cp -f ${BOARD_DIR}/grub.cfg ${TARGET_DIR}/boot/grub/grub.cfg + +exit $? diff --git a/config/buildroot/configs/airgap_librem13v4_defconfig b/config/buildroot/configs/airgap_librem13v4_defconfig index d15a2d2..86acb27 100644 --- a/config/buildroot/configs/airgap_librem13v4_defconfig +++ b/config/buildroot/configs/airgap_librem13v4_defconfig @@ -1041,7 +1041,7 @@ BR2_PACKAGE_FLASHROM_ARCH_SUPPORTS=y # BR2_PACKAGE_IPMIUTIL is not set # BR2_PACKAGE_IRDA_UTILS is not set # BR2_PACKAGE_IUCODE_TOOL is not set -# BR2_PACKAGE_KBD is not set +BR2_PACKAGE_KBD=y # BR2_PACKAGE_LCDPROC is not set # BR2_PACKAGE_LIBUBOOTENV is not set # BR2_PACKAGE_LIBUIO is not set @@ -3329,7 +3329,7 @@ BR2_TARGET_ROOTFS_CPIO_NONE=y # BR2_TARGET_ROOTFS_INITRAMFS is not set BR2_TARGET_ROOTFS_ISO9660=y BR2_TARGET_ROOTFS_ISO9660_GRUB2=y -BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="fs/iso9660/grub.cfg" +BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="$(BR2_EXTERNAL_Airgap_PATH)/board/librem13v4/grub.cfg" BR2_TARGET_ROOTFS_ISO9660_INITRD=y # BR2_TARGET_ROOTFS_JFFS2 is not set # BR2_TARGET_ROOTFS_ROMFS is not set diff --git a/config/buildroot/rootfs_overlay/etc/init.d/S03keymap b/config/buildroot/rootfs_overlay/etc/init.d/S03keymap new file mode 100755 index 0000000..c84b376 --- /dev/null +++ b/config/buildroot/rootfs_overlay/etc/init.d/S03keymap @@ -0,0 +1,22 @@ +#!/bin/sh + +case "${1}" in + start) + keymap="$( \ + awk -F 'keymap=' '{sub(/ .*$/, "", $2); print $2}' /proc/cmdline \ + )" + if [[ ! -z "$keymap" ]]; then + printf 'Loading Keymap %s: ' "${keymap}" + loadkeys "$keymap" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + fi + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac