QEMU is an emulator for various CPUs. It works on Linux, Windows, FreeBSD and Mac OS X. Windows version is in an alpha stage. I hope I can provide useful information on development and usage of the software.
Created binary package for Qemu 0.9.1 based on the work found in http://www.h7.dion.ne.jp/~qemu-win/
Windows binaries (includes preliminary USB support, FMOD
support and SDL 1.2.13):
Qemu-0.9.1-windows.zip or Qemu-0.9.1-windows-Lite.zip
QEMU
http://fabrice.bellard.free.fr/qemu/
SDL library
http://www.libsdl.org/
Cygwin
http://www.cygwin.com/
Main choice was to build everything from
cygwin by using the mingw versions of gcc.
You need the following packages (available from the cygwin setup program):
gcc-mingw-core gcc-mingw-core-20050522-1.tar.bz2
gcc-mingw-g++ gcc-mingw-g++-20050522-1.tar.bz2
mingw-runtime mingw-runtime-3.14-1.tar.bz2
mingw-zlib mingw-zlib-1.2.3-2.tar.bz2
w32api w32api-3.11-1.tar.bz2
SDL : based on http://www.libsdl.org/extras/win32/cygwin/README.txt
- Fetch the source code (SDL-1.2.13.tar.gz was used) and untar.
- Fetch the DirectX development headers and libraries (new version rebuild with gcc –mno-cygwin and –O4 –march=i686 available here: mingw-directx-5.0-EL.tar.bz2) : http://www.libsdl.org/extras/win32/cygwin/directx-devel.tar.gz
- Fetch nasm (http://www.libsdl.org/extras/win32/cygwin/nasm.exe or here: nasm.exe), put it in your path.
- Fetch libunicows.a: http://libunicows.sourceforge.net/ (installable version build with gcc –mno-cygwin and –O4 –march=i686 available here: mingw-libunicows-1.1.1-EL.tar.bz2)
- Insert patch for Qemu (available here: http://www.h7.dion.ne.jp/~qemu-win/download/sdl-1.2.11-keyboard.zip or here: sdl-1.2.11-keyboard.zip):
patch -b -z.orig -p1 -i ../sdl-1.2.11-keyboard/sdl-1.2.11-keyboard.patch
- Compile SDL and install:
CPPFLAGS="-I/usr/include/mingw
-I../../src/video/windx5" CFLAGS="-O4 -march=i686
-fomit-frame-pointer -funroll-loops -DFORCE_32BPP -DDO_NOT_HANDLE_IM
-DJP106_KLUDGE -I/include/w32api" CC="gcc -mno-cygwin"
CXXFLAGS="-O4 -march=i686 -fomit-frame-pointer -funroll-loops -DFORCE_32BPP
-DDO_NOT_HANDLE_IM -DJP106_KLUDGE -I/include/w32api" CXX="g++
-mno-cygwin" ./configure --disable-dependency-tracking
LDFLAGS="-mno-cygwin"
make
make install
- A complete package (reworked with mingw compatibility in mind) is available here: mingw-SDL-1.2.13-EL.tar.bz2)
Qemu:
- Fetch the source code: http://fabrice.bellard.free.fr/qemu/qemu-0.9.1.tar.gz
- Optionally fetch the fmod library: http://www.fmod.org/index.php/release/version/fmodapi375win.zip (or here: fmodapi375win.zip)
- Fetch and install the patches: qemu-0.9.1-patch.zip. This patch is based on the original patches found here: http://www.h7.dion.ne.jp/~qemu-win/download/qemu-0.9.0-patches.zip plus my additional work.
- Fetch LibUsb-Win32, currently http://downloads.sourceforge.net/libusb-win32/libusb-win32-device-bin-0.1.12.1.tar.gz, or here: libusb-win32-device-bin-0.1.12.1.tar.gz and untar.
- Untar Qemu, apply the patch (patch –p1 –i ../qemu-0.9.1-patch) and configure:
CFLAGS="-O4 -march=i686" LIBUSB_CFLAGS="-I/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/include" LDFLAGS="-L/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/lib/gcc" ./configure --target-list="i386-softmmu" --enable-dsound --enable-fmod --fmod-lib=/home/lassauge/MyDocuments/Qemu/fmodapi375win/api/lib/libfmod.a --fmod-inc=/home/lassauge/MyDocuments/Qemu/fmodapi375win/api/inc --prefix="/home/lassauge/MyDocuments/Qemu-0.9.1-windows" --extra-cflags="-I/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/include" --extra-ldflags="-L/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/lib/gcc"
- Special tweak: I had to manually modify the config-host.mak file for CFLAGS. You should have something like that (check HOST_USB and CONFIG_FMOD):
# Automatically generated by configure - do not modify
# Configured with: ./configure --target-list=i386-softmmu --enable-dsound --enable-fmod --fmod-lib=/home/lassauge/MyDocuments/Qemu/fmodapi375win/api/lib/libfmod.a --fmod-inc=/home/lassauge/MyDocuments/Qemu/fmodapi375win/api/inc --prefix=/home/lassauge/MyDocuments/Qemu-0.9.1-windows --extra-cflags=-I/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/include --extra-ldflags=-L/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/lib/gcc
prefix=/home/lassauge/MyDocuments/Qemu-0.9.1-windows
bindir=${prefix}
mandir=${prefix}
datadir=${prefix}
docdir=${prefix}
MAKE=make
INSTALL=install
CC=gcc
HOST_CC=gcc
AR=ar
STRIP=strip -s -R .comment -R .note
OS_CFLAGS=-mno-cygwin
OS_LDFLAGS=-mno-cygwin
VL_OS_LDFLAGS=-mno-cygwin
ARCH_CFLAGS=
ARCH_LDFLAGS=
CFLAGS= -O4 –march=i686 -I/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/include
-Wall -O2 -g -fno-strict-aliasing
LDFLAGS=-L/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.1/lib/gcc -g
EXESUF=.exe
AIOLIBS=
ARCH=i386
CONFIG_WIN32=yes
CONFIG_GDBSTUB=yes
CONFIG_SLIRP=yes
CONFIG_DSOUND=yes
CONFIG_FMOD=yes
CONFIG_FMOD_LIB=/home/lassauge/MyDocuments/Qemu/fmodapi375win/api/lib/libfmod.a
CONFIG_FMOD_INC=/home/lassauge/MyDocuments/Qemu/fmodapi375win/api/inc
VERSION=0.9.1
SRC_PATH=/home/lassauge/MyDocuments/Qemu/qemu-0.9.1
TARGET_DIRS=i386-softmmu
CONFIG_SDL=yes
SDL_LIBS=-L/usr/lib/mingw -lmingw32 -lSDLmain -lSDL -mno-cygwin -mwindows
SDL_CFLAGS=-I/usr/include/mingw/SDL -I/usr/include/mingw -mno-cygwin -Dmain=SDL_main
TOOLS=qemu-img$(EXESUF)
HOST_USB=libusb
LIBUSB_LIBS=-lusb
- One important erroneous compilation warning: printf formats for int64 objects from mingw include file are not recognized by the compiler (bug?) but it works as expected. You can verify with the following file compiled on cygwin with and without -mno-cygwin:
#include <stdio.h>
#include <basetsd.h>/* required typedef __int64 for gcc */
typedef char TCHAR;
#define TEXT(x) x
unsigned __int64 atou64(const TCHAR *s) ;
int main()
{
unsigned __int64 value;
TCHAR *test = "1234567890123456789";
printf("in main(): test = <%s>\n", test);
printf("sizeof(__int64) = %d\n", sizeof(__int64));
value = atou64(test);
printf("value using I64d: %I64d\n", value); /* for Borland BCC or Microsoft VC++ */
printf("value using Ld: %Ld\n", value); /* for Borland BCC */
printf("value using lld: %lld\n", value); /* for gcc */
printf("value using I64x: %016I64x(hex)\n", value);/* for Borland BCC or Microsoft VC++ */
printf("value using Lx: %016Lx(hex)\n", value);/* for Borland BCC */
printf("value using llx: %016llx(hex)\n", value); /* for gcc */
return 0;
}
unsigned __int64 atou64(const TCHAR *s)
{
const unsigned __int64 max64 = (unsigned __int64)0-1;
unsigned __int64 v = 0;
int digit;
while (*s>=TEXT('0') && *s<=TEXT('9'))
{
digit = *s++ - TEXT('0');
if (v > (max64-digit)/10)
return 0; /* overflow */
v = 10*v + digit;
}
return v;
}
- Make (BTW arm-softmmu does not build, and option –march=i686 has to be removed for each compilation of helper.c or op_helper.c)
- Install: don’t forget to add fmod.dll, SDL.dll, mgwz.dll and libusb0.dll
-
Bugs:
Pathnames in the options when starting Qemu are not recognized completely: each
‘\’ has to be prefixed by ‘\’.
Wheel mouse buttons are not recognized when SDL_VIDEODRIVER=directx
This program is provided as is and without any warranty.