📄 qemu-doc.html
字号:
NE*000 ethercard probe at 0x300: 52 54 00 12 34 56eth0: NE2000 found at 0x300, using IRQ 9.RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksizeUniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xxhda: QEMU HARDDISK, ATA DISK driveide0 at 0x1f0-0x1f7,0x3f6 on irq 14hda: attached ide-disk driver.hda: 20480 sectors (10 MB) w/256KiB Cache, CHS=20/16/63Partition check: hda:Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996NET4: Linux TCP/IP 1.0 for NET4.0IP Protocols: ICMP, UDP, TCP, IGMPIP: routing cache hash table of 512 buckets, 4KbytesTCP: Hash tables configured (established 2048 bind 4096)NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.EXT2-fs warning: mounting unchecked fs, running e2fsck is recommendedVFS: Mounted root (ext2 filesystem).Freeing unused kernel memory: 64k freed Linux 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 2003 QEMU Linux test distribution (based on Redhat 9) Type 'exit' to halt the system sh-2.05b# </PRE><LI>Then you can play with the kernel inside the virtual serial console. Youcan launch <CODE>ls</CODE> for example. Type <KBD>Ctrl-a h</KBD> to have an helpabout the keys you can type inside the virtual serial console. Inparticular, use <KBD>Ctrl-a x</KBD> to exit QEMU and use <KBD>Ctrl-a b</KBD> asthe Magic SysRq key.<LI>If the network is enabled, launch the script <TT>`/etc/linuxrc'</TT> in theemulator (don't forget the leading dot):<PRE>. /etc/linuxrc</PRE>Then enable X11 connections on your PC from the emulated Linux: <PRE>xhost +172.20.0.2</PRE>You can now launch <TT>`xterm'</TT> or <TT>`xlogo'</TT> and verify that you havea real Virtual Linux system !</OL><P>NOTES:<OL><LI>A 2.5.74 kernel is also included in the archive. Justreplace the bzImage in qemu.sh to try it.<LI>In order to exit cleanly from qemu, you can do a <EM>shutdown</EM> insideqemu. qemu will automatically exit when the Linux shutdown is done.<LI>You can boot slightly faster by disabling the probe of non present IDEinterfaces. To do so, add the following options on the kernel commandline:<PRE>ide1=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe</PRE><LI>The example disk image is a modified version of the one made by KevinLawton for the plex86 Project (<A HREF="www.plex86.org">www.plex86.org</A>).</OL><H2><A NAME="SEC26" HREF="qemu-doc.html#TOC26">3.9 USB emulation</A></H2><P>QEMU emulates a PCI UHCI USB controller and a 8 port USB hub connectedto it. You can virtually plug to the hub virtual USB devices or realhost USB devices (experimental, works only on Linux hosts).<H3><A NAME="SEC27" HREF="qemu-doc.html#TOC27">3.9.1 Using virtual USB devices</A></H3><P>A virtual USB mouse device is available for testing in QEMU.<P>You can try it with the following monitor commands:<PRE># add the mouse device(qemu) usb_add mouse # show the virtual USB devices plugged on the QEMU Virtual USB hub(qemu) info usb Device 0.3, speed 12 Mb/s# after some time you can try to remove the mouse(qemu) usb_del 0.3</PRE><P>The option <SAMP>`-usbdevice'</SAMP> is similar to the monitor command<CODE>usb_add</CODE>.<H3><A NAME="SEC28" HREF="qemu-doc.html#TOC28">3.9.2 Using host USB devices on a Linux host</A></H3><P>WARNING: 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.<OL><LI>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 <TT>`mydriver.o'</TT>to <TT>`mydriver.o.disabled'</TT>.<LI>Verify that <TT>`/proc/bus/usb'</TT> is working (most Linux distributions should enable it by default). You should see something like that:<PRE>ls /proc/bus/usb001 devices drivers</PRE><LI>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:<PRE>chown -R myuid /proc/bus/usb</PRE><LI>Launch QEMU and do in the monitor:<PRE>info usbhost Device 1.2, speed 480 Mb/s Class 00: USB device 1234:5678, USB DISK</PRE>You should see the list of the devices you can use (Never try to usehubs, it won't work).<LI>Add the device in QEMU by using:<PRE>usb_add host:1234:5678</PRE>Normally the guest OS should report that a new USB device isplugged. You can use the option <SAMP>`-usbdevice'</SAMP> to do the same.<LI>Now you can try to use the host USB device in QEMU.</OL><P>When relaunching QEMU, you may have to unplug and plug again the USBdevice to make it work again (this is a bug).<H2><A NAME="SEC29" HREF="qemu-doc.html#TOC29">3.10 GDB usage</A></H2><P>QEMU has a primitive support to work with gdb, so that you can do'Ctrl-C' while the virtual machine is running and inspect its state.<P>In order to use gdb, launch qemu with the '-s' option. It will wait for agdb connection:<PRE>> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \ -append "root=/dev/hda"Connected to host network interface: tun0Waiting gdb connection on port 1234</PRE><P>Then launch gdb on the 'vmlinux' executable:<PRE>> gdb vmlinux</PRE><P>In gdb, connect to QEMU:<PRE>(gdb) target remote localhost:1234</PRE><P>Then you can use gdb normally. For example, type 'c' to launch the kernel:<PRE>(gdb) c</PRE><P>Here are some useful tips in order to use gdb on system code:<OL><LI>Use <CODE>info reg</CODE> to display all the CPU registers.<LI>Use <CODE>x/10i $eip</CODE> to display the code at the PC position.<LI>Use <CODE>set architecture i8086</CODE> to dump 16 bit code. Then use<CODE>x/10i $cs*16+*eip</CODE> to dump the code at the PC position.</OL><H2><A NAME="SEC30" HREF="qemu-doc.html#TOC30">3.11 Target OS specific information</A></H2><H3><A NAME="SEC31" HREF="qemu-doc.html#TOC31">3.11.1 Linux</A></H3><P>To have access to SVGA graphic modes under X11, use the <CODE>vesa</CODE> orthe <CODE>cirrus</CODE> X11 driver. For optimal performances, use 16 bitcolor depth in the guest and the host OS.<P>When using a 2.6 guest Linux kernel, you should add the option<CODE>clock=pit</CODE> on the kernel command line because the 2.6 Linuxkernels make very strict real time clock checks by default that QEMUcannot simulate exactly.<P>When using a 2.6 guest Linux kernel, verify that the 4G/4G patch isnot activated because QEMU is slower with this patch. The QEMUAccelerator Module is also much slower in this case. Earlier FedoraCore 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte thispatch by default. Newer kernels don't have it.<H3><A NAME="SEC32" HREF="qemu-doc.html#TOC32">3.11.2 Windows</A></H3><P>If you have a slow host, using Windows 95 is better as it gives thebest speed. Windows 2000 is also a good choice.<H4><A NAME="SEC33" HREF="qemu-doc.html#TOC33">3.11.2.1 SVGA graphic modes support</A></H4><P>QEMU emulates a Cirrus Logic GD5446 Videocard. All Windows versions starting from Windows 95 should recognizeand use this graphic card. For optimal performances, use 16 bit colordepth in the guest and the host OS.<H4><A NAME="SEC34" HREF="qemu-doc.html#TOC34">3.11.2.2 CPU usage reduction</A></H4><P>Windows 9x does not correctly use the CPU HLTinstruction. The result is that it takes host CPU cycles even whenidle. You can install the utility from<A HREF="http://www.user.cityline.ru/~maxamn/amnhltm.zip">http://www.user.cityline.ru/~maxamn/amnhltm.zip</A> to solve thisproblem. Note that no such tool is needed for NT, 2000 or XP.<H4><A NAME="SEC35" HREF="qemu-doc.html#TOC35">3.11.2.3 Windows 2000 disk full problem</A></H4><P>Windows 2000 has a bug which gives a disk full problem during itsinstallation. When installing it, use the <SAMP>`-win2k-hack'</SAMP> QEMUoption to enable a specific workaround. After Windows 2000 isinstalled, you no longer need this option (this option slows down theIDE transfers).<H4><A NAME="SEC36" HREF="qemu-doc.html#TOC36">3.11.2.4 Windows 2000 shutdown</A></H4><P>Windows 2000 cannot automatically shutdown in QEMU although Windows 98can. It comes from the fact that Windows 2000 does not automaticallyuse the APM driver provided by the BIOS.<P>In order to correct that, do the following (thanks to StruanBartlett): go to the Control Panel => Add/Remove Hardware & Next =>Add/Troubleshoot a device => Add a new device & Next => No, select thehardware from a list & Next => NT Apm/Legacy Support & Next => Next(again) a few times. Now the driver is installed and Windows 2000 nowcorrectly instructs QEMU to shutdown at the appropriate moment. <H4><A NAME="SEC37" HREF="qemu-doc.html#TOC37">3.11.2.5 Share a directory between Unix and Windows</A></H4><P>See section <A HREF="qemu-doc.html#SEC10">3.3 Invocation</A> about the help of the option <SAMP>`-smb'</SAMP>.<H4><A NAME="SEC38" HREF="qemu-doc.html#TOC38">3.11.2.6 Windows XP security problems</A></H4><P>Some releases of Windows XP install correctly but give a securityerror when booting:<PRE>A problem is preventing Windows from accurately checking thelicense for this computer. Error code: 0x800703e6.</PRE><P>The only known workaround is to boot in Safe modewithout networking support. <P>Future QEMU releases are likely to correct this bug.<H3><A NAME="SEC39" HREF="qemu-doc.html#TOC39">3.11.3 MS-DOS and FreeDOS</A></H3><H4><A NAME="SEC40" HREF="qemu-doc.html#TOC40">3.11.3.1 CPU usage reduction</A></H4><P>DOS does not correctly use the CPU HLT instruction. The result is thatit takes host CPU cycles even when idle. You can install the utilityfrom <A HREF="http://www.vmware.com/software/dosidle210.zip">http://www.vmware.com/software/dosidle210.zip</A> to solve thisproblem.<H1><A NAME="SEC41" HREF="qemu-doc.html#TOC41">4. QEMU System emulator for non PC targets</A></H1><P>QEMU is a generic emulator and it emulates many non PCmachines. Most of the options are similar to the PC emulator. Thedifferences are mentionned in the following sections.<H2><A NAME="SEC42" HREF="qemu-doc.html#TOC42">4.1 QEMU PowerPC System emulator</A></H2><P>Use the executable <TT>`qemu-system-ppc'</TT> to simulate a complete PREPor PowerMac PowerPC system.<P>QEMU emulates the following PowerMac peripherals:<UL><LI>UniNorth PCI Bridge <LI>PCI VGA compatible card with VESA Bochs Extensions<LI>2 PMAC IDE interfaces with hard disk and CD-ROM support<LI>NE2000 PCI adapters<LI>Non Volatile RAM<LI>VIA-CUDA with ADB keyboard and mouse.</UL><P>QEMU emulates the following PREP peripherals:<UL><LI>PCI Bridge<LI>PCI VGA compatible card with VESA Bochs Extensions<LI>2 IDE interfaces with hard disk and CD-ROM support<LI>Floppy disk<LI>NE2000 network adapters<LI>Serial port<LI>PREP Non Volatile RAM<LI>PC compatible keyboard and mouse.</UL><P>QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at<A HREF="http://perso.magic.fr/l_indien/OpenHackWare/index.htm">http://perso.magic.fr/l_indien/OpenHackWare/index.htm</A>.<P>The following options are specific to the PowerPC emulation:<DL COMPACT><DT><SAMP>`-g WxH[xDEPTH]'</SAMP><DD>Set the initial VGA graphic mode. The default is 800x600x15.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -