Difference between revisions of "Qemu on Linux"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
m (post-import cleanup)
Line 1: Line 1:
{{stub}}
+
{{seed}}[[Computing]]: [[Linux]]: [[Qemu on Linux]]
[[Techniques]]: [[Qemu on Linux]]
+
 
This article is about setting up and running the [[Qemu]] emulator on
+
This article is about setting up and running the [[Qemu]] emulator on [[Linux]].
[[Linux]].
 
 
==Notes==
 
==Notes==
When [[Bochs]] mysteriously stopped being able to run [[Windows
+
When [[Bochs]] mysteriously stopped being able to run [[Windows 98|Win98]], I found that Qemu was able to use the exact same .img file Bochs had been using, and it did manage to load Win98 quite easily. It would appear, then, that the setup for Qemu on Linux is probably quite similar to that of [[Bochs on Linux|Bochs]].
98|Win98]], I found that Qemu was able to use the exact same .img file
 
Bochs had been using, and it did manage to load Win98 quite easily. It
 
would appear, then, that the setup for Qemu on Linux is probably quite
 
similar to that of [[Bochs on Linux|Bochs]].
 
 
===Current issues===
 
===Current issues===
 
*"warning: could not open /dev/net/tun: no virtual network emulation"
 
*"warning: could not open /dev/net/tun: no virtual network emulation"
Line 14: Line 9:
 
==Manpage Documentation==
 
==Manpage Documentation==
 
===NAME===
 
===NAME===
[[qemu]] - QEMU System Emulator ===SYNOPSIS===
+
[[qemu]] - QEMU System Emulator
usage: [[qemu]] [options] [disk_image] ===DESCRIPTION===
+
===SYNOPSIS===
The QEMU System emulator simulates a complete PC. In order to meet
+
usage: [[qemu]] [options] [disk_image]
specific user needs, two versions of QEMU are available:
+
===DESCRIPTION===
#"[[qemu-fast]]" uses the host Memory Management Unit (MMU) to simulate
+
The QEMU System emulator simulates a complete PC. In order to meet specific user needs, two versions of QEMU are available:
the x86 MMU. It is fast but has limitations because the whole 4 GB
+
#"[[qemu-fast]]" uses the host Memory Management Unit (MMU) to simulate the x86 MMU. It is fast but has limitations because the whole 4 GB address space cannot be used and some memory mapped peripherials cannot be emulated accurately yet. Therefore, a specific guest Linux kernel can be used.
address space cannot be used and some memory mapped peripherials cannot
+
#:Moreover there is no separation between the host and target address spaces, so it offers no security (the target OS can modify the "[[qemu-fast]]" code by writing at the right addresses). #"[[qemu]]" uses a software MMU. It is about two times slower but gives a more accurate emulation and a complete separation between the host and target address spaces.
be emulated accurately yet. Therefore, a specific guest Linux kernel
+
 
can be used.
+
QEMU emulates the following PC peripherials:
#:Moreover there is no separation between the host and target address
+
*i440FX host PCI bridge and PIIX3 PCI to ISA bridge
spaces, so it offers no security (the target OS can modify the
+
*Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions (hardware level, including all non-standard modes).
"qemu-fast" code by writing at the right addresses). #"[[qemu]]" uses a
+
*PS/2 mouse and keyboard
software MMU. It is about two times slower but gives a more accurate
+
*2 PCI IDE interfaces with hard disk and CD-ROM support
emulation and a complete separation between the host and target address
+
*Floppy disk
spaces. QEMU emulates the following PC peripherials: *i440FX host PCI
+
*NE2000 PCI network adapters
bridge and PIIX3 PCI to ISA bridge *Cirrus CLGD 5446 PCI VGA card or
+
*Serial ports
dummy VGA card with Bochs VESA extensions (hardware level, including
+
*Soundblaster 16 card
all non-standard modes). *PS/2 mouse and keyboard *2 PCI IDE interfaces
+
QEMU uses the PC BIOS from the [[Bochs]] project and the Plex86/Bochs LGPL VGA BIOS.
with hard disk and CD-ROM support *Floppy disk *NE2000 PCI network
+
===OPTIONS===
adapters *Serial ports *Soundblaster 16 card QEMU uses the PC BIOS from
 
the [[Bochs]] project and the Plex86/Bochs LGPL VGA BIOS. ===OPTIONS===
 
 
*''disk_image'' is a raw hard disk image for IDE hard disk 0.
 
*''disk_image'' is a raw hard disk image for IDE hard disk 0.
 
====General options====
 
====General options====
 
*'''-fda''' ''file''
 
*'''-fda''' ''file''
 
*'''-fdb''' ''file''
 
*'''-fdb''' ''file''
:Use file as floppy disk 0/1 image You can use the host floppy by using
+
:Use file as floppy disk 0/1 image You can use the host floppy by using /dev/fd0 as filename. *'''-hda''' ''file''
/dev/fd0 as filename. *'''-hda''' ''file''
 
 
*'''-hdb''' ''file''
 
*'''-hdb''' ''file''
 
*'''-hdc''' ''file''
 
*'''-hdc''' ''file''
 
*'''-hdd''' ''file''
 
*'''-hdd''' ''file''
 
:Use file as hard disk 0, 1, 2 or 3 image *'''-cdrom''' ''file''
 
:Use file as hard disk 0, 1, 2 or 3 image *'''-cdrom''' ''file''
:Use file as CD-ROM image (you cannot use -hdc and and -cdrom at the
+
:Use file as CD-ROM image (you cannot use -hdc and and -cdrom at the same time). You can use the host CD-ROM by using /dev/cdrom as filename.
same time). You can use the host CD-ROM by using /dev/cdrom as
+
*'''-boot''' ['''a'''|'''c'''|'''d''']
filename. *'''-boot''' ['''a'''|'''c'''|'''d''']
+
:Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is the default.
:Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is the
+
*'''-snapshot'''
default. *'''-snapshot'''
+
:Write to temporary files instead of disk image files. In this case, the raw disk image you use is not written back. You can however force the write back by pressing C-a s
:Write to temporary files instead of disk image files. In this case,
+
*'''-m''' ''megs''
the raw disk image you use is not written back. You can however force
 
the write back by pressing C-a s *'''-m''' ''megs''
 
 
:Set virtual RAM size to ''megs'' megabytes. Default is 128 MB.
 
:Set virtual RAM size to ''megs'' megabytes. Default is 128 MB.
 
*'''-nographic'''
 
*'''-nographic'''
:Normally, QEMU uses SDL to display the VGA output. With this option,
+
:Normally, QEMU uses SDL to display the VGA output. With this option, you can totally disable graphical output so that QEMU is a simple command line application. The emulated serial port is redirected on the console. Therefore, you can still use QEMU to debug a Linux kernel with a serial console.
you can totally disable graphical output so that QEMU is a simple
+
*'''-enable-audio'''
command line application. The emulated serial port is redirected on the
+
:The SB16 emulation is disabled by default as it may give problems with Windows. You can enable it manually with this option.
console. Therefore, you can still use QEMU to debug a Linux kernel with
+
*'''-localtime'''
a serial console. *'''-enable-audio'''
+
:Set the real time clock to local time (the default is to UTC time). This option is needed to have correct date in MS-DOS or Windows.
:The SB16 emulation is disabled by default as it may give problems with
 
Windows. You can enable it manually with this option. *'''-localtime'''
 
:Set the real time clock to local time (the default is to UTC time).
 
This option is needed to have correct date in MS-DOS or Windows.
 
 
*'''-full-screen'''
 
*'''-full-screen'''
:Start in full screen. ====Network options====
+
:Start in full screen.
 +
====Network options====
 
*'''-n''' ''script''
 
*'''-n''' ''script''
:Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script
+
:Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script is launched to configure the host network interface (usually tun0) corresponding to the virtual NE2000 card.
is launched to configure the host network interface (usually tun0)
+
*'''-macaddr''' ''addr''
corresponding to the virtual NE2000 card. *'''-macaddr''' ''addr''
+
:Set the [[mac address]] of the first interface (the format is aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each new network interface. *'''-tun-fd''' ''fd''
:Set the mac address of the first interface (the format is
+
:Assumes ''fd'' talks to a tap/tun host network interface and use it. Read http://bellard.org/qemu/tetrinet.html to have an example of its use.
aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each new
+
*'''-user-net'''
network interface. *'''-tun-fd''' ''fd''
+
:Use the user mode network stack. This is the default if no tun/tap network init script is found.
:Assumes ''fd'' talks to a tap/tun host network interface and use it.
+
*'''-tftp''' ''prefix''
Read <http://bellard.org/qemu/tetrinet.html>
+
:When using the user mode network stack, activate a built-in TFTP server. All filenames beginning with ''prefix'' can be downloaded from the host to the guest using a TFTP client. The TFTP client on the guest must be configured in binary mode (use the command "bin" of the Unix TFTP client). The host IP address on the guest is as usual 10.0.2.2.
to have an example of its use. *'''-user-net'''
 
:Use the user mode network stack. This is the default if no tun/tap
 
network init script is found. *'''-tftp''' ''prefix''
 
:When using the user mode network stack, activate a built-in TFTP
 
server. All filenames beginning with ''prefix'' can be downloaded from
 
the host to the guest using a TFTP client. The TFTP client on the guest
 
must be configured in binary mode (use the command "bin" of the Unix
 
TFTP client). The host IP address on the guest is as usual 10.0.2.2.
 
 
*'''-smb''' ''dir''
 
*'''-smb''' ''dir''
:When using the user mode network stack, activate a built-in SMB server
+
:When using the user mode network stack, activate a built-in SMB server so that Windows OSes can access to the host files in ''dir'' transparently.
so that Windows OSes can access to the host files in ''dir''
+
:In the guest Windows OS, the line:
transparently. :In the guest Windows OS, the line: 10.0.2.4 smbserver
+
10.0.2.4 smbserver
:must be added in the file C:\WINDOWS\LMHOSTS (for windows 9x/Me) or
+
:must be added in the file C:\WINDOWS\LMHOSTS (for windows 9x/Me) or C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS (Windows NT/2000). Then dir can be accessed in \\smbserver\qemu.
C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS (Windows NT/2000). Then dir can
+
:Note that a SAMBA server must be installed on the host OS in /usr/sbin/smbd. QEMU was tested succesfully with smbd version 2.2.7a from the Red Hat 9.
be accessed in \\smbserver\qemu. :Note that a SAMBA server must be
+
*'''-redir''' ['''tcp'''|'''udp''']''':'''''host-port''''':'''[''guest-host'']''':'''''guest-port''
installed on the host OS in /usr/sbin/smbd. QEMU was tested succesfully
+
:When using the user mode network stack, redirect incoming TCP or UDP connections to the host port host-port to the guest guest-host on guest port guest-port. If guest-host is not specified, its value is 10.0.2.15 (default address given by the built-in DHCP server).
with smbd version 2.2.7a from the Red Hat 9. *'''-redir'''
+
:For example, to redirect host X11 connection from screen 1 to guest screen 0, use the following:
['''tcp'''|'''udp''']''':'''''host-port''''':'''[''guest-host'']''':'''''guest-port''
+
# on the host
:When using the user mode network stack, redirect incoming TCP or UDP
+
[[qemu]] -redir tcp:6001::6000 [...]
connections to the host port host-port to the guest guest-host on guest
+
# this host xterm should open in the guest X11 server
port guest-port. If guest-host is not specified, its value is 10.0.2.15
+
[[xterm]] -display :1
(default address given by the built-in DHCP server). :For example, to
+
:To redirect telnet connections from host port 5555 to telnet port on the guest, use the following:
redirect host X11 connection from screen 1 to guest screen 0, use the
+
# on the host
following: # on the host [[qemu]] -redir tcp:6001::6000 [...] # this
+
[[qemu]] -redir
host xterm should open in the guest X11 server [[xterm]] -display :1
+
tcp:5555::23 [...]
:To redirect telnet connections from host port 5555 to telnet port on
+
[[telnet]] localhost 5555
the guest, use the following: # on the host [[qemu]] -redir
+
:Then when you use on the host "telnet localhost 5555", you connect to the guest telnet server.
tcp:5555::23 [...] [[telnet]] localhost 5555
+
*'''-dummy-net'''
:Then when you use on the host "telnet localhost 5555", you connect to
+
:Use the dummy network stack: no packet will be received by the network cards.
the guest telnet server. *'''-dummy-net'''
+
====Linux boot specific====
:Use the dummy network stack: no packet will be received by the network
+
When using these options, you can use a given Linux kernel without installing it in the disk image. It can be useful for easier testing of various kernels.
cards. ====Linux boot specific====
+
*'''-kernel''' ''bzImage''
When using these options, you can use a given Linux kernel without
+
:Use ''bzImage'' as kernel image.
installing it in the disk image. It can be useful for easier testing of
+
*'''-append''' ''cmdline''
various kernels. *'''-kernel''' ''bzImage''
+
:Use cmdline as kernel command line
:Use ''bzImage'' as kernel image. *'''-append''' ''cmdline''
+
*'''-initrd''' ''file''
:Use cmdline as kernel command line *'''-initrd''' ''file''
+
:Use ''file'' as initial ram disk.
:Use ''file'' as initial ram disk. ====Debug/Expert options====
+
====Debug/Expert options====
 
*'''-serial''' ''dev''
 
*'''-serial''' ''dev''
:Redirect the virtual serial port to host device ''dev''. Available
+
:Redirect the virtual serial port to host device ''dev''. Available devices are:
devices are: **"vc"
+
**"vc"
**:Virtual console **"pty"
+
**:Virtual console
 +
**"pty"
 
**:[Linux only] Pseudo TTY (a new PTY is automatically allocated)
 
**:[Linux only] Pseudo TTY (a new PTY is automatically allocated)
 
**"null"
 
**"null"
**:void device **"stdio"
+
**:void device
**:[Unix only] standard input/output :The default device is "vc" in
+
**"stdio"
graphical mode and "stdio" in non graphical mode. :This option can be
+
**:[Unix only] standard input/output :The default device is "vc" in graphical mode and "stdio" in non graphical mode. :This option can be used several times to simulate up to 4 serials ports.
used several times to simulate up to 4 serials ports. *'''-monitor'''
+
*'''-monitor''' ''dev''
''dev''
+
:Redirect the monitor to host device ''dev'' (same devices as the serial port). The default device is "vc" in graphical mode and "stdio" in non graphical mode.
:Redirect the monitor to host device ''dev'' (same devices as the
+
*'''-s'''
serial port). The default device is "vc" in graphical mode and "stdio"
+
:Wait gdb connection to port 1234
in non graphical mode. *'''-s'''
+
*'''-p''' ''port''
:Wait gdb connection to port 1234 *'''-p''' ''port''
+
:Change gdb connection port.
:Change gdb connection port. *'''-S'''
+
*'''-S'''
 
:Do not start CPU at startup (you must type 'c' in the monitor).
 
:Do not start CPU at startup (you must type 'c' in the monitor).
 
*'''-d'''
 
*'''-d'''
:Output log in /tmp/qemu.log *'''-isa'''
+
:Output log in /tmp/qemu.log
:Simulate an ISA-only system (default is PCI system). *'''-std-vga'''
+
*'''-isa'''
:Simulate a standard VGA card with Bochs VBE extensions (default is
+
:Simulate an ISA-only system (default is PCI system).
Cirrus Logic GD5446 PCI VGA) *'''-loadvm''' ''file''
+
*'''-std-vga'''
:Start right away with a saved state ("loadvm" in monitor) ====PowerPC
+
:Simulate a standard VGA card with Bochs VBE extensions (default is Cirrus Logic GD5446 PCI VGA)
Options====
+
*'''-loadvm''' ''file''
 +
:Start right away with a saved state ("loadvm" in monitor)
 +
====PowerPC Options====
 
The following options are specific to the PowerPC emulation:
 
The following options are specific to the PowerPC emulation:
 
*'''-prep'''
 
*'''-prep'''
:Simulate a PREP system (default is PowerMAC) *'''-g'''
+
:Simulate a PREP system (default is PowerMAC)
''W'''''x'''''H''['''x'''''DEPTH'']
+
*'''-g''' ''W'''''x'''''H''['''x'''''DEPTH'']
 
:Set the initial VGA graphic mode. The default is 800x600x15.
 
:Set the initial VGA graphic mode. The default is 800x600x15.
 
===Keys===
 
===Keys===
 
During the graphical emulation, you can use the following keys:
 
During the graphical emulation, you can use the following keys:
 
*'''Ctrl-Alt-f'''
 
*'''Ctrl-Alt-f'''
*:Toggle full screen *'''Ctrl-Alt-'''''n''
+
*:Toggle full screen
 +
*'''Ctrl-Alt-'''''n''
 
*:Switch to virtual console 'n'. Standard console mappings are:
 
*:Switch to virtual console 'n'. Standard console mappings are:
**'''1''' : Target system display **'''2''' : Monitor **'''3''' :Serial port *'''Ctrl-Alt'''
+
**'''1''' : Target system display
*:Toggle mouse and keyboard grab. *In the virtual consoles, you can use
+
**'''2''' : Monitor
'''Ctrl-Up''', '''Ctrl-Down''', '''Ctrl-PageUp''' and
+
**'''3''' :Serial port
'''Ctrl-PageDown''' to move in the back log. *During emulation, if you
+
*'''Ctrl-Alt'''
are using the -nographic option, use '''Ctrl-a h''' to get terminal
+
*:Toggle mouse and keyboard grab.
commands: **'''Ctrl-a h'''
+
*In the virtual consoles, you can use '''Ctrl-Up''', '''Ctrl-Down''', '''Ctrl-PageUp''' and '''Ctrl-PageDown''' to move in the back log.
**:Print this help **'''Ctrl-a x'''
+
*During emulation, if you are using the -nographic option, use '''Ctrl-a h''' to get terminal commands:
**:Exit emulatior **'''Ctrl-a s'''
+
**'''Ctrl-a h'''
**:Save disk data back to file (if -snapshot) **'''Ctrl-a b'''
+
**:Print this help
**:Send break (magic sysrq in Linux) **'''Ctrl-a c'''
+
**'''Ctrl-a x'''
**:Switch between console and monitor **'''Ctrl-a Ctrl-a'''
+
**:Exit emulatior
**:Send Ctrl-a ===SEE ALSO===
+
**'''Ctrl-a s'''
The HTML documentation of QEMU for more precise information and Linux
+
**:Save disk data back to file (if -snapshot)
user mode emulator invocation. ===AUTHOR===
+
**'''Ctrl-a b'''
 +
**:Send break (magic sysrq in Linux)
 +
**'''Ctrl-a c'''
 +
**:Switch between console and monitor
 +
**'''Ctrl-a Ctrl-a'''
 +
**:Send Ctrl-a
 +
===SEE ALSO===
 +
The HTML documentation of QEMU for more precise information and Linux user mode emulator invocation.
 +
===AUTHOR===
 
Fabrice Bellard
 
Fabrice Bellard
 
==Edit Log==
 
==Edit Log==
*'''2005-06-25''': Added contents of manpage
+
* '''2005-10-14''': Cleaned up after import from hypertwiki to htyp
 +
* '''2005-06-25''': Added contents of manpage

Revision as of 17:12, 14 October 2005

This page is a seed article. You can help HTYP water it: make a request to expand a given page and/or donate to help give us more writing-hours!

Computing: Linux: Qemu on Linux

This article is about setting up and running the Qemu emulator on Linux.

Notes

When Bochs mysteriously stopped being able to run Win98, I found that Qemu was able to use the exact same .img file Bochs had been using, and it did manage to load Win98 quite easily. It would appear, then, that the setup for Qemu on Linux is probably quite similar to that of Bochs.

Current issues

  • "warning: could not open /dev/net/tun: no virtual network emulation"
  • Need to figure out how to mount an .img file

Manpage Documentation

NAME

qemu - QEMU System Emulator

SYNOPSIS

usage: qemu [options] [disk_image]

DESCRIPTION

The QEMU System emulator simulates a complete PC. In order to meet specific user needs, two versions of QEMU are available:

  1. "qemu-fast" uses the host Memory Management Unit (MMU) to simulate the x86 MMU. It is fast but has limitations because the whole 4 GB address space cannot be used and some memory mapped peripherials cannot be emulated accurately yet. Therefore, a specific guest Linux kernel can be used.
    Moreover there is no separation between the host and target address spaces, so it offers no security (the target OS can modify the "qemu-fast" code by writing at the right addresses). #"qemu" uses a software MMU. It is about two times slower but gives a more accurate emulation and a complete separation between the host and target address spaces.

QEMU emulates the following PC peripherials:

  • i440FX host PCI bridge and PIIX3 PCI to ISA bridge
  • Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions (hardware level, including all non-standard modes).
  • PS/2 mouse and keyboard
  • 2 PCI IDE interfaces with hard disk and CD-ROM support
  • Floppy disk
  • NE2000 PCI network adapters
  • Serial ports
  • Soundblaster 16 card

QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL VGA BIOS.

OPTIONS

  • disk_image is a raw hard disk image for IDE hard disk 0.

General options

  • -fda file
  • -fdb file
Use file as floppy disk 0/1 image You can use the host floppy by using /dev/fd0 as filename. *-hda file
  • -hdb file
  • -hdc file
  • -hdd file
Use file as hard disk 0, 1, 2 or 3 image *-cdrom file
Use file as CD-ROM image (you cannot use -hdc and and -cdrom at the same time). You can use the host CD-ROM by using /dev/cdrom as filename.
  • -boot [a|c|d]
Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is the default.
  • -snapshot
Write to temporary files instead of disk image files. In this case, the raw disk image you use is not written back. You can however force the write back by pressing C-a s
  • -m megs
Set virtual RAM size to megs megabytes. Default is 128 MB.
  • -nographic
Normally, QEMU uses SDL to display the VGA output. With this option, you can totally disable graphical output so that QEMU is a simple command line application. The emulated serial port is redirected on the console. Therefore, you can still use QEMU to debug a Linux kernel with a serial console.
  • -enable-audio
The SB16 emulation is disabled by default as it may give problems with Windows. You can enable it manually with this option.
  • -localtime
Set the real time clock to local time (the default is to UTC time). This option is needed to have correct date in MS-DOS or Windows.
  • -full-screen
Start in full screen.

Network options

  • -n script
Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script is launched to configure the host network interface (usually tun0) corresponding to the virtual NE2000 card.
  • -macaddr addr
Set the mac address of the first interface (the format is aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each new network interface. *-tun-fd fd
Assumes fd talks to a tap/tun host network interface and use it. Read http://bellard.org/qemu/tetrinet.html to have an example of its use.
  • -user-net
Use the user mode network stack. This is the default if no tun/tap network init script is found.
  • -tftp prefix
When using the user mode network stack, activate a built-in TFTP server. All filenames beginning with prefix can be downloaded from the host to the guest using a TFTP client. The TFTP client on the guest must be configured in binary mode (use the command "bin" of the Unix TFTP client). The host IP address on the guest is as usual 10.0.2.2.
  • -smb dir
When using the user mode network stack, activate a built-in SMB server so that Windows OSes can access to the host files in dir transparently.
In the guest Windows OS, the line:
10.0.2.4 smbserver
must be added in the file C:\WINDOWS\LMHOSTS (for windows 9x/Me) or C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS (Windows NT/2000). Then dir can be accessed in \\smbserver\qemu.
Note that a SAMBA server must be installed on the host OS in /usr/sbin/smbd. QEMU was tested succesfully with smbd version 2.2.7a from the Red Hat 9.
  • -redir [tcp|udp]:host-port:[guest-host]:guest-port
When using the user mode network stack, redirect incoming TCP or UDP connections to the host port host-port to the guest guest-host on guest port guest-port. If guest-host is not specified, its value is 10.0.2.15 (default address given by the built-in DHCP server).
For example, to redirect host X11 connection from screen 1 to guest screen 0, use the following:
# on the host
qemu -redir tcp:6001::6000 [...]
# this host xterm should open in the guest X11 server
xterm -display :1
To redirect telnet connections from host port 5555 to telnet port on the guest, use the following:
# on the host
qemu -redir
tcp:5555::23 [...]
telnet localhost 5555
Then when you use on the host "telnet localhost 5555", you connect to the guest telnet server.
  • -dummy-net
Use the dummy network stack: no packet will be received by the network cards.

Linux boot specific

When using these options, you can use a given Linux kernel without installing it in the disk image. It can be useful for easier testing of various kernels.

  • -kernel bzImage
Use bzImage as kernel image.
  • -append cmdline
Use cmdline as kernel command line
  • -initrd file
Use file as initial ram disk.

Debug/Expert options

  • -serial dev
Redirect the virtual serial port to host device dev. Available devices are:
    • "vc"
      Virtual console
    • "pty"
      [Linux only] Pseudo TTY (a new PTY is automatically allocated)
    • "null"
      void device
    • "stdio"
      [Unix only] standard input/output :The default device is "vc" in graphical mode and "stdio" in non graphical mode. :This option can be used several times to simulate up to 4 serials ports.
  • -monitor dev
Redirect the monitor to host device dev (same devices as the serial port). The default device is "vc" in graphical mode and "stdio" in non graphical mode.
  • -s
Wait gdb connection to port 1234
  • -p port
Change gdb connection port.
  • -S
Do not start CPU at startup (you must type 'c' in the monitor).
  • -d
Output log in /tmp/qemu.log
  • -isa
Simulate an ISA-only system (default is PCI system).
  • -std-vga
Simulate a standard VGA card with Bochs VBE extensions (default is Cirrus Logic GD5446 PCI VGA)
  • -loadvm file
Start right away with a saved state ("loadvm" in monitor)

PowerPC Options

The following options are specific to the PowerPC emulation:

  • -prep
Simulate a PREP system (default is PowerMAC)
  • -g WxH[xDEPTH]
Set the initial VGA graphic mode. The default is 800x600x15.

Keys

During the graphical emulation, you can use the following keys:

  • Ctrl-Alt-f
    Toggle full screen
  • Ctrl-Alt-n
    Switch to virtual console 'n'. Standard console mappings are:
    • 1 : Target system display
    • 2 : Monitor
    • 3 :Serial port
  • Ctrl-Alt
    Toggle mouse and keyboard grab.
  • In the virtual consoles, you can use Ctrl-Up, Ctrl-Down, Ctrl-PageUp and Ctrl-PageDown to move in the back log.
  • During emulation, if you are using the -nographic option, use Ctrl-a h to get terminal commands:
    • Ctrl-a h
      Print this help
    • Ctrl-a x
      Exit emulatior
    • Ctrl-a s
      Save disk data back to file (if -snapshot)
    • Ctrl-a b
      Send break (magic sysrq in Linux)
    • Ctrl-a c
      Switch between console and monitor
    • Ctrl-a Ctrl-a
      Send Ctrl-a

SEE ALSO

The HTML documentation of QEMU for more precise information and Linux user mode emulator invocation.

AUTHOR

Fabrice Bellard

Edit Log

  • 2005-10-14: Cleaned up after import from hypertwiki to htyp
  • 2005-06-25: Added contents of manpage