The first day I met Ven. Ilgo (my Linux guru), the venerable thero showed me a magic trick (it was that surprising for me at the time) with his Linux-installed laptop by booting “Windows XP” within a window of his Debian Linux installation. Although we could see it in a window, “Windows XP” seemed to act as if it were the only OS running at that moment. He had even installed Firefox and a Python interpreter.
“First, I used this to make my machine useful to another monk who refused to work with Linux because he was a great fan of MS Word macros. But now I use QEMU to check how well my Python scripts work in Windows,” said Ven. Ilgo.
After a few minutes in “Windows,” we were shutting down WinXP. Guess what? Windows crashed!
“This is a joke! I can’t believe how people use this in their day-to-day life,” said Ven. Ilgo.
“Maybe it’s because of the emulation?” I replied.
“Oh no. It’s true that QEMU might be slower than a normal Windows installation, but not when KQEMU is installed with 1GB of RAM. At least it’s fast enough not to crash,” said the venerable thero. (KQEMU is a driver that allows the QEMU PC emulator to run much faster when emulating a PC.)
“What if we just close this window without shutting down Windows?” I asked.
“Then Windows will assume it’s a power loss and run ‘the famous disk scan!’”
That was enough for me that day, but it wasn’t enough for me later. So, I started using QEMU after getting a good tutorial from Ven. Ilgo. I always wanted to write a post about this but couldn’t do it earlier because of my lack of free time. Here it is now!
(Important: This is not a QEMU man page. This is just a simple intro to QEMU.)
(Disclaimer: I’M NOT GUILTY IF YOU GET BUSTED OR KICKED OUT OF “LKLUG” FOR USING ‘Windows’ WITH THIS EMULATOR.) 
First, we need to install QEMU:
apt-get install qemu
Once QEMU is installed, try typing qemu to check whether it’s up and running.
I assume you guys (or gals) are going to emulate Windows. Normally, Windows will need 2GB of disk space, so let’s create an image file that will act as an HDD during the emulation:
qemu-img create win.img 2048mb
Yes! You can change the name or file size as you like.
Next, create an ISO image of a CD containing Windows XP. You can do this by selecting the “Copy to Disk Image” option, which appears after right-clicking the CD icon. Name the file “winXP.iso.”
Now, to boot your emulated PC from the CD, type:
qemu -hda win.img -cdrom /path/to/winXP.iso -boot d
Make sure to replace /path/to/winXP.iso with the correct path to your ISO file.
A window resembling a normal BIOS will open. From there, proceed as you normally would during a Windows setup.
After installing, you’ll need to boot from the HDD. Type:
qemu -hda win.img -cdrom /path/to/ANY.iso -boot c
If you want to install software or drivers in Windows, simply create an ISO image containing the software and replace /path/to/ANY.iso with the correct path and name of the ISO image.
For further information, check the QEMU manual (man qemu). You can also use a SAMBA server to transfer files between Linux and Windows, though I’m not sure if it supports Windows XP.
Oh! For those of you wondering… Yes! you can use QEMU to emulate another Linux distro too. After all, why emulate just to be a fool?
C.J.
Digg this post!