QEMU is a generic and open source machine emulator and virtualizer. Qemu is extremely convenient to test kernel code as the patched kernel can be run in a virtual machine and if it crashes it only takes the machine away. So I’m working on converting speakup code to use standard in-kernel serial drivers rather than poking into i/o ports. Before testing on actual hardware, the DoubleTalk LT I decided to use speakup_dummy driver which emits text over the serial console to test the changes. My host machine uses Ubuntu 15.04
Install Qemu the commandline way
Create virtual hard disk image for the guest machine
qemu-img create guest.img 40G
Download the ISO image of your favourite distribution and use that to boot the virtual machine
qemu-system-x86_64 -enable-kvm -hda guest.img -cdrom ubuntu-15.10-desktop-amd64.iso -m 4G
enable-kvm allows Qemu to use hardware virtualization capabilities without which everything is emulated on software and hence is slower. I’ve allocated 4GB RAM for the Guest OS.
After installation you can boot into the guest OS.
qemu-system-x86_64 -hda guest.img -m 4G -enable-kvm
Now for the testing part.
After setting up the development environment and compiling the kernel in the Guest OS:
modprobe speakup modprobe speakup_dummy
It doesn’t really matter which directory you are in as modprobe determines the version of module to load , it is the one for the currently running kernel. Check with lsmod whether the modules are loaded.
In order to test whether the serial console is working, simply type echo foobar > /dev/ttyS0 on the terminal and press Ctrl+Alt+3
The text output for the speakup_dummy module can then be seen on the serial console of Qemu.
To know more about the speakup project please visit this site