Dvorak example
load the kmap:
tc@myhost:~$ sudo su
root@myhost:~# /sbin/loadkmap < dvorak.kmap
Prove the (now loaded) binary kmap file (requires an aterm in X11):
tc@myhost:~/dvorak.d$ xmodmap -pke | head -55 > proof.txt
This command line (above) proves the binary keymap (dvorak.kmap). It generates (part of) a working xmodmap file, which is human-readable.
The first 55 lines are captured for analysis.
create the kmap:
--kludge--
tc@myhost:~/dvorak.d$ cp /usr/share/kmap/us.kmap ./dvorak.kmap
tc@myhost:~/dvorak.d$ vim -b dvorak.kmap
Use vim (in binary edit mode; the -b switch) to modify a working kmap. A hexdump of a success follows.
tc@myhost:~/dvorak.d$ hexdump -C dvorak.kmap | head -29
00000000 62 6b 65 79 6d 61 70 01 01 01 00 01 01 01 00 01 |bkeymap.........|
00000010 01 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000100 00 00 00 00 00 00 00 00 02 1b 00 31 00 32 00 33 |...........1.2.3|
00000110 00 34 00 35 00 36 00 37 00 38 00 39 00 30 00 5b |.4.5.6.7.8.9.0.[|
00000120 00 5d 00 7f 00 09 00 27 0b 2c 0b 2e 0b 70 0b 79 |.].....'.,...p.y|
00000130 0b 66 0b 67 0b 63 0b 72 0b 6c 0b 2f 00 3d 00 01 |.f.g.c.r.l./.=..|
00000140 02 02 07 61 0b 6f 0b 65 0b 75 0b 69 0b 64 0b 68 |...a.o.e.u.i.d.h|
00000150 0b 74 0b 6e 0b 73 00 2d 00 60 00 00 07 5c 00 3b |.t.n.s.-.`...\.;|
00000160 0b 71 0b 6a 0b 6b 0b 78 0b 62 0b 6d 0b 77 00 76 |.q.j.k.x.b.m.w.v|
00000170 00 7a 00 00 07 0c 03 03 07 20 00 07 02 00 01 01 |.z....... ......|
00000180 01 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 |................|
00000190 01 08 02 09 02 07 03 08 03 09 03 0b 03 04 03 05 |................|
000001a0 03 06 03 0a 03 01 03 02 03 03 03 00 03 10 03 06 |................|
000001b0 02 00 02 3c 00 0a 01 0b 01 00 02 00 02 00 02 00 |...<............|
000001c0 02 00 02 00 02 00 02 0e 03 02 07 0d 03 0e 02 01 |................|
000001d0 07 05 02 14 01 03 06 18 01 01 06 02 06 17 01 00 |................|
000001e0 06 19 01 15 01 16 01 1a 01 0c 01 0d 01 1b 01 1c |................|
000001f0 01 10 01 11 03 1d 01 00 02 00 02 00 02 00 02 00 |................|
00000200 02 00 02 00 02 00 02 00 02 1b 00 21 00 40 00 23 |...........!.@.#|
00000210 00 24 00 25 00 5e 00 26 00 2a 00 28 00 29 00 7b |.$.%.^.&.*.(.).{|
00000220 00 7d 00 7f 00 09 08 22 0b 3c 0b 3e 0b 50 0b 59 |.}.....".<.>.P.Y|
00000230 0b 46 0b 47 0b 43 0b 52 0b 4c 0b 3f 00 2b 00 01 |.F.G.C.R.L.?.+..|
00000240 02 02 07 41 0b 4f 0b 45 0b 55 0b 49 0b 44 0b 48 |...A.O.E.U.I.D.H|
00000250 0b 54 0b 4e 0b 53 00 5f 00 7e 00 00 07 7c 00 3a |.T.N.S._.~...|.:|
00000260 0b 51 0b 4a 0b 4b 0b 58 0b 42 0b 4d 0b 57 00 56 |.Q.J.K.X.B.M.W.V|
00000270 00 5a 00 00 07 0c 03 03 07 20 00 07 02 0c 01 0d |.Z....... ......|
00000280 01 0e 01 0f 01 10 01 11 01 12 01 13 01 1e 01 1f |................|
tc@myhost:~/dvorak.d$
AltGR with any alpha key continues to generate QWERTY (if us.kmap was the basis of the new binary kmap) while an unmodified (by a shift-state) key generates dvorak.
Continue past line 29 of the hexdump to include AltGR mappings (all-dvorak, no hidden QWERTY).
Preparation (prior to the efforts, above)
Follows is an earlier effort, to shape the X11 environment, in preparation for the procedure described (above).
tc@myhost:~/dvorak.d$ cat dvorak.xmodmap | head -55
keycode 8 =
keycode 9 = Escape
keycode 10 = 1 exclam
keycode 11 = 2 at
keycode 12 = 3 numbersign
keycode 13 = 4 dollar
keycode 14 = 5 percent
keycode 15 = 6 asciicircum
keycode 16 = 7 ampersand braceleft
keycode 17 = 8 asterisk bracketleft
keycode 18 = 9 parenleft bracketright
keycode 19 = 0 parenright braceright
keycode 20 = bracketleft braceleft
keycode 21 = bracketright braceright asciitilde
keycode 22 = BackSpace
keycode 23 = Tab
keycode 24 = apostrophe quotedbl
keycode 25 = comma less
keycode 26 = period greater
keycode 27 = p P p
keycode 28 = y Y y
keycode 29 = f F
keycode 30 = g G g
keycode 31 = c C
keycode 32 = r R r
keycode 33 = l L l
keycode 34 = slash question
keycode 35 = equal plus
keycode 36 = Return
keycode 37 = Control_L
keycode 38 = a A
keycode 39 = o O o
keycode 40 = e E
keycode 41 = u U u
keycode 42 = i I i
keycode 43 = d D
keycode 44 = h H h
keycode 45 = t T t
keycode 46 = n N n
keycode 47 = s S s
keycode 48 = minus underscore backslash
keycode 49 = grave asciitilde
keycode 50 = Shift_L
keycode 51 = backslash bar
keycode 52 = semicolon colon
keycode 53 = q Q q
keycode 54 = j J j
keycode 55 = k K k
keycode 56 = x X x
keycode 57 = b B
keycode 58 = m M m
keycode 59 = w W w
keycode 60 = v V v
keycode 61 = z Z z
keycode 62 = Shift_R
Above generated (in an aterm) using output of 'xmodmap -pke' as a starting point. Then redefine (in a text editor) by sorting according to the new keyboard layout ordering.
Apply the changed xmodmap:
tc@myhost:~/dvorak.d$ xmodmap dvorak.xmodmap
SUMMARY
Without a detailed understanding of how binary .kmap files are meant to be generated, I have nevertheless generated a useful .kmap file for my TC installation, that handles my dvorak keyboard.
Note: once a .kmap is loaded (possibly in the Linux Virtual Console) the xmodmap method (X11 only) becomes redundant.
--edited 26 Feb 0841z --
tc@myhost:~$ sudo /sbin/loadkmap < /usr/share/kmap/ANSI-dvorak.kmap
or
tc@myhost:~$ cat /opt/bootlocal.sh | grep dvorak
/sbin/loadkmap < /usr/share/kmap/ANSI-dvorak.kmap
... is pretty close to what many will need in the way of a dvorak kmap.