November 28, 2012
Continuing from my previous post, another way to redirect output to a serial console is to use Google's sgabios option ROM, which mirrors BIOS output from the screen to a serial port. Just place this ROM alongside qemu's other roms (e.g. in /usr/share/qemu) and start qemu with -device sga.
Since this works for LILO, we can get into the LILO boot prompt on the serial console, and start Linux with linux console=ttyS0. Once Linux boots up we can modify lilo.conf and run lilo. This avoids some of the rigamarole of the previous method, although guestfish is still useful to edit lilo.conf, due to the lack of an editor in the test image.
However, there's no prebuilt sgabios package for Ubuntu 12.04, and qemu 1.0 doesn't come with sgabios included. So I built sgabios along with a .deb that drops it into qemu's ROMs directory.
I now present to you: