openpower: Add loadkeys package to enable backtab
This is a copy of the buildroot package 'kbd', but with a custom install
command that only installs the 'loadkeys' binary, saving almost 1MB of
space.
The loadkeys command then allows us to add additional keymap definitions
during init to enable the use of Shift-Tab on the VGA console.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
diff --git a/openpower/package/Config.in b/openpower/package/Config.in
index e7e26fb..902d2ec 100755
--- a/openpower/package/Config.in
+++ b/openpower/package/Config.in
@@ -13,3 +13,4 @@
source "$BR2_EXTERNAL/package/capp-ucode/Config.in"
source "$BR2_EXTERNAL/package/skiboot/Config.in"
source "$BR2_EXTERNAL/package/libflash/Config.in"
+source "$BR2_EXTERNAL/package/loadkeys/Config.in"
diff --git a/openpower/package/loadkeys/Config.in b/openpower/package/loadkeys/Config.in
new file mode 100644
index 0000000..c53391c
--- /dev/null
+++ b/openpower/package/loadkeys/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_LOADKEYS
+ bool "loadkeys"
+ select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT_IF_LOCALE
+ select BR2_PACKAGE_CHECK
+ # Uses fork()
+ depends on BR2_USE_MMU
+ help
+ Custom package to install just the 'loadkeys'
+ binary from the kbd package.
+
+ http://kernel.org/pub/linux/utils/kbd/
diff --git a/openpower/package/loadkeys/S16-keymap b/openpower/package/loadkeys/S16-keymap
new file mode 100755
index 0000000..aa3f068
--- /dev/null
+++ b/openpower/package/loadkeys/S16-keymap
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case "$1" in
+ start)
+ loadkeys /etc/kbd/config
+ ;;
+esac
+
+exit 0
diff --git a/openpower/package/loadkeys/backtab-keymap b/openpower/package/loadkeys/backtab-keymap
new file mode 100644
index 0000000..953b990
--- /dev/null
+++ b/openpower/package/loadkeys/backtab-keymap
@@ -0,0 +1,10 @@
+# Enable backtab for VGA consoles
+# Thanks to http://web.mit.edu/daveg/Info/backtab-howto.txt
+
+keycode 15 = Tab F91
+ alt keycode 15 = Meta_Tab
+ shift alt keycode 15 = F92
+
+# backtab and M-backtab
+string F91 = "\033[Z"
+string F92 = "\033\033[Z"
diff --git a/openpower/package/loadkeys/loadkeys.hash b/openpower/package/loadkeys/loadkeys.hash
new file mode 100644
index 0000000..39a4cdd
--- /dev/null
+++ b/openpower/package/loadkeys/loadkeys.hash
@@ -0,0 +1,2 @@
+# From https://www.kernel.org/pub/linux/utils/kbd/sha256sums.asc
+sha256 7a899de1c0eb75f3aea737095a736f2375e1cbfbe693fc14a3fe0bfb4649fb5e kbd-2.0.3.tar.xz
diff --git a/openpower/package/loadkeys/loadkeys.mk b/openpower/package/loadkeys/loadkeys.mk
new file mode 100644
index 0000000..db6cbca
--- /dev/null
+++ b/openpower/package/loadkeys/loadkeys.mk
@@ -0,0 +1,31 @@
+################################################################################
+#
+# loadkeys - Custom installer for the kbd package
+#
+################################################################################
+
+LOADKEYS_VERSION = 2.0.3
+LOADKEYS_SOURCE = kbd-$(LOADKEYS_VERSION).tar.xz
+LOADKEYS_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/kbd
+LOADKEYS_CONF_OPTS = --disable-vlock
+LOADKEYS_DEPENDENCIES = $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
+LOADKEYS_LICENSE = GPLv2+
+LOADKEYS_LICENSE_FILES = COPYING
+LOADKEYS_INSTALL_STAGING = NO
+LOADKEYS_INSTALL_TARGET = YES
+
+define LOADKEYS_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 0755 $(@D)/src/loadkeys \
+ $(TARGET_DIR)/usr/bin/
+endef
+
+define LOADKEYS_POST_INSTALL
+ $(INSTALL) -D -m 0755 $(BR2_EXTERNAL)/package/loadkeys/S16-keymap \
+ $(TARGET_DIR)/etc/init.d/
+ $(INSTALL) -D -m 0755 $(BR2_EXTERNAL)/package/loadkeys/backtab-keymap \
+ $(TARGET_DIR)/etc/kbd/config
+endef
+
+LOADKEYS_POST_INSTALL_TARGET_HOOKS += LOADKEYS_POST_INSTALL
+
+$(eval $(autotools-package))