grub-mklayout
Create keyboard layout files for GRUB
SYNOPSIS
grub-mklayout [OPTION...] [INPUT]
PARAMETERS
-h, --help
Display usage information and exit
-v, --version
Print version information and exit
-o, --output=FILE
Set output filename (default: stdout)
-O, --format=FORMAT
Set output format: lisp (default), modmap
--prefix=DIR
Set filesystem prefix directory for GRUB modules
DESCRIPTION
grub-mklayout is a utility in the GRUB2 bootloader package that compiles human-readable keyboard layout descriptions into a binary or textual format usable by GRUB's console input system.
It reads an input file (or stdin) containing key definitions, such as key 'a' { sendkey 0x1e }, which map physical keys to actions like sending scan codes, Unicode characters, or modifier states. This enables multilingual keyboard support in GRUB menus without relying on the host system's keymap.
Output files are typically placed in /boot/grub/layouts/ and loaded via insmod layout or embedded in GRUB modules during grub-mkconfig. Supported input syntax includes shift states, dead keys, and custom bindings, making it essential for non-US layouts in boot environments.
Common use: Convert dumpkeys output or custom maps for consistent typing of usernames/passwords at boot.
CAVEATS
Input must use exact GRUB layout syntax; invalid definitions cause silent failures at boot.
Requires GRUB2 >= 2.02 for full support. Test layouts in GRUB shell via insmod layout.
INPUT EXAMPLE
key 'space' { sendkey 0x39 }
key 'Shift_L' { modifiers=shift }
USAGE EXAMPLE
grub-mklayout -o /boot/grub/layouts/us.kmap us.layout
Then add insmod layout; layout us.kmap to grub.cfg.
HISTORY
Introduced in GRUB2 1.99 (development series for 2.00); enhanced in 2.04+ for Unicode/deadkey support. Developed to replace hardcoded US keymaps.
SEE ALSO
grub-mkconfig(8), grub-mkimage(1), grub-script-check(1), dumpkeys(1), loadkeys(1)


