Difference between revisions of "QEMU"

From ReactOS Wiki
Jump to: navigation, search
(added suggestions by Carlo Bramix and GreatLord to debug with com0com and QEmu. My formatting added.)
(Add navigation template)
(37 intermediate revisions by 13 users not shown)
Line 1: Line 1:
Qemu is a free x86 Emulator/Virtual Machine for Linux and Windows.
+
[http://www.qemu.org/ QEMU] is a free x86 emulator for Linux and Windows. A preloaded QEMU image of ReactOS can be found [http://www.reactos.org/download here].
If you are looking for something faster, you can try the Qemu Accelerator Module (documentation [http://www.qemu.org/kqemu-doc.html here]) or [[VMware]].
 
  
== Grabbing debug messages ==
+
If you are looking for a faster virtual machine, give [[VirtualBox]] or [[VMware]] a try.
 +
 
 +
== Installing ReactOS on QEMU ==
 +
 
 +
* Create a drive image, on which ReactOS will be installed, by typing:
 +
 
 +
qemu-img create ReactOS.img 1000M
 +
 
 +
''1000M'' stands for 1000 megabytes- that shall be enough. It shall be greater, if you plan to install some application to try under ReactOS.
 +
 
 +
* In *nix only, type:
 +
 
 +
sudo umount /dev/shm
 +
sudo mount -t tmpfs -o size=144m none /dev/shm
 +
 
 +
* Type:
 +
 
 +
qemu -L . -m 256 -cdrom ReactOS.iso -hda ReactOS.img -boot d -localtime -serial file:ReactOS.log
 +
 
 +
''-m 256'' stand for 256 MB RAM
 +
''-boot d'' instructs QEMU to boot from the CD-ROM. Without ''-boot d'' it will boot from the hard drive (Reactos.img).
 +
 
 +
''ReactOS.iso'' is the image of the '''installation''' CD, which can be downloaded from http://www.reactos.org/en/download.html
 +
 
 +
When reinstalling ReactOS, perform steps 2 (if necessary) and 3 only.
 +
 
 +
If you want to copy some files to ReactOS, you could create an CD-ROM image and mount it on QEMU.
 +
You can run QEMU this way:
 +
 
 +
qemu -L . -m 256 -cdrom Applications.iso -hda ReactOS.img -localtime -serial file:ReactOS.log
 +
 
 +
=== Setting up Sound ===
 +
 
 +
==== Using AC97 emulation (QEMU 0.10.1 or later) ====
 +
 
 +
* Set emulation to AC97 (-soundhw ac97)
 +
* Install the drivers using Downloader! (You need to reboot twice)
 +
 
 +
===== Known Issues =====
 +
 
 +
* Audio sounds glitch when changing the audio stream with a high sample rate to a stream with low sample rate
 +
 
 +
==== Using ES1370MP emulation ====
 +
 
 +
* Set emulation to ES1370 (-soundhw es1370)
 +
* Install drivers from here [http://rapidshare.com/files/236843299/windows2.zip.html]
 +
* Create a file named import.reg with the following contents
  
By default, ReactOS debug messages are sent to the serial port (COM1).
+
<syntaxhighlight lang="reg">
For grabbing that output, you need Qemu version 0.6.1 or later, in which you can specify the -serial option.
+
REGEDIT4
  
Like this:
+
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0000\Settings]
<pre>$ qemu -serial stdio -cdrom roslive.iso -boot d</pre>
+
"WaveVol_Left"=dword:00040000
 +
"WaveVol_Right"=dword:00040000
 +
"WaveLineSM"=dword:00000000
 +
"WaveWaveInSM_Left"=dword:01010101
 +
"WaveWaveInSM_Right"=dword:00000000
 +
"CDVol_Left"=dword:fffffff6
 +
"CDVol_Right"=dword:fffffff6
 +
"CDLineSM"=dword:00000000
 +
"CDWaveInSM_Left"=dword:00000000
 +
"CDWaveInSM_Right"=dword:00000000
 +
"LineInVol_Left"=dword:fffffff6
 +
"LineInVol_Right"=dword:fffffff6
 +
"LineLineSM"=dword:01000001
 +
"LineWaveInSM_Left"=dword:00000000
 +
"LineWaveInSM_Right"=dword:00000000
 +
"MicBoost"=dword:00000001
 +
"MicVol"=dword:fffffff6
 +
"MicLineMute"=dword:00000001
 +
"MicWaveInSM_Left"=dword:00000000
 +
"MicWaveInSM_Right"=dword:00000000
 +
"AuxVol_Left"=dword:fffffff6
 +
"AuxVol_Right"=dword:fffffff6
 +
"AuxLineSM"=dword:00000000
 +
"AuxWaveInSM_Left"=dword:00000000
 +
"AuxWaveInSM_Right"=dword:00000000
 +
"PhoneVol"=dword:fffffff6
 +
"PhoneMute"=dword:00000000
 +
"PhoneWaveInSM_Left"=dword:00000000
 +
"PhoneWaveInSM_Right"=dword:00000000
 +
"LineOutVol_Left"=dword:fff9f203
 +
"LineOutVol_Right"=dword:fff9f203
 +
"LineOutMute"=dword:00000000
 +
</syntaxhighlight>
  
Tested on Windows XP and Vista with qemu 0.9.0:
+
* Import those settings by starting cmd.exe and regedit import.reg
<pre>C:\qemu>qemu -L . -hda C:\qemu\ReactOS.vmdk -cdrom C:\RosBE\Source\Reactos.iso -serial file:con</pre>
+
* Reboot
Be sure to use the paths valid depending on your configuration an program paths.
 
  
Valid arguments to -serial include filename and pipes so other valid configurations include for example:
+
If you don't hear any sound in '''QEMU 0.10.x''', you'll have to set QEMU_AUDIO_DRV=fmod (available: dsound; fmod; sdl; none ; wav (dump to file) – see QEMU documentation for information.
  
<pre>
+
===== Known Issues =====
-serial file:"C:\roslog.txt"
 
-serial pipe:"\\pipe1\"
 
</pre>
 
  
=== Using com0com with QEmu ===
+
After starting first audio stream, you need to leave QEMU and re-enter (seems to be a QEMU bug)
com0com is a free utility to create virtual serial port pairs which can be used to capture the debug output of ReactOS and direct it to a terminal program such as TeraTerm.
 
  
From Carlos Bramini (Carlo Bramix):
+
=== Setting up network ===
  
1) Get QEMU. If you have not it yet, my suggestion is to download Qemu Manager, it already includes a recent build of QEMU and it it helps you to configure virtual machines.
+
Networking should work by itself using the '-net nic,model=ne2k_pci' and '-net user' switches with QEMU.
  
2) Get com0com and install it.
+
== Using ReactOS [[LiveCD]] on QEMU ==
Next, run the com0com command shell and type
 
  
<pre>install PortName=COM4 PortName=COM5</pre>
+
# Move to the previously created directory with the <code>cd</code> command.
 +
# There, type in the following command:
  
and it will create two virtual ports connected together.
+
qemu -L <Path to your QEMU folder>\bios -cdrom <filename>.iso -m 64
If you prefer different ports, just change the com names; however you can get a simple help by typing "help" to the shell prompt.
 
  
3) Create a virtual machine for running ReactOS under QEMU.
+
== Grabbing debug messages ==
Be sure to select one of the newly created ports by adding this option to the command line of QEMU:
 
  
<pre>-serial COM4</pre>
+
By default, ReactOS debug messages are sent to the serial port (COM1).
 +
For grabbing that output, you need QEMU version 0.6.1 or later, in which you can specify the -serial option.
  
<b>WARNING:</b> you must write "COM4" with capital letters and not "com4" otherwise QEMU won't use serial port at all!!!
+
Valid arguments to -serial include file names, pipes, COM Ports and [http://www.qemu.org/qemu-doc.html#SEC10 more].
 +
Those arguments could be:
  
4) Open a terminal programme.
+
-serial file:"C:\roslog.txt"
You can use Teraterm or HyperTerminal.
+
-serial pipe:"\\pipe1\"
Start a new connection and select "COM5" as communication port. (If COM5 is not listed, try COM4 --[[User:atylmo|atylmo]] 00:27, 1 January 2008 (CET))
+
-serial COM4
  
5) Finally, launch QEMU and select ReactOS debug into the boot menu.
+
=== Redirect to a file ===
  
<b>FINAL NOTE:</b> the properties of the serial port, like the baud rate, are not important.
+
If you're using the QEMU virtual machine and want to redirect the serial output to a file, add the following to your QEMU command line:
Instead, be sure to select "NO FLOW CONTROL" otherwise the terminal programme doesn't seem to receive the characters.
+
-serial file:''FILENAME''
Hardware flow control (with RTS/CTS) or software flow control (XON/XOFF) does not seem to work during my tests.
 
  
and GreatLord suggests to use RosTE (ReactOS Test Environment) instead of setting this up manually.
+
Replace ''FILENAME'' with the name of a file, into which the debug output shall be written.
  
== ReactOS preloaded with QEMU ==
+
=== Redirect to the console ===
  
A preloaded QEMU image of ReactOS can be found [http://www.reactos.org/en/download.html here].
+
The method above redirects the output to a file. If you want to redirect it to the console, there are two different methods. They depend on the operating system you run QEMU under.
<!-- file not found, url updated, previous url: http://www.reactos.org/xhtml/en/download.html -->
 
  
 +
* Under Windows, add the following to your QEMU command line: <pre>-serial file:CON</pre>
 +
* Under a Unix-based operating system, add the following to your QEMU command line: <pre>-serial stdio</pre>
  
== Installing ReactOS on QEMU ==
+
=== Serial port connection using com0com ===
1. Create a drive image, on which ReactOS will be installed, by typing:
 
  
<pre>qemu-img create ReactOS.img 100M</pre>
+
Setup the com0com driver like explained in this [[com0com]] guide.
  
''100M'' stands for 100 megabytes- that shall be enough.
+
Add the following option to your QEMU command line
It shall be greater, if you plan to install some application to try under ReactOS.
 
  
2. In *nix only, type:
+
-serial COM4
  
<pre>sudo umount /dev/shm
+
Write "COM4" with capital letters otherwise QEMU won't use the serial port at all!
sudo mount -t tmpfs -o size=144m none /dev/shm</pre>
 
  
3. Type:
+
Open your terminal program and start a new connection to your second virtual port. If that port is not listed, try COM4.
  
<pre>qemu -L . -m 256 -cdrom ReactOS.iso -hda ReactOS.img -boot d -localtime -serial file:ReactOS.log</pre>
+
Another option is to use the [http://svn.reactos.org/downloads/RosTE-0.1.exe ReactOS Test Environment] instead of setting this up manually.
''-m 256'' stand for 256MB RAM
 
''-boot d'' instructs qemu to boot from the cdrom. Without ''-boot d'' it will boot from the HDD (Reactos.img).
 
  
''ReactOS.iso'' is the image of the '''installation''' cd, which can be downloaded from http://www.reactos.org/en/download.html
+
== KQEMU ==
  
 +
If you feel that QEMU is too slow for you, consider using the KQEMU module.
  
When reinstalling ReactOS, perform steps 2 (if necessary) and 3 only.
+
Pleas bear in mind that it just works with QEMU up to 0.11 and isn't maintained anymore.
  
If you want to copy some files to ReactOS, you could create an CD-ROM image and mount it on qemu.
+
[http://www.reactos.org/forum/viewtopic.php?f=22&t=1065 Tutorial] by mikedep333
You can run qemu this way:
 
<pre>qemu -L . -m 256 -cdrom Applications.iso -hda ReactOS.img -localtime -serial file:ReactOS.log</pre>
 
  
 
== See also ==
 
== See also ==
* [[HOWTO/setup_a_network_connection#QEMU_on_Linux|Setup network under Linux]]
+
* [[Transfer files from the host OS to the virtual drive]]
* [[HOWTO/setup_win32_QEMU_with_the_KQEMU_accelerator_module|Setup Windows/ReactOS QEMU with the kqemu accelerator module]]
 
* [[Xen]]
 
 
 
== External sites ==
 
  
* [http://fabrice.bellard.free.fr/qemu/ QEMU homepage]
+
{{Navigation Virtualization Software}}
  
[[Category:Virtualization software]]
+
[[Category:Tutorial]]
[[Category:Free software]]
 

Revision as of 22:10, 1 November 2018

QEMU is a free x86 emulator for Linux and Windows. A preloaded QEMU image of ReactOS can be found here.

If you are looking for a faster virtual machine, give VirtualBox or VMware a try.

Installing ReactOS on QEMU

  • Create a drive image, on which ReactOS will be installed, by typing:
qemu-img create ReactOS.img 1000M

1000M stands for 1000 megabytes- that shall be enough. It shall be greater, if you plan to install some application to try under ReactOS.

  • In *nix only, type:
sudo umount /dev/shm
sudo mount -t tmpfs -o size=144m none /dev/shm
  • Type:
qemu -L . -m 256 -cdrom ReactOS.iso -hda ReactOS.img -boot d -localtime -serial file:ReactOS.log

-m 256 stand for 256 MB RAM -boot d instructs QEMU to boot from the CD-ROM. Without -boot d it will boot from the hard drive (Reactos.img).

ReactOS.iso is the image of the installation CD, which can be downloaded from http://www.reactos.org/en/download.html

When reinstalling ReactOS, perform steps 2 (if necessary) and 3 only.

If you want to copy some files to ReactOS, you could create an CD-ROM image and mount it on QEMU. You can run QEMU this way:

qemu -L . -m 256 -cdrom Applications.iso -hda ReactOS.img -localtime -serial file:ReactOS.log

Setting up Sound

Using AC97 emulation (QEMU 0.10.1 or later)

  • Set emulation to AC97 (-soundhw ac97)
  • Install the drivers using Downloader! (You need to reboot twice)
Known Issues
  • Audio sounds glitch when changing the audio stream with a high sample rate to a stream with low sample rate

Using ES1370MP emulation

  • Set emulation to ES1370 (-soundhw es1370)
  • Install drivers from here [1]
  • Create a file named import.reg with the following contents
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0000\Settings]
"WaveVol_Left"=dword:00040000
"WaveVol_Right"=dword:00040000
"WaveLineSM"=dword:00000000
"WaveWaveInSM_Left"=dword:01010101
"WaveWaveInSM_Right"=dword:00000000
"CDVol_Left"=dword:fffffff6
"CDVol_Right"=dword:fffffff6
"CDLineSM"=dword:00000000
"CDWaveInSM_Left"=dword:00000000
"CDWaveInSM_Right"=dword:00000000
"LineInVol_Left"=dword:fffffff6
"LineInVol_Right"=dword:fffffff6
"LineLineSM"=dword:01000001
"LineWaveInSM_Left"=dword:00000000
"LineWaveInSM_Right"=dword:00000000
"MicBoost"=dword:00000001
"MicVol"=dword:fffffff6
"MicLineMute"=dword:00000001
"MicWaveInSM_Left"=dword:00000000
"MicWaveInSM_Right"=dword:00000000
"AuxVol_Left"=dword:fffffff6
"AuxVol_Right"=dword:fffffff6
"AuxLineSM"=dword:00000000
"AuxWaveInSM_Left"=dword:00000000
"AuxWaveInSM_Right"=dword:00000000
"PhoneVol"=dword:fffffff6
"PhoneMute"=dword:00000000
"PhoneWaveInSM_Left"=dword:00000000
"PhoneWaveInSM_Right"=dword:00000000
"LineOutVol_Left"=dword:fff9f203
"LineOutVol_Right"=dword:fff9f203
"LineOutMute"=dword:00000000
  • Import those settings by starting cmd.exe and regedit import.reg
  • Reboot

If you don't hear any sound in QEMU 0.10.x, you'll have to set QEMU_AUDIO_DRV=fmod (available: dsound; fmod; sdl; none ; wav (dump to file) – see QEMU documentation for information.

Known Issues

After starting first audio stream, you need to leave QEMU and re-enter (seems to be a QEMU bug)

Setting up network

Networking should work by itself using the '-net nic,model=ne2k_pci' and '-net user' switches with QEMU.

Using ReactOS LiveCD on QEMU

  1. Move to the previously created directory with the cd command.
  2. There, type in the following command:
qemu -L <Path to your QEMU folder>\bios -cdrom <filename>.iso -m 64

Grabbing debug messages

By default, ReactOS debug messages are sent to the serial port (COM1). For grabbing that output, you need QEMU version 0.6.1 or later, in which you can specify the -serial option.

Valid arguments to -serial include file names, pipes, COM Ports and more. Those arguments could be:

-serial file:"C:\roslog.txt"
-serial pipe:"\\pipe1\"
-serial COM4

Redirect to a file

If you're using the QEMU virtual machine and want to redirect the serial output to a file, add the following to your QEMU command line:

-serial file:FILENAME

Replace FILENAME with the name of a file, into which the debug output shall be written.

Redirect to the console

The method above redirects the output to a file. If you want to redirect it to the console, there are two different methods. They depend on the operating system you run QEMU under.

  • Under Windows, add the following to your QEMU command line:
    -serial file:CON
  • Under a Unix-based operating system, add the following to your QEMU command line:
    -serial stdio

Serial port connection using com0com

Setup the com0com driver like explained in this com0com guide.

Add the following option to your QEMU command line

-serial COM4

Write "COM4" with capital letters otherwise QEMU won't use the serial port at all!

Open your terminal program and start a new connection to your second virtual port. If that port is not listed, try COM4.

Another option is to use the ReactOS Test Environment instead of setting this up manually.

KQEMU

If you feel that QEMU is too slow for you, consider using the KQEMU module.

Pleas bear in mind that it just works with QEMU up to 0.11 and isn't maintained anymore.

Tutorial by mikedep333

See also

Virtualization software‎ to run ReactOS on
Windows Bochs | Hyper-V | PCem | QEMU | Virtual PC | VirtualBox | VMware
ReactOS Bochs | PCem | QEMU | Virtual PC
Linux Bochs | Libvirt | PCem | QEMU | VirtualBox