Finding a useful resource for this took me quite a while. The solution comes with the standard repository:
apt-get install g15daemon
On my 18-key G15, keys G1..G18 map to key 175..192, and M1..MR map to 193..196.
xmodmap
can be used to reassign keys; unfortunately, you can’t assign a sequence of keys to one key press. Still looking for a solution to this.