Skip to content

International keyboad keymaps support through Options-> Change configuration Settings -> Change Keyboard Keymap #1961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

tlaurion
Copy link
Collaborator

@tlaurion tlaurion commented Apr 23, 2025

Fixes #555 #1831
See #1961 (comment) for current state (screenshots)

To test this PoC under Qemu

  • ./docker_repro.sh make BOARD=qemu-coreboot-whiptail-tpm2 real.remove_canary_files-extract_patch_rebuild_what_changed
  • ./docker_repro.sh make BOARD=qemu-coreboot-whiptail-tpm2
  • ./docker_repro.sh make BOARD=qemu-coreboot-whiptail-tpm2 run

TODOs

  • Check if smaller SPI based board will fail to build rom in current state
    • talos-2 had issues compiling kbd: explicitely removed in board config
    • x220/t420 had not enough place to fit kbd and keymaps : explicitely removed in the board configs
  • Select keymaps that are sold by OEMs today and start with that @wessel-novacustom
  • Add configuration options menu to select and persist keyboard setting
  • Add init code to use exported keymap path, use it if found otherwise default to US keyboard as before
  • Other?
  • Test
    • qemu-whiptail: changing hardcoded path to keymap in board config (no persistence of config changes since no internal flashing)
    • qemu-fbwhiptail : make sure whiptail menus are compatile with fbwhiptail (reduced functions of whiptail)
    • test x230 keymap selection, persistence and usage on reboot: ok

@JonathonHall-Purism comments?

How to Change Keyboard Keymap
2025-04-24-145308
2025-04-24-145323
2025-04-24-135256
2025-04-25-094454
2025-04-24-135343
2025-04-24-135406
2025-04-24-135423
2025-04-24-135438
2025-04-24-145129


old (2025-04-23)
Then go to Recovery shell on main console.

Then explore keyboards keymaps under /etc/keymaps/i386:
2025-04-23-131952

@tlaurion tlaurion marked this pull request as draft April 23, 2025 17:27
@tlaurion tlaurion changed the title PoC: recovery shell can loadkeys all bundled keymaps for 249Kb increase. What do we want? PoC: international keyboad keymaps added into additional data.cpio, can be loaded through loadkeys /etc/keymaps/... Apr 23, 2025
@tlaurion tlaurion force-pushed the inconditional_kdb_inclusion-PoC-include_all_keymaps branch from 25351ab to 9717f02 Compare April 24, 2025 17:01
@tlaurion

This comment was marked as outdated.

…s (terminfo/l/linux -> /etc/terminfo/l/linux previously under tools.cpio)

TODO: detail work done here prior of merge
For the moment, see this uncleaned branch https://github.com/tlaurion/heads/tree/transition_to_data_cpio

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…source keyboard keymaps under data.cpio

user@localhost:~/heads$ ls -alh /home/user/heads/build/x86/qemu-coreboot-whiptail-tpm2/data.cpio
-rw-r--r-- 1 root root 2.4M Apr 23 12:33 /home/user/heads/build/x86/qemu-coreboot-whiptail-tpm2/data.cpio
user@localhost:~/heads$ sudo xz --check=crc32 --lzma2=dict=1MiB build/x86/qemu-coreboot-whiptail-tpm2/data.cpio -z -9
user@localhost:~/heads$ ls -alh build/x86/qemu-coreboot-whiptail-tpm2/data.cpio.xz
-rw-r--r-- 1 root root 158K Apr 23 12:33 build/x86/qemu-coreboot-whiptail-tpm2/data.cpio.xz

So adding all source based keymaps add 158Kb compressed to initrd.cpio.xz

TODO:
- init: if exported keymap_path and file exists: loadkeys it; otherwise ontinue as of now and defaults to default US keymap
- Configurator deitor: show filelist, loadkeys keymap, test input with user, confirm keymap selection, persist setting
- Add to oem-factory-reset (but adds another step: in default steps? in non-default? Desired workflow?)
  - This is desired for a long time since OEM customize keyboard selected by end user prior of shipping: so should customize keymap under Heads and OS install.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…yboard mappings for this board

TODO: Would need patching

Error:
user@localhost:~/heads$ cat /home/user/heads/build/ppc64/log/kbd.log
make -C "/home/user/heads/build/ppc64/kbd-2.6.1" -j12 --load-average=18  CC=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-gcc -fdebug-prefix-map=/home/user/heads=heads -gno-record-gcc-switches -D__MUSL__ --sysroot /home/user/heads/install/ppc64 -isystem /home/user/heads/install/ppc64/include -L/home/user/heads/install/ppc64/lib  AR=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-ar LD=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-ld STRIP=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-strip NM=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-nm OBJCOPY=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-objcopy OBJDUMP=/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-objdump PKG_CONFIG_PATH= PKG_CONFIG_LIBDIR=/home/user/heads/install/ppc64/lib/pkgconfig PKG_CONFIG_SYSROOT_DIR=/home/user/heads/install/ppc64
make[1]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1'
make  all-recursive
make[2]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1'
Making all in src
make[3]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src'
Making all in libcommon
make[4]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libcommon'
  CC       getfd.o
  CC       error.o
  CC       version.o
  AR       libcommon.a
/home/user/heads/crossgcc/ppc64/bin/powerpc64le-linux-musl-ar: `u' modifier ignored since `D' is the default (see `U')
make[4]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libcommon'
Making all in libkbdfile
make[4]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkbdfile'
  CC       init.lo
  CC       kbdfile.lo
  CCLD     libkbdfile.la
make[4]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkbdfile'
Making all in libkfont
make[4]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkfont'
  CC       psffontop.lo
  CC       psfxtable.lo
  CC       utf8.lo
  CC       kdmapop.lo
  CC       context.lo
  CC       unicode.lo
  CC       kdfontop.lo
  CC       loadunimap.lo
  CC       mapscrn.lo
  CC       setfont.lo
setfont.c: In function 'try_loadfont':
setfont.c:102:14: warning: conversion from 'int' to 'unsigned char' may change value [-Wconversion]
  102 |        b2 |= 3 << (j * 2);
      |              ^
mapscrn.c: In function 'kfont_load_consolemap':
mapscrn.c:161:13: warning: conversion from 'int' to 'short unsigned int' may change value [-Wconversion]
  161 |   ubuf[i] = (0xf000 + i);
      |             ^
loadunimap.c: In function 'parseline':
loadunimap.c:220:24: warning: conversion from 'int' to 'short unsigned int' may change value [-Wconversion]
  220 |    unsigned short un = un0 - fp0;
      |                        ^~~
loadunimap.c:221:38: warning: conversion from 'int' to 'short unsigned int' may change value [-Wconversion]
  221 |    if ((ret = add_unipair(ctx, i, un + i, list, listsz, listct)) < 0)
      |                                   ~~~^~~
  CCLD     libkfont.la
make[4]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkfont'
Making all in libkeymap
make[4]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkeymap'
make  all-am
make[5]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkeymap'
  CC       array.lo
  CC       common.lo
  CC       dump.lo
  CC       kernel.lo
  CC       kmap.lo
  CC       func.lo
  CC       diacr.lo
  CC       loadkeys.lo
  CC       summary.lo
  CC       parser.lo
  CC       modifiers.lo
  CC       analyze.lo
kernel.c: In function 'lk_kernel_diacrs':
kernel.c:101:16: warning: conversion from 'long unsigned int' to 'int' may change value [-Wconversion]
  101 |  if (ioctl(fd, request, (unsigned long)&kd)) {
      |                ^~~~~~~
  CC       ksyms.lo
  CCLD     libkeymap.la
make[5]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkeymap'
make[4]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/libkeymap'
Making all in vlock
make[4]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/vlock'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src/vlock'
make[4]: Entering directory '/home/user/heads/build/ppc64/kbd-2.6.1/src'
  CC       mapscrn.o
  CC       loadunimap.o
  CC       dumpkeys.o
  CC       showkey.o
  CC       loadkeys.o
  CC       setfont.o
  CC       showconsolefont.o
  CC       setmetamode.o
  CC       setleds.o
  CC       kbd_mode.o
  CC       psfxtable.o
  CC       fgconsole.o
  CC       kbdrate.o
  CC       chvt.o
  CC       deallocvt.o
  CC       openvt.o
  CC       kbdinfo.o
  CC       getkeycodes.o
  CC       setvtrgb.o
  CC       setkeycodes.o
  CC       resizecons.o
  CCLD     mapscrn
  CCLD     loadunimap
resizecons.c: In function 'main':
resizecons.c:303:19: warning: signed conversion from 'long unsigned int' to 'int' changes value from '2148037735' to '-2146929561' [-Wsign-conversion]
  303 |     if (ioctl(fd, TIOCSWINSZ, &winsize))
      |                   ^~~~~~~~~~
  CCLD     dumpkeys
  CCLD     loadkeys
resizecons.c: In function 'vga_set_cursor':
resizecons.c:394:2: error: inconsistent operand constraints in an 'asm'
  394 |  __asm__ volatile("outb %0,%1"
      |  ^~~~~~~
resizecons.c:402:2: error: inconsistent operand constraints in an 'asm'
  402 |  __asm__ volatile("inb %1,%0"
      |  ^~~~~~~
resizecons.c:394:2: error: inconsistent operand constraints in an 'asm'
  394 |  __asm__ volatile("outb %0,%1"
      |  ^~~~~~~
resizecons.c:394:2: error: inconsistent operand constraints in an 'asm'
  394 |  __asm__ volatile("outb %0,%1"
      |  ^~~~~~~
resizecons.c:402:2: error: inconsistent operand constraints in an 'asm'
  402 |  __asm__ volatile("inb %1,%0"
      |  ^~~~~~~
resizecons.c:394:2: error: inconsistent operand constraints in an 'asm'
  394 |  __asm__ volatile("outb %0,%1"
      |  ^~~~~~~
  CCLD     showkey
make[4]: *** [Makefile:993: resizecons.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src'
make[3]: *** [Makefile:1040: all-recursive] Error 1
make[3]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1/src'
make[2]: *** [Makefile:489: all-recursive] Error 1
make[2]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1'
make[1]: *** [Makefile:420: all] Error 2
make[1]: Leaving directory '/home/user/heads/build/ppc64/kbd-2.6.1'

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…llback/save to persist across reboots

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…it after usb drivers loaded for optional usb keyboard support

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…ib/kbd/keymaps/i386/qwerty/us.map' explicitely since qemu don't support internal flashing still

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
…y/qwertz/azerty) prior of chossing, testing one, rejecting, testing one until confirming ok.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
@tlaurion tlaurion force-pushed the inconditional_kdb_inclusion-PoC-include_all_keymaps branch from 9717f02 to e74852a Compare April 24, 2025 18:38
@tlaurion
Copy link
Collaborator Author

tlaurion commented Apr 24, 2025

Notes:

@wessel-novacustom

https://novacustom.com/product/keyboard-for-v56-series/ keyboard customization
2025-04-24-144138

would be covered by end user customization at reception for now with 33be47f and e74852a

Updated OP with pictures.

@tlaurion tlaurion changed the title PoC: international keyboad keymaps added into additional data.cpio, can be loaded through loadkeys /etc/keymaps/... International keyboad keymaps support through Options-> Change configuration Settings -> Change Keyboard Keymap Apr 24, 2025
@tlaurion tlaurion marked this pull request as ready for review April 24, 2025 18:50
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
@tlaurion
Copy link
Collaborator Author

The t420 an x220 don't have enough space in their 8MB SPI chips. Will need to explicitly disable kdb+loadkeys+keymap inclusions for those boards, otherwise more R&D needed under #590 (not planned)

…ard keymaps) for those boards with insufficient SPI space (8MB)

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow non-us keyboards
1 participant