QEMU - Emulate Windows or Linux
Author: jason
Date: 2005-12-23
Category: Technical

Here are three options a person can use to create a virtual machine: Virtual PC, VMWare Workstation, QEMU.

The first two are true virtualization products. QEMU is an emulator, and a little bit more intensive on the host machine.

Virtual PC and VMWare both require you to install their product as an Administrator. QEMU does not.

Virtual PC 2004 - $129
http://www.microsoft.com/windows/virtualpc

VMWare Workstation 5 - $189
http://www.vmware.com

QEMU - Free
http://fabrice.bellard.free.fr/qemu

*Update*
Now the virtualization wars are in full swing... Microsoft and VMWare are giving away software left and right. But Qemu is still a decent choice to run another OS without having to actually install software/drivers.

If you want to run Windows or Linux from within Windows you will need the w32 executable files/bios. A mirror off the QEMU homepage has the zipped w32 files, currently: qemu-0.7.1-3.zip at http://qemu.dad-answers.com/download/win32. Or you can try Free OSZoo for the pre-compiled "installer" version of QEMU at http://free.oszoo.org/download.html. I would recommend the zipped version.

Extract the zipped files into a folder. You should have:
bios.bin
License
linux.img
linux_boot.bin
qemu-img.exe
qemu-system-x86_64.exe
qemu-doc.html
qemu-tech.html
qemu-win.bat
qemu-x86_64.bat
qemu.exe
README-en.txt
README-ja.txt
SDL.dll
vgabios-cirrus.bin
vgabios.bin

Drop into the command prompt to create the disk image which will hold your operating system.
Code

C:\qemu\qemu-img create -f raw Windows2K3.img 4G


Qemu-img.exe is the program for creating images. -f is the format we want the disk to be in, which is raw. The next part is the file name, Windows2K3.img. Finally we specify the size 4 Gigs. We could also use M for Megabytes.

After a few minutes you should have a 4Gig flat file which will hold our Windows 2003 operating system. To install Windows we need to have an ISO of the install disk. Creating an ISO is outside the scope of this article. Put the ISo in the same directory as the IMG file which should also have the qemu files.

Issue the following command to start up qemu to boot off the ISO to install windows
Code

qemu.exe -L . -m 128 -hda Windows2K3.img -cdrom Windows2K3.iso -boot d


The "-L ." indicates x86 dynamic linker must search the same directory its in. The "-m 128" specifies how much memory to allocate. The "-hda" sets the img file we are going to use. The "-cdrom" tells qemu to use the iso as a CDRom. The "-boot" sets the boots device as the D drive, which is our ISO file.

To keep from having to type that command everything you can create a batch file.
Code

REM Start qemu on windows.
@ECHO OFF

cd qemu

START qemu.exe -L . -m 128 -hda -hda Windows2K3.img -cdrom Windows2K3.iso -boot d -enable-audio -localtime

CLS
EXIT


Refer to the qemu-doc.html file for other switches you can use. Feel free to remove the -boot d, when Windows is done installing.

Provided everything is set correctly a new windows should have opened showing the BIOS information. Then the Windows 2003 installation should have started. You are now running in an emulated environment. Install Windows 2003 as you normally would.



jason @ jasonthomasfrance.com - www.masterstationlog.com - copyright 2009