QEMU is a generic and open source machine emulator and virtualizer. Its homepage is http://fabrice.bellard.free.fr/qemu/.
Installing on Gentoo
The 0.9.0 version of QEMU does not yet compile cleanly under gcc-4. Usually you would be able to roll back and compile with an earlier version of gcc, but on gentoo, this didn’t seem to work with gcc-3.4.6-r2 or gcc-3.3.6-r1 (see http://forums.gentoo.org/viewtopic-p-4668881.html), so I decided to hunt around for a patch to make it work with gcc-4.
I ended up finding http://gwenole.beauchesne.info/projects/qemu/, which claims to have a patch for qemu-0.8.0 to compile under gcc-4, but if you look at the patch listed there, it clearly wants to apply against the 0.7.2 source code. Fixing this was simple enough, so I did that and made a few ebuilds to use this.
Once you have all of these files setup properly you should be able to get qemu-0.8.2 working on your system just by running:
TARGET_LIST="mips-user mips-softmmu" emerge -av =qemu-0.8.2
I packaged this all up and put them up here for others to use if they like. qemu-0.8.2-gentoo-ebuild-files-and-gcc4-patch.tgz contains the following:
- qemu-0.8.2-gcc4-hacks.patch – Updated version of gcc4 patch (original version available here)
- qemu-0.8.2-portage-overlay-setup.sh – a simple BASH script to help ‘install’ these ebuild files (must be ran as a user with permission to make files in your portage overlay directory, edit this file if your overlay resides somewhere other than /usr/local/portage.)
- qemu-softmmu-0.8.2-r2.ebuild – an ebuild file for qemu-softmmu with gcc4-hacks patch and allowing the user to set the TARGET_LIST at the command line (WARNING: this flag needs to be specified every time this package is emerge, or it will return to the default value)
- qemu-user-0.8.2-r1.ebuild – an ebuild file for qemu-user with a hack to remove the include of linux/compiler.h which isn’t available in 2.6.23 or seem to be needed, and a change to allow the TARGET_LIST variable to be set at the command line.