QEMU Emulator User Documentation I
Total Page:16
File Type:pdf, Size:1020Kb
QEMU Emulator User Documentation i Table of Contents 1 Introduction ::::::::::::::::::::::::::::::::::::: 1 1.1 Features :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 1 2 Installation::::::::::::::::::::::::::::::::::::::: 3 2.1 Linux :::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 3 2.2 Windows ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 3 2.3 Mac OS X:::::::::::::::::::::::::::::::::::::::::::::::::::::: 3 3 QEMU PC System emulator ::::::::::::::::::: 4 3.1 Introduction :::::::::::::::::::::::::::::::::::::::::::::::::::: 4 3.2 Quick Start::::::::::::::::::::::::::::::::::::::::::::::::::::: 4 3.3 Invocation :::::::::::::::::::::::::::::::::::::::::::::::::::::: 5 3.4 Keys in the graphical frontends :::::::::::::::::::::::::::::::: 51 3.5 Keys in the character backend multiplexer ::::::::::::::::::::: 52 3.6 QEMU Monitor ::::::::::::::::::::::::::::::::::::::::::::::: 52 3.6.1 Commands ::::::::::::::::::::::::::::::::::::::::::::::: 52 3.6.2 Integer expressions:::::::::::::::::::::::::::::::::::::::: 63 3.7 Disk Images ::::::::::::::::::::::::::::::::::::::::::::::::::: 63 3.7.1 Quick start for disk image creation:::::::::::::::::::::::: 64 3.7.2 Snapshot mode ::::::::::::::::::::::::::::::::::::::::::: 64 3.7.3 VM snapshots :::::::::::::::::::::::::::::::::::::::::::: 64 3.7.4 qemu-img Invocation:::::::::::::::::::::::::::::::::::::: 65 3.7.5 qemu-nbd Invocation:::::::::::::::::::::::::::::::::::::: 73 3.7.6 qemu-ga Invocation ::::::::::::::::::::::::::::::::::::::: 75 3.7.7 Disk image file formats ::::::::::::::::::::::::::::::::::: 77 3.7.7.1 Read-only formats ::::::::::::::::::::::::::::::::::: 80 3.7.8 Using host drives ::::::::::::::::::::::::::::::::::::::::: 80 3.7.8.1 Linux:::::::::::::::::::::::::::::::::::::::::::::::: 81 3.7.8.2 Windows :::::::::::::::::::::::::::::::::::::::::::: 81 3.7.8.3 Mac OS X ::::::::::::::::::::::::::::::::::::::::::: 81 3.7.9 Virtual FAT disk images :::::::::::::::::::::::::::::::::: 81 3.7.10 NBD access ::::::::::::::::::::::::::::::::::::::::::::: 82 3.7.11 Sheepdog disk images:::::::::::::::::::::::::::::::::::: 82 3.7.12 iSCSI LUNs ::::::::::::::::::::::::::::::::::::::::::::: 83 3.7.13 GlusterFS disk images ::::::::::::::::::::::::::::::::::: 85 3.7.14 Secure Shell (ssh) disk images:::::::::::::::::::::::::::: 85 3.8 Network emulation :::::::::::::::::::::::::::::::::::::::::::: 86 3.8.1 VLANs ::::::::::::::::::::::::::::::::::::::::::::::::::: 86 3.8.2 Using TAP network interfaces::::::::::::::::::::::::::::: 86 3.8.2.1 Linux host ::::::::::::::::::::::::::::::::::::::::::: 86 3.8.2.2 Windows host ::::::::::::::::::::::::::::::::::::::: 87 3.8.3 Using the user mode network stack:::::::::::::::::::::::: 87 ii 3.8.4 Connecting VLANs between QEMU instances ::::::::::::: 87 3.9 Other Devices ::::::::::::::::::::::::::::::::::::::::::::::::: 87 3.9.1 Inter-VM Shared Memory device:::::::::::::::::::::::::: 87 3.9.1.1 Migration with ivshmem ::::::::::::::::::::::::::::: 88 3.9.1.2 ivshmem and hugepages:::::::::::::::::::::::::::::: 88 3.10 Direct Linux Boot :::::::::::::::::::::::::::::::::::::::::::: 88 3.11 USB emulation ::::::::::::::::::::::::::::::::::::::::::::::: 89 3.11.1 Connecting USB devices ::::::::::::::::::::::::::::::::: 89 3.11.2 Using host USB devices on a Linux host ::::::::::::::::: 90 3.12 VNC security :::::::::::::::::::::::::::::::::::::::::::::::: 90 3.12.1 Without passwords :::::::::::::::::::::::::::::::::::::: 91 3.12.2 With passwords ::::::::::::::::::::::::::::::::::::::::: 91 3.12.3 With x509 certificates ::::::::::::::::::::::::::::::::::: 91 3.12.4 With x509 certificates and client verification ::::::::::::: 91 3.12.5 With x509 certificates, client verification and passwords :: 91 3.12.6 With SASL authentication::::::::::::::::::::::::::::::: 92 3.12.7 With x509 certificates and SASL authentication:::::::::: 92 3.12.8 Generating certificates for VNC:::::::::::::::::::::::::: 92 3.12.8.1 Setup the Certificate Authority ::::::::::::::::::::: 92 3.12.8.2 Issuing server certificates:::::::::::::::::::::::::::: 93 3.12.8.3 Issuing client certificates :::::::::::::::::::::::::::: 93 3.12.9 Configuring SASL mechanisms::::::::::::::::::::::::::: 94 3.13 GDB usage::::::::::::::::::::::::::::::::::::::::::::::::::: 94 3.14 Target OS specific information:::::::::::::::::::::::::::::::: 95 3.14.1 Linux ::::::::::::::::::::::::::::::::::::::::::::::::::: 96 3.14.2 Windows :::::::::::::::::::::::::::::::::::::::::::::::: 96 3.14.2.1 SVGA graphic modes support::::::::::::::::::::::: 96 3.14.2.2 CPU usage reduction ::::::::::::::::::::::::::::::: 96 3.14.2.3 Windows 2000 disk full problem::::::::::::::::::::: 96 3.14.2.4 Windows 2000 shutdown :::::::::::::::::::::::::::: 96 3.14.2.5 Share a directory between Unix and Windows ::::::: 97 3.14.2.6 Windows XP security problem :::::::::::::::::::::: 97 3.14.3 MS-DOS and FreeDOS :::::::::::::::::::::::::::::::::: 97 3.14.3.1 CPU usage reduction ::::::::::::::::::::::::::::::: 97 4 QEMU System emulator for non PC targets :: 98 4.1 PowerPC System emulator::::::::::::::::::::::::::::::::::::: 98 4.2 Sparc32 System emulator :::::::::::::::::::::::::::::::::::::: 99 4.3 Sparc64 System emulator ::::::::::::::::::::::::::::::::::::: 100 4.4 MIPS System emulator ::::::::::::::::::::::::::::::::::::::: 100 4.5 ARM System emulator ::::::::::::::::::::::::::::::::::::::: 101 4.6 ColdFire System emulator :::::::::::::::::::::::::::::::::::: 104 4.7 Cris System emulator::::::::::::::::::::::::::::::::::::::::: 105 4.8 Microblaze System emulator :::::::::::::::::::::::::::::::::: 105 4.9 SH4 System emulator :::::::::::::::::::::::::::::::::::::::: 105 4.10 Xtensa System emulator::::::::::::::::::::::::::::::::::::: 105 iii 5 QEMU User space emulator ::::::::::::::::: 106 5.1 Supported Operating Systems :::::::::::::::::::::::::::::::: 106 5.2 Linux User space emulator:::::::::::::::::::::::::::::::::::: 106 5.2.1 Quick Start ::::::::::::::::::::::::::::::::::::::::::::: 106 5.2.2 Wine launch::::::::::::::::::::::::::::::::::::::::::::: 106 5.2.3 Command line options ::::::::::::::::::::::::::::::::::: 107 5.2.4 Other binaries ::::::::::::::::::::::::::::::::::::::::::: 108 5.3 BSD User space emulator::::::::::::::::::::::::::::::::::::: 108 5.3.1 BSD Status ::::::::::::::::::::::::::::::::::::::::::::: 108 5.3.2 Quick Start ::::::::::::::::::::::::::::::::::::::::::::: 108 5.3.3 Command line options ::::::::::::::::::::::::::::::::::: 108 6 Compilation from the sources:::::::::::::::: 110 6.1 Linux/Unix :::::::::::::::::::::::::::::::::::::::::::::::::: 110 6.1.1 Compilation ::::::::::::::::::::::::::::::::::::::::::::: 110 6.2 Windows ::::::::::::::::::::::::::::::::::::::::::::::::::::: 110 6.3 Cross compilation for Windows with Linux ::::::::::::::::::: 110 6.4 Mac OS X ::::::::::::::::::::::::::::::::::::::::::::::::::: 111 6.5 Make targets ::::::::::::::::::::::::::::::::::::::::::::::::: 112 Appendix A License :::::::::::::::::::::::::::: 113 Appendix B Index :::::::::::::::::::::::::::::: 114 B.1 Concept Index ::::::::::::::::::::::::::::::::::::::::::::::: 114 B.2 Function Index :::::::::::::::::::::::::::::::::::::::::::::: 114 B.3 Keystroke Index ::::::::::::::::::::::::::::::::::::::::::::: 117 B.4 Program Index::::::::::::::::::::::::::::::::::::::::::::::: 118 B.5 Data Type Index :::::::::::::::::::::::::::::::::::::::::::: 118 B.6 Variable Index ::::::::::::::::::::::::::::::::::::::::::::::: 118 1 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 a 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) • AXIS-Devboard88 (CRISv32 ETRAX-FS). • Petalogix Spartan 3aDSP1800 MMU ref design (MicroBlaze). • Avnet LX60/LX110/LX200 boards (Xtensa) 2 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. 3 2 Installation If you want to compile QEMU yourself, see Chapter 6 [compilation],