grub-mklayout
Create keyboard layout files for GRUB
SYNOPSIS
grub-mklayout [OPTION...] LAYOUT
PARAMETERS
LAYOUT
The XKB keyboard layout name to be converted (e.g., de for German, fr for French, us for US English). This name typically corresponds to the layout names used by setxkbmap.
-o FILE, --output=FILE
Specify the path and filename for the generated GRUB keyboard layout (.gkb) file. If this option is omitted, the output will be written to standard output.
-v, --verbose
Enable verbose output, displaying additional information about the layout generation process.
--help
Display a help message and exit.
--version
Print version information and exit.
DESCRIPTION
The grub-mklayout command is a utility from the GRUB bootloader suite designed to convert standard XKB (X Keyboard Extension) keyboard layout definitions into a format understood by GRUB.
This is crucial for users with non-US keyboards who need to interact with the GRUB command line, for instance, when entering passwords, editing boot entries, or performing recovery operations before the operating system has fully loaded.
By creating a .gkb file specific to a language or region (e.g., German, French), grub-mklayout ensures that keystrokes typed at the GRUB prompt correspond to the expected characters on the user's physical keyboard, providing correct input for special characters, numbers, and symbols that might differ from a standard US layout.
CAVEATS
The keyboard layout generated by grub-mklayout is only effective within the GRUB command-line environment and does not influence the keyboard layout used by the operating system once it has booted.
While it translates common XKB layouts, it may not support all complex or highly specialized features of the XKB system.
USAGE IN GRUB
After generating a .gkb file, it must be placed in a GRUB-accessible location (e.g., /boot/grub/layouts/). To activate it in the GRUB command line or grub.cfg, use the following commands:
1. insmod keylayout (to load the keylayout module)
2. keymap <layout_name> (to apply the specific layout, e.g., keymap de)
EXAMPLE
To generate a German keyboard layout file named de.gkb and place it in the /boot/grub/layouts/ directory, you would typically run:
grub-mklayout -o /boot/grub/layouts/de.gkb de
HISTORY
grub-mklayout is an integral part of the GRUB 2 bootloader project, developed to enhance its internationalization capabilities. Its introduction addressed the critical need for robust keyboard layout support at the pre-boot stage, allowing users from diverse linguistic backgrounds to interact seamlessly with the GRUB command line for system maintenance and troubleshooting, a feature less robust in earlier bootloaders.
SEE ALSO
grub-mkconfig(8), grub-install(8), setxkbmap(1), grub(8)