📄 qemu-doc.texi
字号:
Debug/Expert options:@table @option@item -serial devRedirect the virtual serial port to host character device@var{dev}. The default device is @code{vc} in graphical mode and@code{stdio} in non graphical mode.This option can be used several times to simulate up to 4 serialsports.Use @code{-serial none} to disable all serial ports.Available character devices are:@table @code@item vcVirtual console@item pty[Linux only] Pseudo TTY (a new PTY is automatically allocated)@item noneNo device is allocated.@item nullvoid device@item /dev/XXX[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial portparameters are set according to the emulated ones.@item /dev/parportN[Linux only, parallel port only] Use host parallel port@var{N}. Currently only SPP parallel port features can be used.@item file:filenameWrite output to filename. No character can be read.@item stdio[Unix only] standard input/output@item pipe:filenamename pipe @var{filename}@item COMn[Windows only] Use host serial port @var{n}@item udp:[remote_host]:remote_port[@@[src_ip]:src_port]This implements UDP Net Console. When @var{remote_host} or @var{src_ip} are not specified they default to @code{0.0.0.0}. When not using a specifed @var{src_port} a random port is automatically chosen.If you just want a simple readonly console you can use @code{netcat} or@code{nc}, by starting qemu with: @code{-serial udp::4555} and nc as:@code{nc -u -l -p 4555}. Any time qemu writes something to that port itwill appear in the netconsole session.If you plan to send characters back via netconsole or you want to stopand start qemu a lot of times, you should have qemu use the samesource port each time by using something like @code{-serialudp::4555@@:4556} to qemu. Another approach is to use a patchedversion of netcat which can listen to a TCP port and send and receivecharacters via udp. If you have a patched version of netcat whichactivates telnet remote echo and single char transfer, then you canuse the following options to step up a netcat redirector to allowtelnet on port 5555 to access the qemu port.@table @code@item Qemu Options:-serial udp::4555@@:4556@item netcat options:-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T@item telnet options:localhost 5555@end table@item tcp:[host]:port[,server][,nowait][,nodelay]The TCP Net Console has two modes of operation. It can send the serialI/O to a location or wait for a connection from a location. By defaultthe TCP Net Console is sent to @var{host} at the @var{port}. If you usethe @var{server} option QEMU will wait for a client socket applicationto connect to the port before continuing, unless the @code{nowait}option was specified. The @code{nodelay} option disables the Nagle bufferingalgoritm. If @var{host} is omitted, 0.0.0.0 is assumed. Onlyone TCP connection at a time is accepted. You can use @code{telnet} toconnect to the corresponding character device.@table @code@item Example to send tcp console to 192.168.0.2 port 4444-serial tcp:192.168.0.2:4444@item Example to listen and wait on port 4444 for connection-serial tcp::4444,server@item Example to not wait and listen on ip 192.168.0.100 port 4444-serial tcp:192.168.0.100:4444,server,nowait@end table@item telnet:host:port[,server][,nowait][,nodelay]The telnet protocol is used instead of raw tcp sockets. The optionswork the same as if you had specified @code{-serial tcp}. Thedifference is that the port acts like a telnet server or client usingtelnet option negotiation. This will also allow you to send theMAGIC_SYSRQ sequence if you use a telnet that supports sending the breaksequence. Typically in unix telnet you do it with Control-] and thentype "send break" followed by pressing the enter key.@item unix:path[,server][,nowait]A unix domain socket is used instead of a tcp socket. The option works thesame as if you had specified @code{-serial tcp} except the unix domain socket@var{path} is used for connections.@end table@item -parallel devRedirect the virtual parallel port to host device @var{dev} (samedevices as the serial port). On Linux hosts, @file{/dev/parportN} canbe used to use hardware devices connected on the corresponding hostparallel port.This option can be used several times to simulate up to 3 parallelports.Use @code{-parallel none} to disable all parallel ports.@item -monitor devRedirect the monitor to host device @var{dev} (same devices as theserial port).The default device is @code{vc} in graphical mode and @code{stdio} innon graphical mode.@item -sWait gdb connection to port 1234 (@pxref{gdb_usage}). @item -p portChange gdb connection port. @var{port} can be either a decimal numberto specify a TCP port, or a host device (same devices as the serial port).@item -SDo not start CPU at startup (you must type 'c' in the monitor).@item -d Output log in /tmp/qemu.log@item -hdachs c,h,s,[,t]Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOStranslation mode (@var{t}=none, lba or auto). Usually QEMU can guessall thoses parameters. This option is useful for old MS-DOS diskimages.@item -L pathSet the directory for the BIOS, VGA BIOS and keymaps.@item -std-vgaSimulate a standard VGA card with Bochs VBE extensions (default isCirrus Logic GD5446 PCI VGA). If your guest OS supports the VESA 2.0VBE extensions (e.g. Windows XP) and if you want to use highresolution modes (>= 1280x1024x16) then you should use this option.@item -no-acpiDisable ACPI (Advanced Configuration and Power Interface) support. Useit if your guest OS complains about ACPI problems (PC target machineonly).@item -no-rebootExit instead of rebooting.@item -loadvm fileStart right away with a saved state (@code{loadvm} in monitor)@item -semihostingEnable "Angel" semihosting interface (ARM target machines only).Note that this allows guest direct access to the host filesystem,so should only be used with trusted guest OS.@end table@c man end@node pcsys_keys@section Keys@c man begin OPTIONSDuring the graphical emulation, you can use the following keys:@table @key@item Ctrl-Alt-fToggle full screen@item Ctrl-Alt-nSwitch to virtual console 'n'. Standard console mappings are:@table @emph@item 1Target system display@item 2Monitor@item 3Serial port@end table@item Ctrl-AltToggle mouse and keyboard grab.@end tableIn the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.During emulation, if you are using the @option{-nographic} option, use@key{Ctrl-a h} to get terminal commands:@table @key@item Ctrl-a hPrint this help@item Ctrl-a x Exit emulator@item Ctrl-a s Save disk data back to file (if -snapshot)@item Ctrl-a bSend break (magic sysrq in Linux)@item Ctrl-a cSwitch between console and monitor@item Ctrl-a Ctrl-aSend Ctrl-a@end table@c man end@ignore@c man begin SEEALSOThe HTML documentation of QEMU for more precise information and Linuxuser mode emulator invocation.@c man end@c man begin AUTHORFabrice Bellard@c man end@end ignore@node pcsys_monitor@section QEMU MonitorThe QEMU monitor is used to give complex commands to the QEMUemulator. You can use it to:@itemize @minus@itemRemove or insert removable medias images(such as CD-ROM or floppies)@item Freeze/unfreeze the Virtual Machine (VM) and save or restore its statefrom a disk file.@item Inspect the VM state without an external debugger.@end itemize@subsection CommandsThe following commands are available:@table @option@item help or ? [cmd]Show the help for all commands or just for command @var{cmd}.@item commit Commit changes to the disk images (if -snapshot is used)@item info subcommand show various information about the system state@table @option@item info networkshow the various VLANs and the associated devices@item info blockshow the block devices@item info registersshow the cpu registers@item info historyshow the command line history@item info pcishow emulated PCI device@item info usbshow USB devices plugged on the virtual USB hub@item info usbhostshow all USB host devices@item info captureshow information about active capturing@item info snapshotsshow list of VM snapshots@item info miceshow which guest mouse is receiving events@end table@item q or quitQuit the emulator.@item eject [-f] deviceEject a removable media (use -f to force it).@item change device filenameChange a removable media.@item screendump filenameSave screen into PPM image @var{filename}.@item mouse_move dx dy [dz]Move the active mouse to the specified coordinates @var{dx} @var{dy}with optional scroll axis @var{dz}.@item mouse_button valChange the active mouse button state @var{val} (1=L, 2=M, 4=R).@item mouse_set indexSet which mouse device receives events at given @var{index}, indexcan be obtained with@exampleinfo mice@end example@item wavcapture filename [frequency [bits [channels]]]Capture audio into @var{filename}. Using sample rate @var{frequency}bits per sample @var{bits} and number of channels @var{channels}.Defaults:@itemize @minus@item Sample rate = 44100 Hz - CD quality@item Bits = 16@item Number of channels = 2 - Stereo@end itemize@item stopcapture indexStop capture with a given @var{index}, index can be obtained with@exampleinfo capture@end example@item log item1[,...]Activate logging of the specified items to @file{/tmp/qemu.log}.@item savevm [tag|id]Create a snapshot of the whole virtual machine. If @var{tag} isprovided, it is used as human readable identifier. If there is alreadya snapshot with the same tag or ID, it is replaced. More info at@ref{vm_snapshots}.@item loadvm tag|idSet the whole virtual machine to the snapshot identified by the tag@var{tag} or the unique snapshot ID @var{id}.@item delvm tag|idDelete the snapshot identified by @var{tag} or @var{id}.@item stopStop emulation.@item c or contResume emulation.@item gdbserver [port]Start gdbserver session (default port=1234)@item x/fmt addrVirtual memory dump starting at @var{addr}.@item xp /fmt addrPhysical memory dump starting at @var{addr}.@var{fmt} is a format which tells the command how to format thedata. Its syntax is: @option{/@{count@}@{format@}@{size@}}@table @var@item count is the number of items to be dumped.@item formatcan be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),c (char) or i (asm instruction).@item sizecan be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,@code{h} or @code{w} can be specified with the @code{i} format torespectively select 16 or 32 bit code instruction size.@end tableExamples: @itemize@itemDump 10 instructions at the current instruction pointer:@example (qemu) x/10i $eip0x90107063: ret0x90107064: sti0x90107065: lea 0x0(%esi,1),%esi0x90107069: lea 0x0(%edi,1),%edi0x90107070: ret0x90107071: jmp 0x901070800x90107073: nop0x90107074: nop0x90107075: nop0x90107076: nop@end example@itemDump 80 16 bit values at the start of the video memory.@smallexample (qemu) xp/80hx 0xb80000x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b420x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b410x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b720x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b730x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b200x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x07200x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x07200x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x07200x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x07200x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720@end smallexample@end itemize@item p or print/fmt exprPrint expression value. Only the @var{format} part of @var{fmt} isused.@item sendkey keysSend @var{keys} to the emulator. Use @code{-} to press several keyssimultaneously. Example:@examplesendkey ctrl-alt-f1@end exampleThis command is useful to send keys that your graphical user interfaceintercepts at low level, such as @code{ctrl-alt-f1} in X Window.@item system_resetReset the system.@item usb_add devnameAdd the USB device @var{devname}. For details of available devices see@ref{usb_devices}@item usb_del devnameRemove the USB device @var{devname} from the QEMU virtual USBhub. @var{devname} has the syntax @code{bus.addr}. Use the monitorcommand @code{info usb} to see the devices you can remove.@end table@subsection Integer expressionsThe monitor understands integers expressions for every integerargument. You can use register names to get the value of specificsCPU registers by prefixing them with @emph{$}.@node disk_images@section Disk ImagesSince version 0.6.1, QEMU supports many disk image formats, includinggrowable disk images (their size increase as non empty sectors arewritten), compressed and encrypted disk images. Version 0.8.3 addedthe new qcow2 disk image format which is essential to support VMsnapshots.@menu* disk_images_quickstart:: Quick start for disk image creation* disk_images_snapshot_mode:: Snapshot mode* vm_snapshots:: VM snapshots* qemu_img_invocation:: qemu-img Invocation* host_drives:: Using host drives* disk_images_fat_images:: Virtual FAT disk images@end menu@node disk_images_quickstart@subsection Quick start for disk image creationYou can create a disk image with the command:@exampleqemu-img create myimage.img mysize@end examplewhere @var{myimage.img} is the disk image filename and @var{mysize} is itssize in kilobytes. You can add an @code{M} suffix to give the size inmegabytes and a @code{G} suffix for gigabytes.See @ref{qemu_img_invocation} for more information.@node disk_images_snapshot_mode@subsection Snapshot modeIf you use the option @option{-snapshot}, all disk images areconsidered as read only. When sectors in written, they are written ina temporary file created in @file{/tmp}. You can however force thewrite back to the raw disk images by using the @code{commit} monitorcommand (or @key{C-a s} in the serial console).@node vm_snapshots@subsection VM snapshotsVM snapshots are snapshots of the complete virtual machine includingCPU state, RAM, device state and the content of all the writabledisks. In order to use VM snapshots, you must have at least one nonremovable and writable block device using the @code{qcow2} disk imageformat. Normally this device is the first virtual hard drive.Use the monitor command @code{savevm} to create a new VM snapshot orreplace an existing one. A human readable name can be assigned to eachsnapshot in addition to its numerical ID.Use @code{loadvm} to restore a VM snapshot and @code{delvm} to removea VM snapshot. @code{info snapshots} lists the available snapshotswith their associated information:@example(qemu) info snapshotsSnapshot devices: hdaSnapshot list (from hda):ID TAG VM SIZE DATE VM CLOCK1 start 41M 2006-08-06 12:38:02 00:00:14.9542 40M 2006-08-06 12:43:29 00:00:18.6333 msys 40M 2006-08-06 12:44:04 00:00:23.514@end exampleA VM snapshot is made of a VM state info (its size is shown in@code{info snapshots}) and a snapshot of every writable disk image.The VM state info is stored in the first @code{qcow2} non removableand writable block device. The disk image snapshots are stored in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -