<< JavaScript To Gain Pythonic Features | Home | Hit F7 If You Are In Firefox >>

QEMU: The Open Source Processor Emulator

Run Windows apps in any operating system.

I've been playing with QEMU for 47 days now. QEMU is an processor and system emulator written by Fabrice Bellard and released under the GPL(for binaries)/LGPL(for shared objects) licenses. I installed QEMU 0.8.0 on my AMD64/Fedora Core 4 Linux machine and created several guest images and installed different OSes on them, including several flavors of Linux and Windows.

By far the most challenging and the most fun OS to install and work with is MS Windows 3.1:

QEMU emulates a whole PC system with a Pentium II processor, PCI bus, a CirrusLogic graphics card, SoundBlaster 16 sound card, floppy drive, IDE hard drive, CD-ROM, and an Ethernet card. QEMU also provide the emulated system with a DHCP server and a SMB server.

The QEMU download for Linux is only 2.6MB in size, not as overwhelming as VMWare Server's 207MB total download. The QEMU documentation is extremely clear and helpful. The QEMU Users Forum is also a good source of information. (The MacOSX group is very active.)

To get started with the Windows 3.1 installation, all I have to do is:

[weiqi@gao] $ qemu-img create ms-windows.img 500M
[weiqi@gao] $ qemu -fda /dev/fd0 -boot a ms-windows.img

QEMU will create the hard drive image, and start booting from the floppy drive. From that point on, everything proceeds exactly as if I'm building a new machine, with one exception—QEMU can't detect floppy disk or CD-ROM disk changes. In addition to the physical act, I have to switch to the QEMU console (Ctrl-Alt-2) and issue commands to tell QEMU that the floppy disk has been changed:

QEMU 0.8.0 monitor - type 'help' for more information
(qemu) eject fda
(qemu) change fda /dev/fd0

My choice of MS Windows 3.1 as the guest OS is part pragmatism and part nostalgic. Pragmatic because it's small—MS-DOS 6.22 comes in three floppies, and MS Windows 3.1 in six. Nostalgic because I spent considerable amount of time there and I haven't seen it for a long time.

I'll spare you with the boring details of setting up a Windows 3.1 box except for noting how primitive it was and how compact it was. Both CD-ROM support and TCP/IP networking are add-ons to the OS. But it runs fine on 8MB of memory. Thanks to the internet, I'm able to find all the hardware drivers and a few applications.

I leave you with my CONFIG.SYS and AUTOEXEC.BAT:

C:\>type config.sys
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE NOEMS I=B000-B7FF WIN=B500-B7FF WIN=B200-B4FF
BUFFERS=10,0
FILES=50
DOS=UMB
LASTDRIVE=E
FCBS=16,8
DEVICEHIGH /L:2,12048 =C:\DOS\SETVER.EXE
DOS=HIGH
DEVICEHIGH /L:2,9872 =C:\SB16\DRV\CSP.SYS /UNIT=0 /BLASTER=A:220
STACKS=9,256
DEVICEHIGH /L:2,22896 =C:\CDPRO\VIDE-CDD.SYS /D:MSCD001 /P:1F0,14 /P:170,15 /P:1
E8,12 /P:168,10
SHELL=C:\DOS\COMMAND.COM C:\DOS\  /p
C:\>type autoexec.bat
@ECHO OFF
SET SOUND=C:\SB16
SET BLASTER=A220 I5 D1 H5 P330 T6
SET MIDI=SYNTH:1 MAP:E
C:\SB16\DIAGNOSE /S
C:\SB16\MIXERSET /P /Q
C:\WINDOWS\VGAUTIL\winmode.exe t640=75 t800=60 t1024=60 t1152=70 t1280=87 t1600=
0
LH /L:0;2,45456 /S C:\DOS\SMARTDRV.EXE
LH /L:2,13984 C:\DOS\SHARE.EXE /L:500
C:\DOSIDLE\DOSIDLE.EXE
LH /L:2,27952 C:\DOS\MSCDEX.EXE /D:MSCD001
LH /L:2,6384 C:\DOS\DOSKEY.COM
LH /L:2,9216 C:\CRYNWR\NE2000.COM 0x60 11 0xC100
LH /L:2,4144 C:\CRYNWR\WINPKT.COM 0x60
PROMPT $p$g
PATH C:\DOS;C:\GUPTA;C:\WINDOWS;c:\trumpet;C:\UTILS;C:\WIN31DDK\386\TOOLS;C:\WIN
31DDK\286\TOOLS
SET TEMP=C:\DOS
WIN

Oh, and finally, for the other six people on earth who also are trying to run Windows 3.1 in either QEMU or VMWare, I have solved the CPU usage reduction problem by writing my own VxD. This is a 32-bit virtual device driver that hooks the Windows primary scheduler's idle event and issues the privileged (ring 0) HLT instruction. It's similar to AMNHLT and DOSIDLE. I'm calling it WQGHLT and am making it available here.

This blog entry is composed in part in Netscape 4.08 for Windows 3.1 over Trumpet WinSock 3.0.

Tags :


Re: QEMU: The Open Source Processor Emulator

I assume you have to have a physical floppy drive to install dos and windows? I haven't had a floppy on my last 4 computers.

Re: QEMU: The Open Source Processor Emulator

I almost did not buy a floppy drive for my last computer. I bought it only because it costed only $12.

On the other hand, you can boot from the CD-ROM by using to "-boot d" option.

QEMU also recognize CD-ROM images (.iso files) and floppy disk images (dd if=/dev/fd0 of=ms-dos-disk1.img)and treat them accordingly (qemu -fda ms-dos-disk1.img ...)

Re: QEMU: The Open Source Processor Emulator

*Raises hand* 7 people! How did you get that screen resolution? When I try to change it, I crash qemu. Also, how exactly did you get networking working in qemu? Thanks for the CPU reduction tool!

Re: QEMU: The Open Source Processor Emulator

I'm using the CirrusLogic 5446 driver that I downloaded from driverguide.com.

For networking, I'm using Trumpet Winsock 3.0 on top of the Crynwr NE2000.COM packet driver.

Re: QEMU: The Open Source Processor Emulator

I tried installing Cirrus Logic driver but after i change resolution and color depth i got missing text and boxes and it hangs! It will back to normal if i change to normal VGA driver...

Re: QEMU: The Open Source Processor Emulator

I'm using this driver. And I'm using the maximal resolution at the maximal color depth. It's not perfect but it's usable as long.

Re: QEMU: The Open Source Processor Emulator

Ok, make it 8. I just installed MS-DOS 6.22 and Win 3.11 without problems using Qemu0.8.0 on WindowsXP Pro. I tried to install the sb16 sound drivers from some disks I still have but that didn't work. Well installation itself did work but the drivers throw errors. And Win 3.11 complains as well. Did any of you have success with this?

Re: QEMU: The Open Source Processor Emulator

I used this sound driver and it worked fine.

Re: QEMU: The Open Source Processor Emulator

The driver you pointed out did the job. Funny thing that the original disks don't work. But who cares, no it's working. Using an old win98 boot disk and copying the sys-files the cdrom is working now as well. Thanks!

Re: QEMU: The Open Source Processor Emulator

Thanks a lot! I found your page very useful. I'm gonna trying your WQGHLT VxD... If it works, tomorrow i'll be playing winmine :-)

Re: QEMU: The Open Source Processor Emulator

You guys are not the only ones, I just got 3.11 up and running on my MacBook Pro using Q, the OS X port of qemu!
More details on how you got the CD-ROM and TCP/IP going would be awsome

Re: QEMU: The Open Source Processor Emulator

I found the CD-ROM driver on DriverGuide.com.  It's an Oak Technologies VIDE CD-ROM driver.  For TCP/IP, I used the Crynwr packet drivers and Trumpet WinSock.

Re: QEMU: The Open Source Processor Emulator

Weiqi, three things I need to ask you:

1. How in the heck did you get the internet connection (Trumpet Winsock 3.0 and Crynwr NE2000.com) to work in Windows 3.1? I tried it with Internet Explorer 5, and no such luck at all, plus Windows 3.1 as a guest OS wouldn't even boot at all in 386 Enhanced Mode. In the Network settings in Windows Setup, I tried to select Microsoft Network and no such luck. :(

2. How did you get the display of the Windows 3.1 guest OS to display a resolution higher than 800 x 600 @ 16 colours. I tried to do that, but I wound up with a corrupt display. I mean, Windows 3.1 will load properly, but it won't display well.

3. I tried to get MS-DOS to recognise the Oak Technologies VIDE CD-ROM driver to work. I used two different drivers and one of them caused the guest computer to hang and the other one ending up with the message:

"No drives found, aborting installation" and the error message "No valid CDROM device drivers selected".

How did you have sucess with all of this? I'm still new to QEMU and I was hoping that step-by-step process of how all of this was done.

Thank you for your time.

Re: QEMU: The Open Source Processor Emulator

<p>It's been over a year since I built my Windows 3.1 QEMU image.  At the time, I meant to write something down but I didn't have the time.  And now things has become fuzzy.  For the network configuration, I remember getting a critical clue from the OS/2 section of the QEMU forum FAQ.  The documentation for Crynwr and Trumpet are also very detailed and helpful.  For CD-ROM and Video and Sound, it's a matter of finding the right driver.  I got a couple of drivers from DriverGuide.com.</p>

<p>Take a look at my CONFIG.SYS and AUTOEXEC.BAT.  They contain configuration settings for the CD-ROM, Sound and packet drivers.</p>

Re: QEMU: The Open Source Processor Emulator

After installing Internet Explorer 5.01 and Netscape Navigator 4.08, Windows 3.1 did work, however I couldn't get on the internet at all. I mean, all the options were for setting up a internet connection were just a list of dial-up modems. I even looked into the OS/2 Warp 4.x How to section for clues on how to get Windows 3.1 to detect the Trumpet Winsock 3 on top of the Crynwr NE2000.COM drivers as well as putting the following lines into the autoexec.bat file:

LH /L:2,9216 C:\CRYNWR\NE2000.COM 0x60 11 0xC100
LH /L:2,4144 C:\CRYNWR\WINPKT.COM 0x60

As a result, still no internet connection under Windows 3.1. What would I need to do in order to get the internet connection to work under Windows 3.1?

I have screenshot of both of the problems that you might want to look into. Here's the first one:

Unable to connect to the internet: <font color="#c000c0">http://qemu-forum.ipi.fi/download.php?id=293</font>

 

Secondly, I downloaded the Cirrus Logic 5446 drivers from the DriverGuide.com site and it was supposed to work for Windows 3.1, but when I tried to install the Cirrus Logic 5446 drivers under Windows 3.1, I wound up with a video display corruption:

http://qemu-forum.ipi.fi/download.php?id=294

Would I have to use a dummy VGA driver with Bochs extentions in order to get a display of 1024 x 768 @ 256 colours or better? Just curious.

Any help, perhaps a possible tutorial would be appreciated. ^^

Re: QEMU: The Open Source Processor Emulator

To get IE 3.01 going under Win 3.1 I was inspired by all the above. Call the packet drivers (NE2000/WINPKT) and set up TCPMAN according to Qemu defaults for TCPIP and hook up the packetdriver. Additional suggestions from Trumpet Winsock help can be followed. Restart TCPMAN, start IE and there you go !

Re: QEMU: The Open Source Processor Emulator

Anyone who is getting a white screen or graphic corruption while trying to use the drivers: Keep the monitor setting to NANAO (or whatever it is) and Other Model. You can reach it by running Windows' setup.exe and resetting to the VGA driver. Then you can get back into Windows to change the monitor setting in WinMode.

Re: QEMU: The Open Source Processor Emulator

I've tried all solutions for the CL-5446 driver issues and continue to get display corruption with crashing. I've set up a clean install focusing on just the video (no NET or any other stuff) and get the same problem with several drivers I've found on the net. All attempts have the same corruption/crashing issue. Everything else works great though. And thanks for the HLT instruction driver. I'm using net drivers from this page, and I've tried (among others) the CL-5446 drivers found here too: Drivers for QEMU devices

Re: QEMU: The Open Source Processor Emulator

i get video corruptions at high resolutions as well, but only if i use kqemu; w/o kqemu the cirrus driver works fine

Re: QEMU: The Open Source Processor Emulator

Thank you for the CPU idler VXD!!! I've been searching all over the net for a way to idle the CPU in WFWG 3.11. I use CPUIDLE, but it doesn't do anything in windows. I've searched for days, and given up. I stumbled on this completely by accident, searching for something else unrelated. Maybe you should create a new blog entry dedicated just to your VXD, with lots of keywords about it (and nothing else)--so the search engines will index it better, so others can find it too! Thanks again!

Re: QEMU: The Open Source Processor Emulator

Thanks for the HLT instruction driver, it works great. CL-5446: Major pita. All the drivers probably work fine. I had downgrade to 0.8.0-1.1 on an i386 FC4 install (used FC3 QEMU rpm) just to get a working image. Back up once you get here. Then I had to get an AMD_64 0.8.0-1.1 rpm and extract the qemu binary and create a symlink which I use just for running WFW. I couldn't create a working cirrus setup directly using the 0.8.0-1.1 binary on my AMD_64 machine, but once I had obtained a good image, using the AMD_64 0.8.0-1.1 binary continued to work. NET: I just used the RTL8029 drivers and TCPIP protocol. The issue here was more about getting a bridge+tap set up properly. I used a preexisting tap0 I created in /etc/network/interfaces with the options: "-net nic,vlan=0 -net tap,vlan=0,ifname=tap0" I also commented out the sudo line in /etc/qemu-ifup. No sudo needed. See: http://www.virtualbox.org/discussion/1/141 for how I created the bridge and tap. WIN32S: This should work after commenting out NET START in AUTOEXEC.BAT. I don't know about SHARE.EXE in the sample BAT file above though.

WQGHLT and DOSIDLE running under WFW 3.11

I am running WFW 3.11 with DOSBOX. I am using DOSIDLE and your IDLE-Handler with WFW3.11. And it works really perfectly. Even the "MSDOS-Prompt"-VMs under WFW3.11 reduces their CPU-Usage to Zero. If you installing DOSIDLE before Windows3.11 it is necessary to add "DOSIDLE" to the "localtsrs"-Line of the System.ini. an example [NonWindowsApp] localtsrs=dosedit,ced,dosidle Otherwise you have to run DOSIDLE separately in every MS-Prompt-VM of Windows3.11 and DOSIDLE must not be installed before WIN3.11 is loaded! Thanks a lot for your Handler! At last, Sorry for my bad English. Yours, Luigi

WQGHLT and DOSIDLE running under WFW 3.11

Thanks for the success report and the tip for getting DOSIDLE to function in MSDOS-Prompt VMs.

WQGHLT and DOSIDLE running under WFW 3.11

I found a driver that sort of works without video corruption. It's on the www.hp.com for the Vectra VL6. http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&prodTypeId=12454&prodSeriesId=32845&prodNameId=17361&swEnvOID=18&swLang=13&mode=2&taskId=135&swItem=vc2438en Extract it to floppy or open with 7zip and save the files somewhere to use with Qemu. I had to remove cirext.dll as it caused graphical corruption. The downside is that I can choose any video mode but can't exceed 256 colors without video corruption.

Re: QEMU: The Open Source Processor Emulator

Use this string to start Dos 6.X and Windows 3.11 emulation with QEMU.

qemu -m 64 -smb /home/share -soundhw sb16 -hda windows_3_11_workgroup.img -net nic,model=ne2k_pci -net user -boot c

[MAKE LIFE EASIER]

This will make it a lot easier to transfer files between guest and host O.S.

qemu-img create -f qcow2 1gig_drive.qcow2 1G
qemu-img convert 1gig_drive.qcow2 -O raw 1gig_drive.raw

Get Gparted iso from here.
http://sourceforge.net/project/showfiles.php?group_id=115843

Use Gparted to create fat 16 file system.

qemu -kernel-kqemu -hda 1gig_drive.raw -cdrom gparted-live-0.4.1-2.iso -boot d

Mount and copy files to it from your host O.S.

mount -o loop,offset=32256 1gig_drive.raw mnt2/

Start Qemu like this to access the image as drive d: from dos or Windows.

qemu -m 64 -smb /home/share -soundhw sb16 -hda windows_3_11_workgroup.img -net nic,model=ne2k_pci -net user -hdb 1gig_drive.raw -boot c

VERY IMPORTANT DO NOT USE QEMU GUEST OF WHILE THE IMAGE IS MOUNTED.

[HOW TO FIND WINDOWS 3.11?]
Go to google.com and search for this string "Windows_3.11.iso".

[TO GET NETWORK WORKING]
http://www.claunia.com/qemu/drivers/index.html
Use this link for the network drivers for "Realtek 8029AS".

[TO GET AUDIO TO WORK]
http://www.claunia.com/qemu/drivers/index.html
Use this link for the audio drivers for "Sound Blaster 16 adapter".

or

http://www.scampers.org/steve/vmware/#wfw311drv
This person has bundled some drivers in one large zip for Windows 3.11 in this file.
http://www.scampers.org/steve/vmware/wfw311_drivers.zip

[TO DOWNLOAD BROWSER]
Netscape
http://sillydog.org/narchive/
or
ftp://ftp.netscape.com/pub/communicator/english/4.08/windows/windows3.1/complete_install/cc16d408.exe

More browsers can be found here.
http://oldfiles.org.uk/lightspeed/main.html#Browsers

[TO GET CDROM TO WORK]
Use these instruction from here http://vmware0.tripod.com/

"Copy the AOATAPI.SYS file to a floppy disk. Start your virtual machine. Insert the disk, and then type

COPY A:\AOATAPI.SYS C:

Then you must edit your AUTOEXEC.BAT and CONFIG.SYS files.
At the C:\ command prompt type EDIT AUTOEXEC.BAT. Place the line c:\dos\mscdex.exe /d:idecd000
in the autoexec.bat and save, then exit.
At the C:\ prompt type EDIT CONFIG.SYS. Place the line device=c:\aoatapi.sys /d:idecd000 in the config.sys and then save, then exit.
Restart the machine and go into windows. Open the file manager and now you will see Drive D for the CD ROM."

http://vmware0.tripod.com/Windows%203.11%20VMware.zip
or below link has the file in the following sub directory "CD ROM"
http://www.scampers.org/steve/vmware/wfw311_drivers.zip

[VIDEO FOR WINDOWS]

http://vmware0.tripod.com/MSVIDEO.zip

[DOS IDLE]

http://vmware0.tripod.com/Windows%203.11%20VMware.zip
or below link has the files in the following sub directory "dosidle"
http://www.scampers.org/steve/vmware/wfw311_drivers.zip

[BEST COLLECTION OF RESOURCES FOR WINDOWS 3.1x]

http://oldfiles.org.uk/powerload/win3x.htm
http://oldfiles.org.uk/lightspeed/main.html

EXAMLEY2K: FIX, EURO Symbol Update, TCP/IP-32 Version 3.11b protocol drivers etc.

[This is my testing environment.]
Windows 3.11 on Dos 6.X
Debian Lenny 5.0
QEMU version 0.9.1-8
Kernel 2.6.27.8 x86_64 GNU/Linux

[PROBLEMS]

- I could not get it to work will KQEMU of KVM. The accelarator and kernel visualization freezes Windows 3.11.
- The best I can get the video resolution and color is SVGA 800 X 600 with 16 colors.

I tried all the drivers anyone suggested and or packaged and not of them work. I would like to know how Weiqi go it to work with that driver from driverguige website. It did not work for me. I would really like to solve this.

- Sound Blaster cause this errors like this "sb16: warning: command 0xe,2 is not truly understood yet". They don't affect any audio Windows 3.11 uses. This is not a show stopper.

Thanks, all for the information you have provided.

Lindylex

Re: QEMU: The Open Source Processor Emulator

Weiqi Gao, my post got butchered. It has some good stuff in it.

How did you get the video driver to work? I tried the same driver you suggested and many others but they all corrupt the video display.

This is my enviornment.
Debian Lenny, QEMU .0.9.1-8

Re: QEMU: The Open Source Processor Emulator

Thanks for the info. I went into the backing store and hand edited the XML. It looks OK now.

As for the SVGA driver, I did not write down the exact URL where I downloaded it. And I haven't been playing with the Windows 3.1 image lately. All I can offer now is that in my download/qemu/things-that-worked directory there is a file named cirrus5446.zip.

I downloaded several drivers and most of them didn't work.

Re: QEMU: The Open Source Processor Emulator

Could you put your 5446.zip somewhere to download?

Re: QEMU: The Open Source Processor Emulator

I cannot put it up permanently. I'll try to find it in my backup CDs. Reply to this comment with a working email address, and I'll email it to you if I find it.

Re: QEMU: The Open Source Processor Emulator

There is a recently posted guide to setting up WFW under Qemu 0.9.1 and 0.11.1 here: http://qemu-forum.ipi.fi/viewtopic.php?f=5&t=5507 You can have 1024 x 768 screen resolution with 16.8 million colors using 0.9.1

Add a comment Send a TrackBack