Skip to content

Instantly share code, notes, and snippets.

@u1735067
Created May 18, 2017 15:02
Show Gist options
  • Save u1735067/8e80ff790a93c45b2006806f72bf6efe to your computer and use it in GitHub Desktop.
Save u1735067/8e80ff790a93c45b2006806f72bf6efe to your computer and use it in GitHub Desktop.
GRUB2 on CentOS 7 -- Generate keyboard layouts

First, generate the layout in a format understood by GRUB2:

cd /boot/grub2/
mkdir layouts
cd layouts
xkb=/lib/kbd/keymaps/xkb; for layout in $(ls $xkb/); do zcat $xkb/$layout | grub2-mklayout -o ${layout/.map.gz/}.gkb; done 2>/dev/null
ls layouts

Then, in /boot/grub/custom.cfg (create it if necessary):

keymap fr

In /etc/default/grub:

# Same remark as above
GRUB_TERMINAL_INPUT="at_keyboard console"

or with serial:

# https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html
#GRUB_TERMINAL="console serial"
GRUB_TERMINAL_OUTPUT="console serial"
# By priority decreasing ; "terminal_input at_keyboard console" may make all input lost :]
GRUB_TERMINAL_INPUT="at_keyboard serial console"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

And finally, regenerate the configuration file:

grub2-mkconfig -o /boot/grub2/grub.cfg

With the help of https://wiki.archlinux.org/index.php/Talk:GRUB#Custom_keyboard_layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment