I ended up designing and implementing a small domain-specific language for representing such figures. The language allows you to define
- horizontal, and vertical framed boxes (hbox, vbox)
- plain (unframed) composite boxes (pbox)
- horizontal and vertical labels (hl, vl)
Boxes are put side by side; a blank line continues the layout on the next line.
The Python script generates a stand-alone LaTeX document. You can find the script and examples in this GitHub repository. Below is an example of an image and the corresponding code.

hbox {
hl Kernel Space
hbox {
hl System Call Interface
vl break
vl cemt
vl ...
vl unlink
vl wait
vl write
}
hbox Boot Loader
vbox {
hl Kernel Utility Functions
vl alloc
vl free
vl wakeup
vl mget
vl access
vl iget
}
pbox {
hbox {
hl I/O Subsystem
hbox {
pbox { # Special devices, named, and sockets
hbox {
hl Special Devices
vl Line discipline
vl Raw character
vl Raw disk
}
hbox {
hl Filesystem
hbox inode layer
hbox block layer
}
}
hbox {
hl Device Drivers
hbox {
hl Character Devices
vl Keyboard
vl Printer
vl Paper tape
vl ...
}
hbox {
hl Block Devices
vl rk: RK03 disk
vl rf: RF11 disk
vl mem
}
}
}
}
hbox {
hl Process Control Subsystem
vl Scheduler
vl Swap manager
vl Memory manager
vl ...
}
}