[yocto] Proper way to set locale and keymap

Jean-Christian de Rivaz jean-christian.derivaz at innodelec.ch
Thu Feb 28 11:53:55 PST 2019


Hi all,

After some experiments on Poky thud I have found this method to set my
fr_CH.utf8 local and fr_CH-latin keymap in my distribution with systemd
and without busybox:

Add this two lines to the local configuration or distribution
configuration file:

GLIBC_GENERATE_LOCALES = "fr_CH.UTF-8"
IMAGE_LINGUAS = "fr-ch"

After boot add this file to set local in the shell environment variable:

cat <<EOF > /etc/profile.d/locale.sh
if [ -r /etc/locale.conf ]; then
    export \$(cat /etc/locale.conf)
fi
EOF

Finally set the locale and keymap either with the localctl command:

localectl set-locale fr_CH.utf8
localectl set-keymap fr_CH-latin1

Or by directly creating this two files:

echo "LANG=fr_CH.utf8" > /etc/locale.conf
echo "KEYMAP=fr_CH-latin1" > /etc/vconsole.conf

The result is workable but a lot of [Alt Gr] + key characters are missing.
Please comment on this method and if a recipe already exist to do that.

Best regards.

Jean-Christian de Rivaz



More information about the yocto mailing list