In Debian we can just do:
dpkg-reconfigure keyboard-configuration
if you can remember that. It's what raspi-config calls on a Raspberry Pi, but they borrowed it from Debian.
Nothing in there about how many keys a keyboard has, I'm set to a 105 key one which is probably why my numlock doesn't work, it's on the wrong keycode. It asks for numbers of keys or brand and model, then in the 2nd step it asks for country.
Screenshot image:
https://imgur.com/gallery/qPcs0jp
Ah, /usr/share/console-setup/KeyboardNames.pl. And it comes down to the way it's been done since 1995.
http://xfree86.org/current/XKBproto.pdf
It's not that hard to make a custom layout I think but first there's this 155 page PDF to at least skim.
But wait, you don't have to do it by hand, there's xkeycaps (in the debs).
https://imgur.com/gallery/4oCkVAA
Looks like the Athena widget set I think. Right-click in the top of a scrollbar to scroll up. Click in the bottom to scroll down. The scrollbars are why I like Motif better.