USB options:
`-usb'
Enable the USB driver (will be the default soon)
`-usbdevice devname '
Add the USB device
devname . See section
3.9.1 Connecting USB devices .
Network options:
`-net nic[,vlan=n ][,macaddr=addr ][,model=type ]'
Create a new Network Interface Card and connect it to VLAN
n (
n = 0 is the default). The NIC is an ne2k_pci by default on the PC target. Optionally, the MAC address can be changed. If no
`-net' option is specified, a single NIC is created. Qemu can emulate several different models of network card. Valid values for
type are
i82551 ,
i82557b ,
i82559er ,
ne2k_pci ,
ne2k_isa ,
pcnet ,
rtl8139 ,
smc91c111 ,
lance and
mcf_fec . Not all devices are supported on all targets. Use -net nic,model=? for a list of available devices for your target.
`-net user[,vlan=n ][,hostname=name ]'
Use the user mode network stack which requires no administrator privilege to run.
`hostname=name' can be used to specify the client hostname reported by the builtin DHCP server.
`-net tap[,vlan=n ][,fd=h ][,ifname=name ][,script=file ]'
Connect the host TAP network interface
name to VLAN
n and use the network script
file to configure it. The default network script is
`/etc/qemu-ifup' . Use
`script=no' to disable script execution. If
name is not provided, the OS automatically provides one.
`fd' =
h can be used to specify the handle of an already opened host TAP interface. Example:
qemu linux.img -net nic -net tap More complicated example (two NICs, each one connected to a TAP device)
qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
-net nic,vlan=1 -net tap,vlan=1,ifname=tap1
`-net socket[,vlan=n ][,fd=h ][,listen=[host ]:port ][,connect=host :port ]'
Connect the VLAN
n to a remote VLAN in another QEMU virtual machine using a TCP socket connection. If
`listen' is specified, QEMU waits for incoming connections on
port (
host is optional).
`connect' is used to connect to another QEMU instance using the
`listen' option.
`fd' =
h specifies an already opened TCP socket. Example:
# launch a first QEMU instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
-net socket,listen=:1234
# connect the VLAN 0 of this instance to the VLAN 0
# of the first instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
-net socket,connect=127.0.0.1:1234
`-net socket[,vlan=n ][,fd=h ][,mcast=maddr :port ]'
Create a VLAN
n shared with another QEMU virtual machines using a UDP multicast socket, effectively making a bus for every QEMU with same multicast address
maddr and
port . NOTES:
- Several QEMU can be running on different hosts and share same bus (assuming correct multicast setup for these hosts).
- mcast support is compatible with User Mode Linux (argument `ethN =mcast' ), see http://user-mode-linux.sf.net .
- Use `fd=h' to specify an already opened UDP multicast socket.
Example:
# launch one QEMU instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
-net socket,mcast=230.0.0.1:1234
# launch another QEMU instance on same "bus"
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
-net socket,mcast=230.0.0.1:1234
# launch yet another QEMU instance on same "bus"
qemu linux.img -net nic,macaddr=52:54:00:12:34:58 \
-net socket,mcast=230.0.0.1:1234 Example (User Mode Linux compat.):
# launch QEMU instance (note mcast address selected
# is UML's default)
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
-net socket,mcast=239.192.168.1:1102
# launch UML
/path/to/linux ubd0=/path/to/root_fs eth0=mcast
`-net none'
Indicate that no network devices should be configured. It is used to override the default configuration (
`-net nic -net user' ) which is activated if no
`-net' options are provided.
`-tftp dir '
When using the user mode network stack, activate a built-in TFTP server. The files in
dir will be exposed as the root of a TFTP server. 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.
`-bootp file '
When using the user mode network stack, broadcast
file as the BOOTP filename. In conjunction with
`-tftp' , this can be used to network boot a guest from a local directory. Example (using pxelinux):
qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
`-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 successfully with smbd version 2.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
`-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.
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 character device
dev . 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. Use
-serial none to disable all serial ports. Available character devices are:
vc[:WxH]
Virtual console. Optionally, a width and height can be given in pixel with
vc:800x600 It is also possible to specify width or height in characters:
vc:80Cx24C
pty
[Linux only] Pseudo TTY (a new PTY is automatically allocated)
none
No device is allocated.
null
void device
/dev/XXX
[Linux only] Use host tty, e.g.
`/dev/ttyS0' . The host serial port parameters are set according to the emulated ones.
/dev/parportN
[Linux only, parallel port only] Use host parallel port
N . Currently SPP and EPP parallel port features can be used.
file:filename
Write output to
filename . No character can be read.
stdio
[Unix only] standard input/output
pipe:filename
name pipe
filename
COMn
[Windows only] Use host serial port
n
udp:[remote_host ]:remote_port [@[src_ip ]:src_port ]
This implements UDP Net Console. When
remote_host or
src_ip are not specified they default to
0.0.0.0 . When not using a specified
src_port a random port is automatically chosen. If you just want a simple readonly console you can use
netcat or
nc , by starting qemu with:
-serial udp::4555 and nc as:
nc -u -l -p 4555 . Any time qemu writes something to that port it will appear in the netconsole session. If you plan to send characters back via netconsole or you want to stop and start qemu a lot of times, you should have qemu use the same source port each time by using something like
-serial udp::4555@:4556 to qemu. Another approach is to use a patched version of netcat which can listen to a TCP port and send and receive characters via udp. If you have a patched version of netcat which activates telnet remote echo and single char transfer, then you can use the following options to step up a netcat redirector to allow telnet on port 5555 to access the qemu port.
Qemu Options:
-serial udp::4555@:4556
netcat options:
-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
telnet options:
localhost 5555
tcp:[host ]:port [,server ][,nowait][,nodelay]
The TCP Net Console has two modes of operation. It can send the serial I/O to a location or wait for a connection from a location. By default the TCP Net Console is sent to
host at the
port . If you use the
server option QEMU will wait for a client socket application to connect to the port before continuing, unless the
nowait option was specified. The
nodelay option disables the Nagle buffering algorithm. If
host is omitted, 0.0.0.0 is assumed. Only one TCP connection at a time is accepted. You can use
telnet to connect to the corresponding character device.
Example to send tcp console to 192.168.0.2 port 4444
-serial tcp:192.168.0.2:4444
Example to listen and wait on port 4444 for connection
-serial tcp::4444,server
Example to not wait and listen on ip 192.168.0.100 port 4444
-serial tcp:192.168.0.100:4444,server,nowait
telnet:host :port [,server][,nowait][,nodelay]
The telnet protocol is used instead of raw tcp sockets. The options work the same as if you had specified
-serial tcp . The difference is that the port acts like a telnet server or client using telnet option negotiation. This will also allow you to send the MAGIC_SYSRQ sequence if you use a telnet that supports sending the break sequence. Typically in unix telnet you do it with Control-] and then type "send break" followed by pressing the enter key.
unix:path [,server][,nowait]
A unix domain socket is used instead of a tcp socket. The option works the same as if you had specified
-serial tcp except the unix domain socket
path is used for connections.
mon:dev_string
This is a special option to allow the monitor to be multiplexed onto another serial port. The monitor is accessed with key sequence of
Control-a and then pressing
c . See monitor access section
3.4 Keys in the -nographic section for more keys.
dev_string should be any one of the serial devices specified above. An example to multiplex the monitor onto a telnet server listening on port 4444 would be:
-serial mon:telnet::4444,server,nowait
`-parallel dev '
Redirect the virtual parallel port to host device
dev (same devices as the serial port). On Linux hosts,
`/dev/parportN' can be used to use hardware devices connected on the corresponding host parallel port. This option can be used several times to simulate up to 3 parallel ports. Use
-parallel none to disable all parallel 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.
`-echr numeric_ascii_value'
Change the escape character used for switching to the monitor when using monitor and serial sharing. The default is
0x01 when using the
-nographic option.
0x01 is equal to pressing
Control-a . You can select a different character from the ascii control keys where 1 through 26 map to Control-a through Control-z. For instance you could use the either of the following to change the escape character to Control-t.
-echr 0x14
-echr 20
`-s'
Wait gdb connection to port 1234 (see section
3.11 GDB usage ).
`-p port '
Change gdb connection port.
port can be either a decimal number to specify a TCP port, or a host device (same devices as the serial port).
`-S'
Do not start CPU at startup (you must type 'c' in the monitor).
`-d'
Output log in /tmp/qemu.log
`-hdachs c ,h ,s ,[,t ]'
Force hard disk 0 physical geometry (1 <=
c <= 16383, 1 <=
h <= 16, 1 <=
s <= 63) and optionally force the BIOS translation mode (
t =none, lba or auto). Usually QEMU can guess all those parameters. This option is useful for old MS-DOS disk images.
`-L path'
Set the directory for the BIOS, VGA BIOS and keymaps.
`-std-vga'
Simulate a standard VGA card with Bochs VBE extensions (default is Cirrus Logic GD5446 PCI VGA). If your guest OS supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if you want to use high resolution modes (>= 1280x1024x16) then you should use this option.
`-no-acpi'
Disable ACPI (Advanced Configuration and Power Interface) support. Use it if your guest OS complains about ACPI problems (PC target machine only).
`-no-reboot'
Exit instead of rebooting.
`-loadvm file'
Start right away with a saved state (
loadvm in monitor)
`-semihosting'
Enable semihosting syscall emulation (ARM and M68K target machines only). On ARM this implements the "Angel" interface. On M68K this implements the "ColdFire GDB" interface used by libgloss. Note that this allows guest direct access to the host filesystem, so should only be used with trusted guest OS.
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 emulator
Ctrl-a s
Save disk data back to file (if -snapshot)
Ctrl-a t
toggle console timestamps
Ctrl-a b
Send break (magic sysrq in Linux)
Ctrl-a c
Switch between console and monitor
Ctrl-a Ctrl-a
Send Ctrl-a
The QEMU monitor is used to give complex commands to the QEMU emulator. You can use it to:
- Remove or insert removable media images (such as CD-ROM or floppies).
- Freeze/unfreeze the Virtual Machine (VM) and save or restore its state from a disk file.
- Inspect the VM state without an external debugger.
The following commands are available:
`help or ? [cmd ]'
Show the help for all commands or just for command
cmd .
`commit'
Commit changes to the disk images (if -snapshot is used).
`info subcommand '
Show various information about the system state.
`info network'
show the various VLANs and the associated devices
`info block'
show the block devices
`info registers'
show the cpu registers
`info history'
show the command line history
`info pci'
show emulated PCI device
`info usb'
show USB devices plugged on the virtual USB hub
`info usbhost'
show all USB host devices
`info capture'
show information about active capturing
`info snapshots'
show list of VM snapshots
`info mice'
show which guest mouse is receiving events
`q or quit'
Quit the emulator.
`eject [-f] device '
Eject a removable medium (use -f to force it).
`change device setting '
Change the configuration of a device.
`change diskdevice filename '
Change the medium for a removable disk device to point to
filename . eg
(qemu) change cdrom /path/to/some.iso
`change vnc display ,options '
Change the configuration of the VNC server. The valid syntax for
display and
options are described at section
3.3 Invocation . eg
(qemu) change vnc localhost:1
`change vnc password'
Change the password associated with the VNC server. The monitor will prompt for the new password to be entered. VNC passwords are only significant upto 8 letters. eg.
(qemu) change vnc password
Password: ********
`screendump filename '
Save screen into PPM image
filename .
`mouse_move dx dy [dz ]'
Move the active mouse to the specified coordinates
dx
dy with optional scroll axis
dz .
`mouse_button val '
Change the active mouse button state
val (1=L, 2=M, 4=R).
`mouse_set index '
Set which mouse device receives events at given
index , index can be obtained with
info mice
`wavcapture filename [frequency [bits [channels ]]]'
Capture audio into
filename . Using sample rate
frequency bits per sample
bits and number of channels
channels . Defaults:
- Sample rate = 44100 Hz - CD quality
- Bits = 16
- Number of channels = 2 - Stereo
`stopcapture index '
Stop capture with a given
index , index can be obtained with
info capture
`log item1 [,...]'
Activate logging of the specified items to
`/tmp/qemu.log' .
`savevm [tag |id ]'
Create a snapshot of the whole virtual machine. If
tag is provided, it is used as human readable identifier. If there is already a snapshot with the same tag or ID, it is replaced. More info at section
3.6.3 VM snapshots .
`loadvm tag |id '
Set the whole virtual machine to the snapshot identified by the tag
tag or the unique snapshot ID
id .
`delvm tag |id '
Delete the snapshot identified by
tag or
id .
`stop'
Stop emulation.
`c or cont'
Resume emulation.
`gdbserver [port ]'
Start gdbserver session (default
port =1234)
`x/fmt addr '
Virtual memory dump starting at
addr .
`xp /fmt addr '
Physical memory dump starting at
addr .
fmt is a format which tells the command how to format the data. Its syntax is:
`/{count}{format}{size}'
count
is the number of items to be dumped.
format
can be x (hex), d (signed decimal), u (unsigned decimal), o (octal), c (char) or i (asm instruction).
size
can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
h or
w can be specified with the
i format to respectively select 16 or 32 bit code instruction size.
Examples:
- Dump 10 instructions at the current instruction pointer:
(qemu) x/10i $eip
0x90107063: ret
0x90107064: sti
0x90107065: lea 0x0(%esi,1),%esi
0x90107069: lea 0x0(%edi,1),%edi
0x90107070: ret
0x90107071: jmp 0x90107080
0x90107073: nop
0x90107074: nop
0x90107075: nop
0x90107076: nop
- Dump 80 16 bit values at the start of the video memory.
(qemu) xp/80hx 0xb8000
0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
0x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
0x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
0x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
0x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
0x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
`p or print/fmt expr '
Print expression value. Only the
format part of
fmt is used.
`sendkey keys '
Send
keys to the emulator. Use
- to press several keys simultaneously. Example:
sendkey ctrl-alt-f1 This command is useful to send keys that your graphical user interface intercepts at low level, such as
ctrl-alt-f1 in X Window.
`system_reset'
Reset the system.
`usb_add devname '
Add the USB device
devname . For details of available devices see section
3.9.1 Connecting USB devices
`usb_del devname '
Remove the USB device
devname from the QEMU virtual USB hub.
devname has the syntax
bus.addr . Use the monitor command
info usb to see the devices you can remove.
The monitor understands integers expressions for every integer argument. You can use register names to get the value of specifics CPU registers by prefixing them with $ .
|