*'09 update* Step-by-step QEMU compilation Windows MinGW/Git

using QEMU howto's - how to install a guest OS under QEMU, etc - people are more then welcome to submit any documents they written and share them with the community

*'09 update* Step-by-step QEMU compilation Windows MinGW/Git

Postby class101 on Sun Nov 08, 2009 8:03 pm

Comike did a very nice tuto, in 2009 almost everything is still ok but it needs a few patches with the new repo wich moved to Git now git://git.sv.gnu.org/qemu.git, so based on Comike's last forum activity (2 years ago) it should be find to start a fresh thread based on its original one

So guys and girls here is how I made with all updated components, I add "New" to anything that changed since Comike tut:

  • MSYS-1.0.11.exe [ link ] new
  • msysDTK-1.0.1.exe [ link ]
  • MinGW-5.1.6.exe [ link ] new
  • SDL-1.2.14.tar.gz [ link ] new
  • zlib-1.2.3.tar.gz [ link ] new
  • directx-devel.tar.gz [ link ]
  • UnxUtils.zip [ link ] new (we will need dd.exe from it)
  • msysgit-1.6.5.1-preview20091022 [ link ] new (to checkout from Git rep on Windows)

1. Install MSYS-1.0.11.exe where you want (i.e: C:\Msys) When finished, you will see a system prompt asking if you wany to continue with post install. Type n so this isn't done.
2. Install msysDTK-1.0.1.exe in the same directory as MSYS-1.0.11.exe (i.e: C:\Msys)
3. Install MinGW-5.1.6.exe "Minimal" mode under "mingw" folder inside your MSYS folder (i.e: C:\Msys\mingw). The installer will probably warn you the directory already exists, press Yes to install it there anyway.
4. Now you must open MSYS. Go to the directory where you installed MSYS, and run msys.bat (i.e: C:\Msys\msys.bat)
5. Type pwd in the MSYS window. It will show your home folder (/home/username)
6. new With your preferred file manager copy:
Code: Select all
SDL-1.2.14.tar.gz
zlib-1.2.3.tar.gz
directx-devel.tar.gz
UnxUtils.zip

under your home directory in MSYS folder (i.e: C:\Msys\home\username)
7. We must extract the directx devel package to mingw folder, as it's needed by SDL:
Code: Select all
cd
tar -C /mingw -xzvf directx-devel.tar.gz

8. new We will begin by installing SDL. Type the following in MSYS:
Code: Select all
tar -xzvf SDL-1.2.14.tar.gz (this will extract SDL package)
cd SDL-1.2.14
./configure --prefix=/mingw
make
strip build/.libs/SDL.dll (this will reduce its size from 2Mb to 300Kb)
make install

9. Now you must go to home directory and extract zlib package:
Code: Select all
cd
tar -xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/mingw
make test
make install
cd

10. new Now you must extract UnxUtils.zip/usr/local/wbin/dd.exe to the MinGW bin folder (i.e: C:\Msys\mingw\bin), do it manually with your favorite zip extractor (XP,7-zip,Winzip, etc)

At this point we have a MinGW ready to compile the latest revisions (at 8 November 2009) from the Git repo

11. new We need the Git client, install Git-1.6.5.1-preview20091022.exe to a directory of your choice (i.e: C:\Git), leave all default values except the option "Run Git from the Windows Command Prompt" you have to tick (not required but useful)

12. new You should now be able to call "Git" inside the MinGW shell so type pwd to make sure you are in your home folder (/home/username)

13. new We will now download the very last version of Qemu:
Code: Select all
git clone git://git.sv.gnu.org/qemu.git


14. new We will define the final Qemu installation path and configure it:
to compile a x64bit compatible Qemu changes --target-list=i386-softmmu to --target-list=x86_64-softmmu
Code: Select all
cd qemu
./configure --target-list=i386-softmmu --static --prefix=X:/LiberKey/MyApps/Qemu-git-0.11.x

Update --prefix= to your need, in my case, I want to store and use Qemu to my usb key X: so that's how it looks like
you must get the folling output:
Code: Select all
Install prefix    X:/LiberKey/MyApps/Qemu-git-0.11.x
BIOS directory    X:/LiberKey/MyApps/Qemu-git-0.11.x
binary directory  X:/LiberKey/MyApps/Qemu-git-0.11.x
Source path       /home/Administrator/qemu
C compiler        gcc
Host C compiler   gcc
CFLAGS            -O2 -g
QEMU_CFLAGS       -Wold-style-definition -I. -I$(SRC_PATH) -U_FORTIFY_SOURCE -D_
GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredu
ndant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -f
no-strict-aliasing -m32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501
LDFLAGS           -Wl,--warn-common -g -m32
make              make
install           install
host CPU          i386
host big endian   no
target list       i386-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      yes
-Werror enabled   no
SDL support       yes
curses support    no
curl support      no
check support     no
mingw32 support   yes
Audio drivers     winwave
Extra audio cards ac97 es1370 sb16
Mixer emulation   no
VNC TLS support   no
VNC SASL support  no
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
NPTL support      no
GUEST_BASE        yes
PIE user targets  no
vde support       no
IO thread         no
Linux AIO support no
Install blobs     yes
KVM support       no
fdt support       no
preadv support    no
fdatasync         no
uuid support      no


15. new Now we compile the files with "make" and in the background this is where our imported dd.exe works around a compilation error inside the signrom.sh file
Code: Select all
make
strip i386-softmmu/qemu.exe
strip qemu-img.exe
strip qemu-io.exe


16. new Now we export all the necessary compiled files to our final installation path (in my case I put Qemu on usb key X:\LiberKey\MyApps\Qemu-git-0.11.x)
Code: Select all
make install


and now if I look inside X:\LiberKey\MyApps\Qemu-git-0.11.x I see:
Code: Select all
----------------------------------------------------------------------------------------
x:\LiberKey\MyApps\Qemu-git-0.11.x\ (20)                5 531 657 2009-11-08 19:40 -----
----------------------------------------------------------------------------------------
<keymaps>                                                   <DIR> 2009-11-08 19:40 -----
openbios-ppc                                              295 636 2009-11-08 17:57 -a---
openbios-sparc32                                          209 472 2009-11-08 17:57 -a---
openbios-sparc64                                        1 065 872 2009-11-08 17:57 -a---
bios.bin                                                  131 072 2009-11-08 17:57 -a---
multiboot.bin                                                 512 2009-11-08 17:57 -a---
ppc_rom.bin                                               524 288 2009-11-08 17:57 -a---
pxe-e1000.bin                                              72 192 2009-11-08 17:57 -a---
pxe-eepro100.bin                                           56 832 2009-11-08 17:57 -a---
pxe-ne2k_pci.bin                                           56 320 2009-11-08 17:57 -a---
pxe-pcnet.bin                                              56 832 2009-11-08 17:57 -a---
pxe-rtl8139.bin                                            56 320 2009-11-08 17:57 -a---
pxe-virtio.bin                                             56 320 2009-11-08 17:57 -a---
vgabios.bin                                                38 400 2009-11-08 17:57 -a---
vgabios-cirrus.bin                                         35 840 2009-11-08 17:57 -a---
bamboo.dtb                                                  3 179 2009-11-08 17:57 -a---
petalogix-s3adsp1800.dtb                                    8 259 2009-11-08 17:57 -a---
qemu.exe                                                2 238 464 2009-11-08 19:40 -a---
qemu-img.exe                                              263 680 2009-11-08 18:39 -a---
qemu-io.exe                                               274 944 2009-11-08 18:39 -a---
video.x                                                    12 192 2009-11-08 17:57 -a---
----------------------------------------------------------------------------------------
x:\LiberKey\MyApps\Qemu-git-0.11.x\keymaps\ (35)           75 031 2009-11-08 19:40 -----
----------------------------------------------------------------------------------------
ar                                                          2 337 2009-11-08 17:57 -a---
common                                                      2 234 2009-11-08 17:57 -a---
da                                                          2 696 2009-11-08 17:57 -a---
de                                                          2 581 2009-11-08 17:57 -a---
de-ch                                                       2 702 2009-11-08 17:57 -a---
en-gb                                                       2 700 2009-11-08 17:57 -a---
en-us                                                         644 2009-11-08 17:57 -a---
es                                                          2 341 2009-11-08 17:57 -a---
et                                                          1 200 2009-11-08 17:57 -a---
fi                                                          2 809 2009-11-08 17:57 -a---
fo                                                            982 2009-11-08 17:57 -a---
fr                                                          2 768 2009-11-08 17:57 -a---
fr-be                                                       2 869 2009-11-08 17:57 -a---
fr-ca                                                         984 2009-11-08 17:57 -a---
fr-ch                                                       2 585 2009-11-08 17:57 -a---
hr                                                          2 824 2009-11-08 17:57 -a---
hu                                                          1 981 2009-11-08 17:57 -a---
is                                                          3 203 2009-11-08 17:57 -a---
it                                                          2 577 2009-11-08 17:57 -a---
ja                                                          2 249 2009-11-08 17:57 -a---
lt                                                          1 153 2009-11-08 17:57 -a---
lv                                                          2 968 2009-11-08 17:57 -a---
mk                                                          2 467 2009-11-08 17:57 -a---
modifiers                                                     311 2009-11-08 17:57 -a---
nl                                                          1 164 2009-11-08 17:57 -a---
nl-be                                                          46 2009-11-08 17:57 -a---
no                                                          2 695 2009-11-08 17:57 -a---
pl                                                          2 794 2009-11-08 17:57 -a---
pt                                                          2 563 2009-11-08 17:57 -a---
pt-br                                                       1 423 2009-11-08 17:57 -a---
ru                                                          2 663 2009-11-08 17:57 -a---
sl                                                          2 403 2009-11-08 17:57 -a---
sv                                                          1 089 2009-11-08 17:57 -a---
th                                                          3 254 2009-11-08 17:57 -a---
tr                                                          2 772 2009-11-08 17:57 -a---


That's it you should now have a fresh 2009 version of Qemu, you could test you bootable usb key that way for example
Code: Select all
qemu.exe -m 512 -usb -hda \\.\PhysicalDrive2
Update PhysicalDriveX to your need, that's just a sample to show you how I do to test if my usb key is correctly bootable

To update the source directory you must be inside the /home/<username>/qemu folder with MinGW, cmd.exe or Git bash and type:
Code: Select all
git pull
This will download latests changes from the devs to your local folder you can then "make clean" to remove cached compiled files, and restart from step 14, that's how to upgrade Qemu properly through Git & Win

Hope do you like the fresh tut, took me a few hours today to find out how to build a fresh Qemu, Comike's method is
based on the cvs repo which is abandonned at 0.9.1 version, the latest Git commit is from 25 hours ago ;)

You can check latest changes on Gitweb at this address http://git.savannah.gnu.org/gitweb/?p=qemu.git

Definitely the best, smallest, portable virtualisation tool to me, keep it up the Team I love it :mrgreen:
How to checkout/compile with Git/MinGW the latest Qemu-0.11.x on Windows ^
Helping software developers since 2003 ^
class101
 
Posts: 0
Joined: Sun Nov 08, 2009 2:54 pm

Re: *'09 update* Step-by-step QEMU compilation Windows MinGW/Git

Postby darkon11 on Mon Dec 21, 2009 9:03 pm

Thanks mate.
I've waited for this for ages.
Just one thing , actually you can avoid the >100MB installation of GIT and download the latest source from:

http://mirror.lihnidos.org/GNU/savannah/qemu/

Regards
darkon11
 
Posts: 0
Joined: Fri Nov 07, 2008 9:00 pm

Re: *'09 update* Step-by-step QEMU compilation Windows MinGW/Git

Postby class101 on Thu Jan 07, 2010 12:50 pm

Yes but they are package of "Major" versions so you don't get the latest cutting edge software committed on Git, the last zip is from 2009 and the last commit on Git is from Thu, 7 Jan 2010

If you really want a zip from latest Git revision you have to go on the tree and click the link to download the snapshot for example this link always gives the latest revision

http://git.savannah.gnu.org/gitweb/?p=q ... EAD;sf=tgz

This is the "Snapshot" link up the page you could see here: http://git.savannah.gnu.org/gitweb/?p=qemu.git;a=tree

edit:btw happy new year 2010 darkon and all readers !
How to checkout/compile with Git/MinGW the latest Qemu-0.11.x on Windows ^
Helping software developers since 2003 ^
class101
 
Posts: 0
Joined: Sun Nov 08, 2009 2:54 pm

Re: *'09 update* Step-by-step QEMU compilation Windows MinGW/Git

Postby juozas on Fri Apr 23, 2010 4:44 pm

Well... Thanks built success and is working :) But I'd have one question: How to make sure the internet is working on this (and maybe other builds) becouse when i try to ping a server using command qemu linux-0.2.img it works but no net present.

Also there were some warnings on build whitch are listed below:
While Building SDL:
Code: Select all
*** Warning: linking the shared library build/libSDL.la against the non-libtool
*** objects  build/version.o is not portable!


While compiling qemu:
Code: Select all
In file included from sdl.c:25:
C:/msys/1.0/mingw/include/SDL/SDL_syswm.h:132:1: warning: "WIN32_LEAN_AND_MEAN" redefined
<command line>:2:1: warning: this is the location of the previous definition


After compilation make test fails with several ./test-i386.c errors, but install is ok and qemu is likely working :)

test with linux-0.2.img:
Image
Edit: it seemz it's ether qemu build issue coz same behavior is under Ubuntu linux :shock:...
juozas
 
Posts: 0
Joined: Thu May 07, 2009 3:57 pm


Return to HOWTOs

Who is online

Users browsing this forum: No registered users and 3 guests