logo资料库

qemu参数说明.pdf

第1页 / 共68页
第2页 / 共68页
第3页 / 共68页
第4页 / 共68页
第5页 / 共68页
第6页 / 共68页
第7页 / 共68页
第8页 / 共68页
资料共68页,剩余部分请下载后查看
qemu.weilnetz.de
QEMU Emulator User Documentation
QEMU Emulator User Documentation QEMU Emulator User Documentation Table of Contents QEMU Emulator User Documentation 1 Introduction 1.1 Features 2 Installation 2.1 Linux 2.2 Windows 2.3 Mac OS X 3 QEMU PC System emulator 3.1 Introduction 3.2 Quick Start 3.3 Invocation 3.4 Keys 3.5 QEMU Monitor 3.5.1 Commands 3.5.2 Integer expressions 3.6 Disk Images 3.6.1 Quick start for disk image creation 3.6.2 Snapshot mode 3.6.3 VM snapshots 3.6.4 qemu-img Invocation 3.6.5 qemu-nbd Invocation 3.6.6 Using host drives 3.6.6.1 Linux 3.6.6.2 Windows 3.6.6.3 Mac OS X 3.6.7 Virtual FAT disk images 3.6.8 NBD access 3.6.9 Sheepdog disk images 3.7 Network emulation 3.7.1 VLANs 3.7.2 Using TAP network interfaces 3.7.2.1 Linux host 3.7.2.2 Windows host 3.7.3 Using the user mode network stack 3.7.4 Connecting VLANs between QEMU instances 3.8.1 Inter-VM Shared Memory device 3.8 Other Devices 3.9 Direct Linux Boot 3.10 USB emulation 3.11 VNC security 3.10.1 Connecting USB devices 3.10.2 Using host USB devices on a Linux host 3.11.1 Without passwords 3.11.2 With passwords 3.11.3 With x509 certificates 3.11.4 With x509 certificates and client verification 3.11.5 With x509 certificates, client verification and passwords 3.11.6 With SASL authentication 3.11.7 With x509 certificates and SASL authentication 3.11.8 Generating certificates for VNC http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
QEMU Emulator User Documentation 3.11.8.1 Setup the Certificate Authority 3.11.8.2 Issuing server certificates 3.11.8.3 Issuing client certificates 3.11.9 Configuring SASL mechanisms 3.12 GDB usage 3.13 Target OS specific information 3.13.1 Linux 3.13.2 Windows 3.13.2.1 SVGA graphic modes support 3.13.2.2 CPU usage reduction 3.13.2.3 Windows 2000 disk full problem 3.13.2.4 Windows 2000 shutdown 3.13.2.5 Share a directory between Unix and Windows 3.13.2.6 Windows XP security problem 3.13.3 MS-DOS and FreeDOS 3.13.3.1 CPU usage reduction 4 QEMU System emulator for non PC targets 4.1 PowerPC System emulator 4.2 Sparc32 System emulator 4.3 Sparc64 System emulator 4.4 MIPS System emulator 4.5 ARM System emulator 4.6 ColdFire System emulator 4.7 Cris System emulator 4.8 Microblaze System emulator 4.9 SH4 System emulator 4.10 Xtensa System emulator 5 QEMU User space emulator 5.1 Supported Operating Systems 5.2 Linux User space emulator 5.2.1 Quick Start 5.2.2 Wine launch 5.2.3 Command line options 5.2.4 Other binaries 5.3 Mac OS X/Darwin User space emulator 5.3.1 Mac OS X/Darwin Status 5.3.2 Quick Start 5.3.3 Command line options 5.4 BSD User space emulator 5.4.1 BSD Status 5.4.2 Quick Start 5.4.3 Command line options 6 Compilation from the sources 6.1 Linux/Unix 6.1.1 Compilation 6.2 Windows 6.3 Cross compilation for Windows with Linux 6.4 Mac OS X 6.5 Make targets Anhang A License Anhang B Index B.1 Concept Index B.2 Function Index B.3 Keystroke Index B.4 Program Index B.5 Data Type Index B.6 Variable Index http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
QEMU Emulator User Documentation 1 Introduction 1.1 Features QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation speed. QEMU has two operating modes: Full system emulation. In this mode, QEMU emulates a full system (for example a PC), including one or several processors and various peripherals. It can be used to launch different Operating Systems without rebooting the PC or to debug system code. User mode emulation. In this mode, QEMU can launch processes compiled for one CPU on another CPU. It can be used to launch the Wine Windows API emulator (http://www.winehq.org) or to ease cross-compilation and cross-debugging. QEMU can run without an host kernel driver and yet gives acceptable performance. For system emulation, the following hardware targets are supported: PC (x86 or x86_64 processor) ISA PC (old style PC without PCI bus) PREP (PowerPC processor) G3 Beige PowerMac (PowerPC processor) Mac99 PowerMac (PowerPC processor, in progress) Sun4m/Sun4c/Sun4d (32-bit Sparc processor) Sun4u/Sun4v (64-bit Sparc processor, in progress) Malta board (32-bit and 64-bit MIPS processors) MIPS Magnum (64-bit MIPS processor) ARM Integrator/CP (ARM) ARM Versatile baseboard (ARM) ARM RealView Emulation/Platform baseboard (ARM) Spitz, Akita, Borzoi, Terrier and Tosa PDAs (PXA270 processor) Luminary Micro LM3S811EVB (ARM Cortex-M3) Luminary Micro LM3S6965EVB (ARM Cortex-M3) Freescale MCF5208EVB (ColdFire V2). Arnewsh MCF5206 evaluation board (ColdFire V2). Palm Tungsten|E PDA (OMAP310 processor) N800 and N810 tablets (OMAP2420 processor) MusicPal (MV88W8618 ARM processor) Gumstix "Connex" and "Verdex" motherboards (PXA255/270). Siemens SX1 smartphone (OMAP310 processor) Syborg SVP base model (ARM Cortex-A8). AXIS-Devboard88 (CRISv32 ETRAX-FS). Petalogix Spartan 3aDSP1800 MMU ref design (MicroBlaze). Avnet LX60/LX110/LX200 boards (Xtensa) For user emulation, x86 (32 and 64 bit), PowerPC (32 and 64 bit), ARM, MIPS (32 bit only), Sparc (32 and 64 bit), Alpha, ColdFire(m68k), CRISv32 and MicroBlaze CPUs are supported. 2 Installation http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
QEMU Emulator User Documentation If you want to compile QEMU yourself, see compilation. 2.1 Linux If a precompiled package is available for your distribution - you just have to install it. Otherwise, see compilation. 2.2 Windows Download the experimental binary installer at http://www.free.oszoo.org/download.html. TODO (no longer available) 2.3 Mac OS X Download the experimental binary installer at http://www.free.oszoo.org/download.html. TODO (no longer available) 3 QEMU PC System emulator 3.1 Introduction The QEMU PC System emulator simulates the following peripherals: i440FX host PCI bridge and PIIX3 PCI to ISA bridge Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions (hardware level, including all non standard modes). PS/2 mouse and keyboard 2 PCI IDE interfaces with hard disk and CD-ROM support Floppy disk PCI and ISA network adapters Serial ports Creative SoundBlaster 16 sound card ENSONIQ AudioPCI ES1370 sound card Intel 82801AA AC97 Audio compatible sound card Intel HD Audio Controller and HDA codec Adlib (OPL2) - Yamaha YM3812 compatible chip Gravis Ultrasound GF1 sound card CS4231A compatible sound card PCI UHCI USB controller and a virtual USB hub. SMP is supported with up to 255 CPUs. Note that adlib, gus and cs4231a are only available when QEMU was configured with –audio-card-list option containing the name(s) of required card(s). QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL VGA BIOS. QEMU uses YM3812 emulation by Tatsuyuki Satoh. http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
QEMU Emulator User Documentation QEMU uses GUS emulation (GUSEMU32 http://www.deinmeister.de/gusemu/) by Tibor "TS" Schütz. Note that, by default, GUS shares IRQ(7) with parallel ports and so qemu must be told to not have parallel ports to have working GUS qemu dos.img -soundhw gus -parallel none Alternatively: qemu dos.img -device gus,irq=5 Or some other unclaimed IRQ. CS4231A is the chip used in Windows Sound System and GUSMAX products 3.2 Quick Start Download and uncompress the linux image (linux.img) and type: qemu linux.img Linux should boot and give you a prompt. 3.3 Invocation usage: qemu [options] [disk_image] disk_image is a raw hard disk image for IDE hard disk 0. Some targets do not need a disk image. Standard options: -h Display help and exit -version Display version information and exit -machine [type=]name[,prop=value[,...]] Select the emulated machine by name. Use -machine ? to list available machines. Supported machine properties are: accel=accels1[:accels2[:...]] This is used to enable an accelerator. Depending on the target architecture, kvm, xen, or tcg can be available. By default, tcg is used. If there is more than one accelerator specified, the next one is used if the previous one fails to initialize. -cpu model -smp n[,cores=cores][,threads=threads][,sockets=sockets][,maxcpus=maxcpus] Select CPU model (-cpu ? for list and additional feature selection) Simulate an SMP system with n CPUs. On the PC target, up to 255 CPUs are supported. On Sparc32 target, Linux limits the number of usable CPUs to 4. For the PC target, the number of cores per socket, the number of threads per cores and the total number of sockets can be specified. Missing values will be computed. If any on the three values is given, the total number of CPUs n can be omitted. maxcpus specifies the maximum number of hotpluggable CPUs. Simulate a multi node NUMA system. If mem and cpus are omitted, resources are split equally. -numa opts -fda file -fdb file http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
Use file as floppy disk 0/1 image (see disk_images). You can use the host floppy by using /dev/fd0 as filename (see host_drives). QEMU Emulator User Documentation -hda file -hdb file -hdc file -hdd file -cdrom file Use file as hard disk 0, 1, 2 or 3 image (see disk_images). Use file as CD-ROM image (you cannot use -hdc and -cdrom at the same time). You can use the host CD-ROM by using /dev/cdrom as filename (see host_drives). Define a new drive. Valid options are: -drive option[,option[,option[,...]]] file=file This option defines which disk image (see disk_images) to use with this drive. If the filename contains comma, you must double it (for instance, "file=my,,file" to use file "my,file"). Special files such as iSCSI devices can be specified using protocol specific URLs. See the section for "Device URL Syntax" for more information. if=interface bus=bus,unit=unit index=index media=media cyls=c,heads=h,secs=s[,trans=t] snapshot=snapshot cache=cache This option defines on which type on interface the drive is connected. Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio. These options define where is connected the drive by defining the bus number and the unit id. This option defines where is connected the drive by using an index in the list of available connectors of a given interface type. This option defines the type of the media: disk or cdrom. These options have the same definition as they have in -hdachs. snapshot is "on" or "off" and allows to enable snapshot for given drive (see -snapshot). cache is "none", "writeback", "unsafe", "directsync" or "writethrough" and controls how the host cache is used to access block data. aio is "threads", or "native" and selects between pthread based disk I/O and native Linux AIO. Specify which disk format will be used rather than detecting the format. Can be used to specifiy format=raw to avoid interpreting an untrusted format header. This option specifies the serial number to assign to the device. Specify the controller's PCI address (if=virtio only). Specify which action to take on write and read errors. Valid actions are: "ignore" (ignore the error and try to continue), "stop" (pause QEMU), "report" (report the error to the guest), "enospc" (pause QEMU only if the host disk is full; report the error to the guest otherwise). The default setting is werror=enospc and rerror=report. Open drive file as read-only. Guest write attempts will fail. serial=serial addr=addr werror=action,rerror=action aio=aio format=format readonly By default, writethrough caching is used for all block device. This means that the host page cache will be used to read and write data but write notification will be sent to the guest only when the data has been reported as written by the storage subsystem. Writeback caching will report data writes as completed as soon as the data is present in the host page cache. This is safe as long as you trust your host. If your host crashes or loses power, then the guest may experience data corruption. The host page cache can be avoided entirely with cache=none. This will attempt to do disk IO directly http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
QEMU Emulator User Documentation to the guests memory. QEMU may still perform an internal copy of the data. The host page cache can be avoided while only sending write notifications to the guest when the data has been reported as written by the storage subsystem using cache=directsync. Some block drivers perform badly with cache=writethrough, most notably, qcow2. If performance is more important than correctness, cache=writeback should be used with qcow2. In case you don't care about data integrity over host failures, use cache=unsafe. This option tells qemu that it never needs to write any data to the disk but can instead keeps things in cache. If anything goes wrong, like your host losing power, the disk storage getting disconnected accidently, etc. you're image will most probably be rendered unusable. When using the -snapshot option, unsafe caching is always used. Instead 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 -set -global -mtdblock file -sd file -pflash file -boot [order=drives][,once=drives][,menu=on|off][,splash=sp_name][,splash-time=sp_time] TODO TODO Use file as on-board Flash memory image. Use file as SecureDigital card image. Use file as a parallel flash image. Specify boot order drives as a string of drive letters. Valid drive letters depend on the target http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
QEMU Emulator User Documentation achitecture. The x86 PC uses: a, b (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p (Etherboot from network adapter 1-4), hard disk boot is the default. To apply a particular boot order only on the first startup, specify it via once. Interactive boot menus/prompts can be enabled via menu=on as far as firmware/BIOS supports them. The default is non-interactive boot. A splash picture could be passed to bios, enabling user to show it as logo, when option splash=sp_name is given and menu=on, If firmware/BIOS supports them. Currently Seabios for X86 system support it. limitation: The splash file could be a jpeg file or a BMP file in 24 BPP format(true color). The resolution should be supported by the SVGA mode, so the recommended is 320x240, 640x480, 800x640. # try to boot from network first, then from hard disk qemu -boot order=nc # boot from CD-ROM first, switch back to default order after reboot qemu -boot once=d # boot with a splash picture for 5 seconds. qemu -boot menu=on,splash=/root/boot.bmp,splash-time=5000 Note: The legacy format '-boot drives' is still supported but its use is discouraged as it may be removed from future versions. -snapshot -m megs Write to temporary files instead of disk image files. In this case, the raw disk image you use is not written back. You can however force the write back by pressing (see disk_images). Set virtual RAM size to megs megabytes. Default is 128 MiB. Optionally, a suffix of “M” or “G” can be used to signify a value in megabytes or gigabytes respectively. Allocate guest RAM from a temporarily created file in path. Preallocate memory when using -mem-path. Use keyboard layout language (for example fr 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. -mem-path path -mem-prealloc -k language 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. -audio-help -soundhw card1[,card2,...] or -soundhw all Will show the audio subsystem help: list of drivers, tunable parameters. Enable audio and selected sound hardware. Use ? to print all available sound hardware. qemu -soundhw sb16,adlib disk.img qemu -soundhw es1370 disk.img qemu -soundhw ac97 disk.img qemu -soundhw hda disk.img qemu -soundhw all disk.img qemu -soundhw ? Note that Linux's i810_audio OSS kernel (for AC97) module might require manually specifying clocking. modprobe i810_audio clocking=48000 USB options: http://qemu.weilnetz.de/qemu-doc.html[2011/12/28 11:01:16]
分享到:
收藏