📄 qemu-doc.texi
字号:
\input texinfo @c -*- texinfo -*-@c %**start of header@setfilename qemu-doc.info@settitle QEMU Emulator User Documentation@exampleindent 0@paragraphindent 0@c %**end of header@iftex@titlepage@sp 7@center @titlefont{QEMU Emulator}@sp 1@center @titlefont{User Documentation}@sp 3@end titlepage@end iftex@ifnottex@node Top@top@menu* Introduction::* Installation::* QEMU PC System emulator::* QEMU System emulator for non PC targets::* QEMU User space emulator::* compilation:: Compilation from the sources* Index::@end menu@end ifnottex@contents@node Introduction@chapter Introduction@menu* intro_features:: Features@end menu@node intro_features@section FeaturesQEMU is a FAST! processor emulator using dynamic translation toachieve good emulation speed.QEMU has two operating modes:@itemize @minus@item Full system emulation. In this mode, QEMU emulates a full system (forexample a PC), including one or several processors and variousperipherals. It can be used to launch different Operating Systemswithout rebooting the PC or to debug system code.@item User mode emulation. In this mode, QEMU can launchprocesses compiled for one CPU on another CPU. It can be used tolaunch the Wine Windows API emulator (@url{http://www.winehq.org}) orto ease cross-compilation and cross-debugging.@end itemizeQEMU can run without an host kernel driver and yet gives acceptableperformance. For system emulation, the following hardware targets are supported:@itemize@item PC (x86 or x86_64 processor)@item ISA PC (old style PC without PCI bus)@item PREP (PowerPC processor)@item G3 BW PowerMac (PowerPC processor)@item Mac99 PowerMac (PowerPC processor, in progress)@item Sun4m (32-bit Sparc processor)@item Sun4u (64-bit Sparc processor, in progress)@item Malta board (32-bit MIPS processor)@item ARM Integrator/CP (ARM926E or 1026E processor)@item ARM Versatile baseboard (ARM926E)@end itemizeFor user emulation, x86, PowerPC, ARM, MIPS, Sparc32/64 and ColdFire(m68k) CPUs are supported.@node Installation@chapter InstallationIf you want to compile QEMU yourself, see @ref{compilation}.@menu* install_linux:: Linux* install_windows:: Windows* install_mac:: Macintosh@end menu@node install_linux@section LinuxIf a precompiled package is available for your distribution - you justhave to install it. Otherwise, see @ref{compilation}.@node install_windows@section WindowsDownload the experimental binary installer at@url{http://www.free.oszoo.org/@/download.html}.@node install_mac@section Mac OS XDownload the experimental binary installer at@url{http://www.free.oszoo.org/@/download.html}.@node QEMU PC System emulator@chapter QEMU PC System emulator@menu* pcsys_introduction:: Introduction* pcsys_quickstart:: Quick Start* sec_invocation:: Invocation* pcsys_keys:: Keys* pcsys_monitor:: QEMU Monitor* disk_images:: Disk Images* pcsys_network:: Network emulation* direct_linux_boot:: Direct Linux Boot* pcsys_usb:: USB emulation* gdb_usage:: GDB usage* pcsys_os_specific:: Target OS specific information@end menu@node pcsys_introduction@section Introduction@c man begin DESCRIPTIONThe QEMU PC System emulator simulates thefollowing peripherals:@itemize @minus@item i440FX host PCI bridge and PIIX3 PCI to ISA bridge@itemCirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESAextensions (hardware level, including all non standard modes).@itemPS/2 mouse and keyboard@item 2 PCI IDE interfaces with hard disk and CD-ROM support@itemFloppy disk@item NE2000 PCI network adapters@itemSerial ports@itemCreative SoundBlaster 16 sound card@itemENSONIQ AudioPCI ES1370 sound card@itemAdlib(OPL2) - Yamaha YM3812 compatible chip@itemPCI UHCI USB controller and a virtual USB hub.@end itemizeSMP is supported with up to 255 CPUs.Note that adlib is only available when QEMU was configured with-enable-adlibQEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPLVGA BIOS.QEMU uses YM3812 emulation by Tatsuyuki Satoh.@c man end@node pcsys_quickstart@section Quick StartDownload and uncompress the linux image (@file{linux.img}) and type:@exampleqemu linux.img@end exampleLinux should boot and give you a prompt.@node sec_invocation@section Invocation@example@c man begin SYNOPSISusage: qemu [options] [disk_image]@c man end@end example@c man begin OPTIONS@var{disk_image} is a raw hard disk image for IDE hard disk 0.General options:@table @option@item -M machineSelect the emulated machine (@code{-M ?} for list)@item -fda file@item -fdb fileUse @var{file} as floppy disk 0/1 image (@pxref{disk_images}). You canuse the host floppy by using @file{/dev/fd0} as filename (@pxref{host_drives}).@item -hda file@item -hdb file@item -hdc file@item -hdd fileUse @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).@item -cdrom fileUse @var{file} as CD-ROM image (you cannot use @option{-hdc} and and@option{-cdrom} at the same time). You can use the host CD-ROM byusing @file{/dev/cdrom} as filename (@pxref{host_drives}).@item -boot [a|c|d|n]Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk bootis the default.@item -snapshotWrite to temporary files instead of disk image files. In this case,the raw disk image you use is not written back. You can however forcethe write back by pressing @key{C-a s} (@pxref{disk_images}).@item -no-fd-bootchkDisable boot signature checking for floppy disks in Bochs BIOS. It maybe needed to boot from old floppy disks.@item -m megsSet virtual RAM size to @var{megs} megabytes. Default is 128 MB.@item -smp nSimulate an SMP system with @var{n} CPUs. On the PC target, up to 255CPUs are supported.@item -nographicNormally, QEMU uses SDL to display the VGA output. With this option,you can totally disable graphical output so that QEMU is a simplecommand line application. The emulated serial port is redirected onthe console. Therefore, you can still use QEMU to debug a Linux kernelwith a serial console.@item -vnc displayNormally, QEMU uses SDL to display the VGA output. With this option,you can have QEMU listen on VNC display @var{display} and redirect the VGAdisplay over the VNC session. It is very useful to enable the usbtablet device when using this option (option @option{-usbdevicetablet}). When using the VNC display, you must use the @option{-k}option to set the keyboard layout if you are not using en-us.@var{display} may be in the form @var{interface:d}, in which case connectionswill only be allowed from @var{interface} on display @var{d}. Optionally,@var{interface} can be omitted. @var{display} can also be in the form@var{unix:path} where @var{path} is the location of a unix socket to listen forconnections on.@item -k languageUse keyboard layout @var{language} (for example @code{fr} forFrench). This option is only needed where it is not easy to get raw PCkeycodes (e.g. on Macs, with some X11 servers or with a VNCdisplay). You don't normally need to use it on PC/Linux or PC/Windowshosts.The available layouts are:@examplear de-ch es fo fr-ca hu ja mk no pt-br svda en-gb et fr fr-ch is lt nl pl ru thde en-us fi fr-be hr it lv nl-be pt sl tr@end exampleThe default is @code{en-us}.@item -audio-helpWill show the audio subsystem help: list of drivers, tunableparameters.@item -soundhw card1,card2,... or -soundhw allEnable audio and selected sound hardware. Use ? to print allavailable sound hardware.@exampleqemu -soundhw sb16,adlib hdaqemu -soundhw es1370 hdaqemu -soundhw all hdaqemu -soundhw ?@end example@item -localtimeSet the real time clock to local time (the default is to UTCtime). This option is needed to have correct date in MS-DOS orWindows.@item -full-screenStart in full screen.@item -pidfile fileStore the QEMU process PID in @var{file}. It is useful if you launch QEMUfrom a script.@item -daemonizeDaemonize the QEMU process after initialization. QEMU will not detach fromstandard IO until it is ready to receive connections on any of its devices.This option is a useful way for external programs to launch QEMU without havingto cope with initialization race conditions.@item -win2k-hackUse it when installing Windows 2000 to avoid a disk full bug. AfterWindows 2000 is installed, you no longer need this option (this optionslows down the IDE transfers).@item -option-rom fileLoad the contents of file as an option ROM. This option is useful to loadthings like EtherBoot.@end tableUSB options:@table @option@item -usbEnable the USB driver (will be the default soon)@item -usbdevice devnameAdd the USB device @var{devname}. @xref{usb_devices}.@end tableNetwork options:@table @option@item -net nic[,vlan=n][,macaddr=addr][,model=type]Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}= 0 is the default). The NIC is currently an NE2000 on the PCtarget. Optionally, the MAC address can be changed. If no@option{-net} option is specified, a single NIC is created.Qemu can emulate several different models of network card. Valid values for@var{type} are @code{ne2k_pci}, @code{ne2k_isa}, @code{rtl8139},@code{smc91c111} and @code{lance}. Not all devices are supported on alltargets.@item -net user[,vlan=n][,hostname=name]Use the user mode network stack which requires no administratorpriviledge to run. @option{hostname=name} can be used to specify the clienthostname reported by the builtin DHCP server.@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]Connect the host TAP network interface @var{name} to VLAN @var{n} anduse the network script @var{file} to configure it. The defaultnetwork script is @file{/etc/qemu-ifup}. Use @option{script=no} todisable script execution. If @var{name} is notprovided, the OS automatically provides one. @option{fd=h} can beused to specify the handle of an already opened host TAP interface. Example:@exampleqemu linux.img -net nic -net tap@end exampleMore complicated example (two NICs, each one connected to a TAP device)@exampleqemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ -net nic,vlan=1 -net tap,vlan=1,ifname=tap1@end example@item -net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]Connect the VLAN @var{n} to a remote VLAN in another QEMU virtualmachine using a TCP socket connection. If @option{listen} isspecified, QEMU waits for incoming connections on @var{port}(@var{host} is optional). @option{connect} is used to connect toanother QEMU instance using the @option{listen} option. @option{fd=h}specifies an already opened TCP socket.Example:@example# launch a first QEMU instanceqemu 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 instanceqemu linux.img -net nic,macaddr=52:54:00:12:34:57 \ -net socket,connect=127.0.0.1:1234@end example@item -net socket[,vlan=n][,fd=h][,mcast=maddr:port]Create a VLAN @var{n} shared with another QEMU virtualmachines using a UDP multicast socket, effectively making a bus for every QEMU with same multicast address @var{maddr} and @var{port}.NOTES:@enumerate@item Several QEMU can be running on different hosts and share same bus (assuming correct multicast setup for these hosts).@itemmcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see@url{http://user-mode-linux.sf.net}.@item Use @option{fd=h} to specify an already opened UDP multicast socket.@end enumerateExample:@example# launch one QEMU instanceqemu 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@end exampleExample (User Mode Linux compat.):@example# 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@end example@item -net noneIndicate that no network devices should be configured. It is used tooverride the default configuration (@option{-net nic -net user}) whichis activated if no @option{-net} options are provided.@item -tftp prefixWhen using the user mode network stack, activate a built-in TFTPserver. All filenames beginning with @var{prefix} can be downloadedfrom the host to the guest using a TFTP client. The TFTP client on theguest must be configured in binary mode (use the command @code{bin} ofthe Unix TFTP client). The host IP address on the guest is as usual10.0.2.2.@item -smb dirWhen using the user mode network stack, activate a built-in SMBserver so that Windows OSes can access to the host files in @file{dir}transparently.In the guest Windows OS, the line:@example10.0.2.4 smbserver@end examplemust be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).Then @file{dir} can be accessed in @file{\\smbserver\qemu}.Note that a SAMBA server must be installed on the host OS in@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd version2.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.@item -redir [tcp|udp]:host-port:[guest-host]:guest-portWhen using the user mode network stack, redirect incoming TCP or UDPconnections to the host port @var{host-port} to the guest@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}is not specified, its value is 10.0.2.15 (default address given by thebuilt-in DHCP server).For example, to redirect host X11 connection from screen 1 to guestscreen 0, use the following:@example# on the hostqemu -redir tcp:6001::6000 [...]# this host xterm should open in the guest X11 serverxterm -display :1@end exampleTo redirect telnet connections from host port 5555 to telnet port onthe guest, use the following:@example# on the hostqemu -redir tcp:5555::23 [...]telnet localhost 5555@end exampleThen when you use on the host @code{telnet localhost 5555}, youconnect to the guest telnet server.@end tableLinux boot specific: When using these options, you can use a givenLinux kernel without installing it in the disk image. It can be usefulfor easier testing of various kernels.@table @option@item -kernel bzImage Use @var{bzImage} as kernel image.@item -append cmdline Use @var{cmdline} as kernel command line@item -initrd fileUse @var{file} as initial ram disk.@end table
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -