⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qemu-doc.texi

📁 QEMU 0.91 source code, supports ARM processor including S3C24xx series
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@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 inevery disk image. The size of a snapshot in a disk image is difficultto evaluate and is not shown by @code{info snapshots} because theassociated disk sectors are shared among all the snapshots to savedisk space (otherwise each snapshot would need a full copy of all thedisk images).When using the (unrelated) @code{-snapshot} option(@ref{disk_images_snapshot_mode}), you can always make VM snapshots,but they are deleted as soon as you exit QEMU.VM snapshots currently have the following known limitations:@itemize@itemThey cannot cope with removable devices if they are removed orinserted after a snapshot is done.@itemA few device drivers still have incomplete snapshot support so theirstate is not saved or restored properly (in particular USB).@end itemize@node qemu_img_invocation@subsection @code{qemu-img} Invocation@include qemu-img.texi@node host_drives@subsection Using host drivesIn addition to disk image files, QEMU can directly access hostdevices. We describe here the usage for QEMU version >= 0.8.3.@subsubsection LinuxOn Linux, you can directly use the host device filename instead of adisk image filename provided you have enough privileges to accessit. For example, use @file{/dev/cdrom} to access to the CDROM or@file{/dev/fd0} for the floppy.@table @code@item CDYou can specify a CDROM device even if no CDROM is loaded. QEMU hasspecific code to detect CDROM insertion or removal. CDROM ejection bythe guest OS is supported. Currently only data CDs are supported.@item FloppyYou can specify a floppy device even if no floppy is loaded. Floppyremoval is currently not detected accurately (if you change floppywithout doing floppy access while the floppy is not loaded, the guestOS will think that the same floppy is loaded).@item Hard disksHard disks can be used. Normally you must specify the whole disk(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS cansee it as a partitioned disk. WARNING: unless you know what you do, itis better to only make READ-ONLY accesses to the hard disk otherwiseyou may corrupt your host data (use the @option{-snapshot} commandline option or modify the device permissions accordingly).@end table@subsubsection Windows@table @code@item CDThe preferred syntax is the drive letter (e.g. @file{d:}). Thealternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} issupported as an alias to the first CDROM drive.Currently there is no specific code to handle removable media, so itis better to use the @code{change} or @code{eject} monitor commands tochange or eject media.@item Hard disksHard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}where @var{N} is the drive number (0 is the first hard disk).WARNING: unless you know what you do, it is better to only makeREAD-ONLY accesses to the hard disk otherwise you may corrupt yourhost data (use the @option{-snapshot} command line so that themodifications are written in a temporary file).@end table@subsubsection Mac OS X@file{/dev/cdrom} is an alias to the first CDROM.Currently there is no specific code to handle removable media, so itis better to use the @code{change} or @code{eject} monitor commands tochange or eject media.@node disk_images_fat_images@subsection Virtual FAT disk imagesQEMU can automatically create a virtual FAT disk image from adirectory tree. In order to use it, just type:@exampleqemu linux.img -hdb fat:/my_directory@end exampleThen you access access to all the files in the @file{/my_directory}directory without having to copy them in a disk image or to exportthem via SAMBA or NFS. The default access is @emph{read-only}.Floppies can be emulated with the @code{:floppy:} option:@exampleqemu linux.img -fda fat:floppy:/my_directory@end exampleA read/write support is available for testing (beta stage) with the@code{:rw:} option:@exampleqemu linux.img -fda fat:floppy:rw:/my_directory@end exampleWhat you should @emph{never} do:@itemize@item use non-ASCII filenames ;@item use "-snapshot" together with ":rw:" ;@item expect it to work when loadvm'ing ;@item write to the FAT directory on the host system while accessing it with the guest system.@end itemize@node pcsys_network@section Network emulationQEMU can simulate several network cards (PCI or ISA cards on the PCtarget) and can connect them to an arbitrary number of Virtual LocalArea Networks (VLANs). Host TAP devices can be connected to any QEMUVLAN. VLAN can be connected between separate instances of QEMU tosimulate large networks. For simpler usage, a non privileged user modenetwork stack can replace the TAP device to have a basic networkconnection.@subsection VLANsQEMU simulates several VLANs. A VLAN can be symbolised as a virtualconnection between several network devices. These devices can be forexample QEMU virtual Ethernet cards or virtual Host ethernet devices(TAP devices).@subsection Using TAP network interfacesThis is the standard way to connect QEMU to a real network. QEMU addsa virtual network device on your host (called @code{tapN}), and youcan then configure it as if it was a real ethernet card.@subsubsection Linux hostAs an example, you can download the @file{linux-test-xxx.tar.gz}archive and copy the script @file{qemu-ifup} in @file{/etc} andconfigure properly @code{sudo} so that the command @code{ifconfig}contained in @file{qemu-ifup} can be executed as root. You must verifythat your host kernel supports the TAP network interfaces: thedevice @file{/dev/net/tun} must be present.See @ref{sec_invocation} to have examples of command lines using theTAP network interfaces.@subsubsection Windows hostThere is a virtual ethernet driver for Windows 2000/XP systems, calledTAP-Win32. But it is not included in standard QEMU for Windows,so you will need to get it separately. It is part of OpenVPN package,so download OpenVPN from : @url{http://openvpn.net/}.@subsection Using the user mode network stackBy using the option @option{-net user} (default configuration if no@option{-net} option is specified), QEMU uses a completely user modenetwork stack (you don't need root privilege to use the virtualnetwork). The virtual network configuration is the following:@example         QEMU VLAN      <------>  Firewall/DHCP server <-----> Internet                           |          (10.0.2.2)                           |                           ---->  DNS server (10.0.2.3)                           |                           ---->  SMB server (10.0.2.4)@end exampleThe QEMU VM behaves as if it was behind a firewall which blocks allincoming connections. You can use a DHCP client to automaticallyconfigure the network in the QEMU VM. The DHCP server assign addressesto the hosts starting from 10.0.2.15.In order to check that the user mode network is working, you can pingthe address 10.0.2.2 and verify that you got an address in the range10.0.2.x from the QEMU virtual DHCP server.Note that @code{ping} is not supported reliably to the internet as itwould require root privileges. It means you can only ping the localrouter (10.0.2.2).When using the built-in TFTP server, the router is also the TFTPserver.When using the @option{-redir} option, TCP or UDP connections can beredirected from the host to the guest. It allows for example toredirect X11, telnet or SSH connections.@subsection Connecting VLANs between QEMU instancesUsing the @option{-net socket} option, it is possible to make VLANsthat span several QEMU instances. See @ref{sec_invocation} to have abasic example.@node direct_linux_boot@section Direct Linux BootThis section explains how to launch a Linux kernel inside QEMU withouthaving to make a full bootable image. It is very useful for fast Linuxkernel testing.The syntax is:@exampleqemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"@end exampleUse @option{-kernel} to provide the Linux kernel image and@option{-append} to give the kernel command line arguments. The@option{-initrd} option can be used to provide an INITRD image.When using the direct Linux boot, a disk image for the first hard disk@file{hda} is required because its boot sector is used to launch theLinux kernel.If you do not need graphical output, you can disable it and redirectthe virtual serial port and the QEMU monitor to the console with the@option{-nographic} option. The typical command line is:@exampleqemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \     -append "root=/dev/hda console=ttyS0" -nographic@end exampleUse @key{Ctrl-a c} to switch between the serial console and themonitor (@pxref{pcsys_keys}).@node pcsys_usb@section USB emulationQEMU emulates a PCI UHCI USB controller. You can virtually plugvirtual USB devices or real host USB devices (experimental, works onlyon Linux hosts).  Qemu will automatically create and connect virtual USB hubsas necessary to connect multiple USB devices.@menu* usb_devices::* host_usb_devices::@end menu@node usb_devices@subsection Connecting USB devicesUSB devices can be connected with the @option{-usbdevice} commandline optionor the @code{usb_add} monitor command.  Available devices are:@table @var@item @code{mouse}Virtual Mouse.  This will override the PS/2 mouse emulation when activated.@item @code{tablet}Pointer device that uses absolute coordinates (like a touchscreen).This means qemu is able to report the mouse position without havingto grab the mouse.  Also overrides the PS/2 mouse emulation when activated.@item @code{disk:@var{file}}Mass storage device based on @var{file} (@pxref{disk_images})@item @code{host:@var{bus.addr}}Pass through the host device identified by @var{bus.addr}(Linux only)@item @code{host:@var{vendor_id:product_id}}Pass through the host device identified by @var{vendor_id:product_id}(Linux only)@item @code{wacom-tablet}Virtual Wacom PenPartner tablet.  This device is similar to the @code{tablet}above but it can be used with the tslib library because in addition to touchcoordinates it reports touch pressure.@item @code{keyboard}Standard USB keyboard.  Will override the PS/2 keyboard (if present).@end table@node host_usb_devices@subsection Using host USB devices on a Linux hostWARNING: this is an experimental feature. QEMU will slow down whenusing it. USB devices requiring real time streaming (i.e. USB VideoCameras) are not supported yet.@enumerate@item If you use an early Linux 2.4 kernel, verify that no Linux driveris actually using the USB device. A simple way to do that is simply todisable the corresponding kernel module by renaming it from @file{mydriver.o}to @file{mydriver.o.disabled}.@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:@examplels /proc/bus/usb001  devices  drivers@end example@item Since only root can access to the USB devices directly, you can either launch QEMU as root or change the permissions of the USB devices you want to use. For testing, the following suffices:@examplechown -R myuid /proc/bus/usb@end example@item Launch QEMU and do in the monitor:@exampleinfo usbhost  Device 1.2, speed 480 Mb/s    Class 00: USB device 1234:5678, USB DISK@end exampleYou should see the list of the devices you can use (Never try to usehubs, it won't work).@item Add the device in QEMU by using:@exampleusb_add host:1234:5678@end exampleNormally the guest OS should report that a new USB device isplugged. You can use the option @option{-usbdevice} to do the same.@item Now you can try to use the host USB device in QEMU.@end enumerateWhen relaunching QEMU, you may have to unplug and plug again the USBdevice to make it work again (this is a bug).@node vnc_security@section VNC securityThe VNC server capability provides access to the graphical consoleof the guest VM across the network. This has a number of securityconsiderations depending on the deployment scenarios.@menu* vnc_sec_none::* vnc_sec_password::* vnc_sec_certificate::* vnc_sec_certificate_verify::* vnc_sec_certificate_pw::* vnc_generate_cert::@end menu@node vnc_sec_none@subsection Without passwordsThe simplest VNC server setup does not include any form of authentication.For this setup it is recommended to restrict it to listen on a UNIX domainsocket only. For example@exampleqemu [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -