📄 qemu-doc.html
字号:
Dump 80 16 bit values at the start of the video memory.<PRE>(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</PRE></UL><DT><SAMP>`p or print/fmt expr'</SAMP><DD>Print expression value. Only the <VAR>format</VAR> part of <VAR>fmt</VAR> isused.<DT><SAMP>`sendkey keys'</SAMP><DD>Send <VAR>keys</VAR> to the emulator. Use <CODE>-</CODE> to press several keyssimultaneously. Example:<PRE>sendkey ctrl-alt-f1</PRE>This command is useful to send keys that your graphical user interfaceintercepts at low level, such as <CODE>ctrl-alt-f1</CODE> in X Window.<DT><SAMP>`system_reset'</SAMP><DD>Reset the system.<DT><SAMP>`usb_add devname'</SAMP><DD>Plug the USB device devname to the QEMU virtual USB hub. <VAR>devname</VAR>is either a virtual device name (for example <CODE>mouse</CODE>) or a hostUSB device identifier. Host USB device identifiers have the followingsyntax: <CODE>host:bus.addr</CODE> or <CODE>host:vendor_id:product_id</CODE>.<DT><SAMP>`usb_del devname'</SAMP><DD>Remove the USB device <VAR>devname</VAR> from the QEMU virtual USBhub. <VAR>devname</VAR> has the syntax <CODE>bus.addr</CODE>. Use the monitorcommand <CODE>info usb</CODE> to see the devices you can remove.</DL><H3><A NAME="SEC14" HREF="qemu-doc.html#TOC14">3.5.2 Integer expressions</A></H3><P>The monitor understands integers expressions for every integerargument. You can use register names to get the value of specificsCPU registers by prefixing them with <EM>$</EM>.<H2><A NAME="SEC15" HREF="qemu-doc.html#TOC15">3.6 Disk Images</A></H2><P>Since 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.<H3><A NAME="SEC16" HREF="qemu-doc.html#TOC16">3.6.1 Quick start for disk image creation</A></H3><P>You can create a disk image with the command:<PRE>qemu-img create myimage.img mysize</PRE><P>where <VAR>myimage.img</VAR> is the disk image filename and <VAR>mysize</VAR> is itssize in kilobytes. You can add an <CODE>M</CODE> suffix to give the size inmegabytes and a <CODE>G</CODE> suffix for gigabytes.<P>See section <A HREF="qemu-doc.html#SEC18">3.6.3 <CODE>qemu-img</CODE> Invocation</A> for more information.<H3><A NAME="SEC17" HREF="qemu-doc.html#TOC17">3.6.2 Snapshot mode</A></H3><P>If you use the option <SAMP>`-snapshot'</SAMP>, all disk images areconsidered as read only. When sectors in written, they are written ina temporary file created in <TT>`/tmp'</TT>. You can however force thewrite back to the raw disk images by using the <CODE>commit</CODE> monitorcommand (or <KBD>C-a s</KBD> in the serial console).<H3><A NAME="SEC18" HREF="qemu-doc.html#TOC18">3.6.3 <CODE>qemu-img</CODE> Invocation</A></H3><PRE>usage: qemu-img command [command options]</PRE><P>The following commands are supported:<DL COMPACT><DT><SAMP>`create [-e] [-b <VAR>base_image</VAR>] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [<VAR>size</VAR>]'</SAMP><DD><DT><SAMP>`commit [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP><DD><DT><SAMP>`convert [-c] [-e] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [-O <VAR>output_fmt</VAR>] <VAR>output_filename</VAR>'</SAMP><DD><DT><SAMP>`info [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP><DD></DL><P>Command parameters:<DL COMPACT><DT><VAR>filename</VAR><DD> is a disk image filename<DT><VAR>base_image</VAR><DD>is the read-only disk image which is used as base for a copy on write image; the copy on write image only stores the modified data<DT><VAR>fmt</VAR><DD>is the disk image format. It is guessed automatically in most cases. The following formats are supported:<DL COMPACT><DT><CODE>raw</CODE><DD>Raw disk image format (default). This format has the advantage ofbeing simple and easily exportable to all other emulators. If your filesystem supports <EM>holes</EM> (for example in ext2 or ext3 on Linux),then only the written sectors will reserve space. Use <CODE>qemu-imginfo</CODE> to know the real size used by the image or <CODE>ls -ls</CODE> onUnix/Linux.<DT><CODE>qcow</CODE><DD>QEMU image format, the most versatile format. Use it to have smallerimages (useful if your filesystem does not supports holes, for exampleon Windows), optional AES encryption and zlib based compression.<DT><CODE>cow</CODE><DD>User Mode Linux Copy On Write image format. Used to be the only growableimage format in QEMU. It is supported only for compatibility withprevious versions. It does not work on win32.<DT><CODE>vmdk</CODE><DD>VMware 3 and 4 compatible image format.<DT><CODE>cloop</CODE><DD>Linux Compressed Loop image, useful only to reuse directly compressedCD-ROM images present for example in the Knoppix CD-ROMs.</DL><DT><VAR>size</VAR><DD>is the disk image size in kilobytes. Optional suffixes <CODE>M</CODE>(megabyte) and <CODE>G</CODE> (gigabyte) are supported <DT><VAR>output_filename</VAR><DD>is the destination disk image filename <DT><VAR>output_fmt</VAR><DD> is the destination format<DT><VAR>-c</VAR><DD>indicates that target image must be compressed (qcow format only)<DT><VAR>-e</VAR><DD>indicates that the target image must be encrypted (qcow format only)</DL><P>Command description:<DL COMPACT><DT><SAMP>`create [-e] [-b <VAR>base_image</VAR>] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [<VAR>size</VAR>]'</SAMP><DD>Create the new disk image <VAR>filename</VAR> of size <VAR>size</VAR> and format<VAR>fmt</VAR>. If <VAR>base_image</VAR> is specified, then the image will record only thedifferences from <VAR>base_image</VAR>. No size needs to be specified inthis case. <VAR>base_image</VAR> will never be modified unless you use the<CODE>commit</CODE> monitor command.<DT><SAMP>`commit [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP><DD>Commit the changes recorded in <VAR>filename</VAR> in its base image.<DT><SAMP>`convert [-c] [-e] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [-O <VAR>output_fmt</VAR>] <VAR>output_filename</VAR>'</SAMP><DD>Convert the disk image <VAR>filename</VAR> to disk image <VAR>output_filename</VAR>using format <VAR>output_fmt</VAR>. It can be optionnaly encrypted(<CODE>-e</CODE> option) or compressed (<CODE>-c</CODE> option).Only the format <CODE>qcow</CODE> supports encryption or compression. Thecompression is read-only. It means that if a compressed sector isrewritten, then it is rewritten as uncompressed data.Encryption uses the AES format which is very secure (128 bit keys). Usea long password (16 characters) to get maximum protection.Image conversion is also useful to get smaller image when using agrowable format such as <CODE>qcow</CODE> or <CODE>cow</CODE>: the empty sectorsare detected and suppressed from the destination image.<DT><SAMP>`info [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP><DD>Give information about the disk image <VAR>filename</VAR>. Use it inparticular to know the size reserved on disk which can be differentfrom the displayed size.</DL><H3><A NAME="SEC19" HREF="qemu-doc.html#TOC19">3.6.4 Virtual FAT disk images</A></H3><P>QEMU can automatically create a virtual FAT disk image from adirectory tree. In order to use it, just type:<PRE>qemu linux.img -hdb fat:/my_directory</PRE><P>Then you access access to all the files in the <TT>`/my_directory'</TT>directory without having to copy them in a disk image or to exportthem via SAMBA or NFS. The default access is <EM>read-only</EM>.<P>Floppies can be emulated with the <CODE>:floppy:</CODE> option:<PRE>qemu linux.img -fda fat:floppy:/my_directory</PRE><P>A read/write support is available for testing (beta stage) with the<CODE>:rw:</CODE> option:<PRE>qemu linux.img -fda fat:floppy:rw:/my_directory</PRE><P>What you should <EM>never</EM> do:<UL><LI>use non-ASCII filenames ;<LI>use "-snapshot" together with ":rw:" ;<LI>expect it to work when loadvm'ing ;<LI>write to the FAT directory on the host system while accessing it with the guest system.</UL><H2><A NAME="SEC20" HREF="qemu-doc.html#TOC20">3.7 Network emulation</A></H2><P>QEMU can simulate several networks cards (NE2000 boards 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 priviledged user modenetwork stack can replace the TAP device to have a basic networkconnection.<H3><A NAME="SEC21" HREF="qemu-doc.html#TOC21">3.7.1 VLANs</A></H3><P>QEMU 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).<H3><A NAME="SEC22" HREF="qemu-doc.html#TOC22">3.7.2 Using TAP network interfaces</A></H3><P>This is the standard way to connect QEMU to a real network. QEMU addsa virtual network device on your host (called <CODE>tapN</CODE>), and youcan then configure it as if it was a real ethernet card.<P>As an example, you can download the <TT>`linux-test-xxx.tar.gz'</TT>archive and copy the script <TT>`qemu-ifup'</TT> in <TT>`/etc'</TT> andconfigure properly <CODE>sudo</CODE> so that the command <CODE>ifconfig</CODE>contained in <TT>`qemu-ifup'</TT> can be executed as root. You must verifythat your host kernel supports the TAP network interfaces: thedevice <TT>`/dev/net/tun'</TT> must be present.<P>See section <A HREF="qemu-doc.html#SEC25">3.8 Direct Linux Boot</A> to have an example of network use with aLinux distribution and section <A HREF="qemu-doc.html#SEC10">3.3 Invocation</A> to have examples ofcommand lines using the TAP network interfaces.<H3><A NAME="SEC23" HREF="qemu-doc.html#TOC23">3.7.3 Using the user mode network stack</A></H3><P>By using the option <SAMP>`-net user'</SAMP> (default configuration if no<SAMP>`-net'</SAMP> option is specified), QEMU uses a completely user modenetwork stack (you don't need root priviledge to use the virtualnetwork). The virtual network configuration is the following:<PRE> QEMU VLAN <------> Firewall/DHCP server <-----> Internet | (10.0.2.2) | ----> DNS server (10.0.2.3) | ----> SMB server (10.0.2.4)</PRE><P>The 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.<P>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.<P>Note that <CODE>ping</CODE> is not supported reliably to the internet as itwould require root priviledges. It means you can only ping the localrouter (10.0.2.2).<P>When using the built-in TFTP server, the router is also the TFTPserver.<P>When using the <SAMP>`-redir'</SAMP> option, TCP or UDP connections can beredirected from the host to the guest. It allows for example toredirect X11, telnet or SSH connections.<H3><A NAME="SEC24" HREF="qemu-doc.html#TOC24">3.7.4 Connecting VLANs between QEMU instances</A></H3><P>Using the <SAMP>`-net socket'</SAMP> option, it is possible to make VLANsthat span several QEMU instances. See section <A HREF="qemu-doc.html#SEC10">3.3 Invocation</A> to have abasic example.<H2><A NAME="SEC25" HREF="qemu-doc.html#TOC25">3.8 Direct Linux Boot</A></H2><P>This 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 QEMU network configuration is also explained.<OL><LI>Download the archive <TT>`linux-test-xxx.tar.gz'</TT> containing a Linuxkernel and a disk image. <LI>Optional: If you want network support (for example to launch X11 examples), youmust copy the script <TT>`qemu-ifup'</TT> in <TT>`/etc'</TT> and configureproperly <CODE>sudo</CODE> so that the command <CODE>ifconfig</CODE> contained in<TT>`qemu-ifup'</TT> can be executed as root. You must verify that your hostkernel supports the TUN/TAP network interfaces: the device<TT>`/dev/net/tun'</TT> must be present.When network is enabled, there is a virtual network connection betweenthe host kernel and the emulated kernel. The emulated kernel is seenfrom the host kernel at IP address 172.20.0.2 and the host kernel isseen from the emulated kernel at IP address 172.20.0.1.<LI>Launch <CODE>qemu.sh</CODE>. You should have the following output:<PRE>> ./qemu.sh Connected to host network interface: tun0Linux version 2.4.21 (bellard@voyager.localdomain) (gcc version 3.2.2 20030222 @/(Red Hat @/Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003BIOS-provided physical RAM map: BIOS-e801: 0000000000000000 - 000000000009f000 (usable) BIOS-e801: 0000000000100000 - 0000000002000000 (usable)32MB LOWMEM available.On node 0 totalpages: 8192zone(0): 4096 pages.zone(1): 4096 pages.zone(2): 0 pages.Kernel command line: root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe @/ide5=noprobe console=ttyS0ide_setup: ide2=noprobeide_setup: ide3=noprobeide_setup: ide4=noprobeide_setup: ide5=noprobeInitializing CPU#0Detected 2399.621 MHz processor.Console: colour EGA 80x25Calibrating delay loop... 4744.80 BogoMIPSMemory: 28872k/32768k available (1210k kernel code, 3508k reserved, 266k data, 64k init, @/0k highmem)Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)Inode cache hash table entries: 2048 (order: 2, 16384 bytes)Mount cache hash table entries: 512 (order: 0, 4096 bytes)Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)Page-cache hash table entries: 8192 (order: 3, 32768 bytes)CPU: Intel Pentium Pro stepping 03Checking 'hlt' instruction... OK.POSIX conformance testing by UNIFIXLinux NET4.0 for Linux 2.4Based upon Swansea University Computer Society NET3.039Initializing RT netlink socketapm: BIOS not found.Starting kswapdJournalled Block Device driver loadedDetected PS/2 Mouse Port.pty: 256 Unix98 ptys configuredSerial driver version 5.05c (2001-07-08) with no serial options enabledttyS00 at 0x03f8 (irq = 4) is a 16450ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com)Last modified Nov 1, 2000 by Paul Gortmaker
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -