Next: pcsys_keys, Previous: pcsys_quickstart, Up: QEMU PC System emulator
usage: qemu [options] [disk_image]
disk_image is a raw hard disk image for IDE hard disk 0.
General options:
-M ?
for list)
file=
fileif=
interfacebus=
bus,unit=
unitindex=
indexmedia=
mediacyls=
c,heads=
h,secs=
s[,trans=
t]
snapshot=
snapshotcache=
cacheInstead of -cdrom you can use:
qemu -drive file=file,index=2,media=cdrom
Instead of -hda, -hdb, -hdc, -hdd, you can use:
qemu -drive file=file,index=0,media=disk qemu -drive file=file,index=1,media=disk qemu -drive file=file,index=2,media=disk qemu -drive file=file,index=3,media=disk
You can connect a CDROM to the slave of ide0:
qemu -drive file=file,if=ide,index=1,media=cdrom
If you don't specify the "file=" argument, you define an empty drive:
qemu -drive if=ide,index=1,media=cdrom
You can connect a SCSI disk with unit ID 6 on the bus #0:
qemu -drive file=file,if=scsi,bus=0,unit=6
Instead of -fda, -fdb, you can use:
qemu -drive file=file,index=0,if=floppy qemu -drive file=file,index=1,if=floppy
By default, interface is "ide" and index is automatically incremented:
qemu -drive file=a -drive file=b"
is interpreted like:
qemu -hda a -hdb b
qemu -soundhw sb16,adlib hda qemu -soundhw es1370 hda qemu -soundhw all hda qemu -soundhw ?
now
or 2006-06-17T16:01:21
or
2006-06-17
. The default value is now
.
Display options:
:
d:
pathnone
change
command can be used
to later start the VNC server.
Following the display value there may be one or more option flags separated by commas. Valid options are
password
change
command in the
pcsys_monitor
tls
x509=
/path/to/certificate/dirx509verify=
/path/to/certificate/dirfr
for
French). This option is only needed where it is not easy to get raw PC
keycodes (e.g. on Macs, with some X11 servers or with a VNC
display). You don't normally need to use it on PC/Linux or PC/Windows
hosts.
The available layouts are:
ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr
The default is en-us
.
USB options:
Network options:
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.
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
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
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
bin
of the Unix TFTP client). The host IP address on the guest is as
usual 10.0.2.2.
Example (using pxelinux):
qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
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.
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.
Debug/Expert options:
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]
vc:800x600
It is also possible to specify width or height in characters:
vc:80Cx24C
pty
none
null
/dev/XXX
/dev/parport
Nfile:
filenamestdio
pipe:
filenameCOM
nudp:[
remote_host]:
remote_port[@[
src_ip]:
src_port]
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:
netcat options:
telnet options:
tcp:[
host]:
port[,
server][,nowait][,nodelay]
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
Example to listen and wait on port 4444 for connection
Example to not wait and listen on ip 192.168.0.100 port 4444
telnet:
host:
port[,server][,nowait][,nodelay]
-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]
-serial tcp
except the unix domain socket
path is used for connections.
mon:
dev_string-serial mon:telnet::4444,server,nowait
This option can be used several times to simulate up to 3 parallel ports.
Use -parallel none
to disable all parallel ports.
vc
in graphical mode and stdio
in
non graphical mode.
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
loadvm
in monitor)
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.