qemu-doc.texi 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113
  1. \input texinfo @c -*- texinfo -*-
  2. @c %**start of header
  3. @setfilename qemu-doc.info
  4. @documentlanguage en
  5. @documentencoding UTF-8
  6. @settitle QEMU Emulator User Documentation
  7. @exampleindent 0
  8. @paragraphindent 0
  9. @c %**end of header
  10. @ifinfo
  11. @direntry
  12. * QEMU: (qemu-doc). The QEMU Emulator User Documentation.
  13. @end direntry
  14. @end ifinfo
  15. @iftex
  16. @titlepage
  17. @sp 7
  18. @center @titlefont{QEMU Emulator}
  19. @sp 1
  20. @center @titlefont{User Documentation}
  21. @sp 3
  22. @end titlepage
  23. @end iftex
  24. @ifnottex
  25. @node Top
  26. @top
  27. @menu
  28. * Introduction::
  29. * Installation::
  30. * QEMU PC System emulator::
  31. * QEMU System emulator for non PC targets::
  32. * QEMU User space emulator::
  33. * compilation:: Compilation from the sources
  34. * License::
  35. * Index::
  36. @end menu
  37. @end ifnottex
  38. @contents
  39. @node Introduction
  40. @chapter Introduction
  41. @menu
  42. * intro_features:: Features
  43. @end menu
  44. @node intro_features
  45. @section Features
  46. QEMU is a FAST! processor emulator using dynamic translation to
  47. achieve good emulation speed.
  48. QEMU has two operating modes:
  49. @itemize
  50. @cindex operating modes
  51. @item
  52. @cindex system emulation
  53. Full system emulation. In this mode, QEMU emulates a full system (for
  54. example a PC), including one or several processors and various
  55. peripherals. It can be used to launch different Operating Systems
  56. without rebooting the PC or to debug system code.
  57. @item
  58. @cindex user mode emulation
  59. User mode emulation. In this mode, QEMU can launch
  60. processes compiled for one CPU on another CPU. It can be used to
  61. launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
  62. to ease cross-compilation and cross-debugging.
  63. @end itemize
  64. QEMU can run without a host kernel driver and yet gives acceptable
  65. performance.
  66. For system emulation, the following hardware targets are supported:
  67. @itemize
  68. @cindex emulated target systems
  69. @cindex supported target systems
  70. @item PC (x86 or x86_64 processor)
  71. @item ISA PC (old style PC without PCI bus)
  72. @item PREP (PowerPC processor)
  73. @item G3 Beige PowerMac (PowerPC processor)
  74. @item Mac99 PowerMac (PowerPC processor, in progress)
  75. @item Sun4m/Sun4c/Sun4d (32-bit Sparc processor)
  76. @item Sun4u/Sun4v (64-bit Sparc processor, in progress)
  77. @item Malta board (32-bit and 64-bit MIPS processors)
  78. @item MIPS Magnum (64-bit MIPS processor)
  79. @item ARM Integrator/CP (ARM)
  80. @item ARM Versatile baseboard (ARM)
  81. @item ARM RealView Emulation/Platform baseboard (ARM)
  82. @item Spitz, Akita, Borzoi, Terrier and Tosa PDAs (PXA270 processor)
  83. @item Luminary Micro LM3S811EVB (ARM Cortex-M3)
  84. @item Luminary Micro LM3S6965EVB (ARM Cortex-M3)
  85. @item Freescale MCF5208EVB (ColdFire V2).
  86. @item Arnewsh MCF5206 evaluation board (ColdFire V2).
  87. @item Palm Tungsten|E PDA (OMAP310 processor)
  88. @item N800 and N810 tablets (OMAP2420 processor)
  89. @item MusicPal (MV88W8618 ARM processor)
  90. @item Gumstix "Connex" and "Verdex" motherboards (PXA255/270).
  91. @item Siemens SX1 smartphone (OMAP310 processor)
  92. @item AXIS-Devboard88 (CRISv32 ETRAX-FS).
  93. @item Petalogix Spartan 3aDSP1800 MMU ref design (MicroBlaze).
  94. @item Avnet LX60/LX110/LX200 boards (Xtensa)
  95. @end itemize
  96. @cindex supported user mode targets
  97. For user emulation, x86 (32 and 64 bit), PowerPC (32 and 64 bit),
  98. ARM, MIPS (32 bit only), Sparc (32 and 64 bit),
  99. Alpha, ColdFire(m68k), CRISv32 and MicroBlaze CPUs are supported.
  100. @node Installation
  101. @chapter Installation
  102. If you want to compile QEMU yourself, see @ref{compilation}.
  103. @menu
  104. * install_linux:: Linux
  105. * install_windows:: Windows
  106. * install_mac:: Macintosh
  107. @end menu
  108. @node install_linux
  109. @section Linux
  110. @cindex installation (Linux)
  111. If a precompiled package is available for your distribution - you just
  112. have to install it. Otherwise, see @ref{compilation}.
  113. @node install_windows
  114. @section Windows
  115. @cindex installation (Windows)
  116. Download the experimental binary installer at
  117. @url{http://www.free.oszoo.org/@/download.html}.
  118. TODO (no longer available)
  119. @node install_mac
  120. @section Mac OS X
  121. Download the experimental binary installer at
  122. @url{http://www.free.oszoo.org/@/download.html}.
  123. TODO (no longer available)
  124. @node QEMU PC System emulator
  125. @chapter QEMU PC System emulator
  126. @cindex system emulation (PC)
  127. @menu
  128. * pcsys_introduction:: Introduction
  129. * pcsys_quickstart:: Quick Start
  130. * sec_invocation:: Invocation
  131. * pcsys_keys:: Keys
  132. * pcsys_monitor:: QEMU Monitor
  133. * disk_images:: Disk Images
  134. * pcsys_network:: Network emulation
  135. * pcsys_other_devs:: Other Devices
  136. * direct_linux_boot:: Direct Linux Boot
  137. * pcsys_usb:: USB emulation
  138. * vnc_security:: VNC security
  139. * gdb_usage:: GDB usage
  140. * pcsys_os_specific:: Target OS specific information
  141. @end menu
  142. @node pcsys_introduction
  143. @section Introduction
  144. @c man begin DESCRIPTION
  145. The QEMU PC System emulator simulates the
  146. following peripherals:
  147. @itemize @minus
  148. @item
  149. i440FX host PCI bridge and PIIX3 PCI to ISA bridge
  150. @item
  151. Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
  152. extensions (hardware level, including all non standard modes).
  153. @item
  154. PS/2 mouse and keyboard
  155. @item
  156. 2 PCI IDE interfaces with hard disk and CD-ROM support
  157. @item
  158. Floppy disk
  159. @item
  160. PCI and ISA network adapters
  161. @item
  162. Serial ports
  163. @item
  164. Creative SoundBlaster 16 sound card
  165. @item
  166. ENSONIQ AudioPCI ES1370 sound card
  167. @item
  168. Intel 82801AA AC97 Audio compatible sound card
  169. @item
  170. Intel HD Audio Controller and HDA codec
  171. @item
  172. Adlib (OPL2) - Yamaha YM3812 compatible chip
  173. @item
  174. Gravis Ultrasound GF1 sound card
  175. @item
  176. CS4231A compatible sound card
  177. @item
  178. PCI UHCI USB controller and a virtual USB hub.
  179. @end itemize
  180. SMP is supported with up to 255 CPUs.
  181. QEMU uses the PC BIOS from the Seabios project and the Plex86/Bochs LGPL
  182. VGA BIOS.
  183. QEMU uses YM3812 emulation by Tatsuyuki Satoh.
  184. QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
  185. by Tibor "TS" Schütz.
  186. Note that, by default, GUS shares IRQ(7) with parallel ports and so
  187. QEMU must be told to not have parallel ports to have working GUS.
  188. @example
  189. qemu-system-i386 dos.img -soundhw gus -parallel none
  190. @end example
  191. Alternatively:
  192. @example
  193. qemu-system-i386 dos.img -device gus,irq=5
  194. @end example
  195. Or some other unclaimed IRQ.
  196. CS4231A is the chip used in Windows Sound System and GUSMAX products
  197. @c man end
  198. @node pcsys_quickstart
  199. @section Quick Start
  200. @cindex quick start
  201. Download and uncompress the linux image (@file{linux.img}) and type:
  202. @example
  203. qemu-system-i386 linux.img
  204. @end example
  205. Linux should boot and give you a prompt.
  206. @node sec_invocation
  207. @section Invocation
  208. @example
  209. @c man begin SYNOPSIS
  210. usage: qemu-system-i386 [options] [@var{disk_image}]
  211. @c man end
  212. @end example
  213. @c man begin OPTIONS
  214. @var{disk_image} is a raw hard disk image for IDE hard disk 0. Some
  215. targets do not need a disk image.
  216. @include qemu-options.texi
  217. @c man end
  218. @node pcsys_keys
  219. @section Keys
  220. @c man begin OPTIONS
  221. During the graphical emulation, you can use special key combinations to change
  222. modes. The default key mappings are shown below, but if you use @code{-alt-grab}
  223. then the modifier is Ctrl-Alt-Shift (instead of Ctrl-Alt) and if you use
  224. @code{-ctrl-grab} then the modifier is the right Ctrl key (instead of Ctrl-Alt):
  225. @table @key
  226. @item Ctrl-Alt-f
  227. @kindex Ctrl-Alt-f
  228. Toggle full screen
  229. @item Ctrl-Alt-+
  230. @kindex Ctrl-Alt-+
  231. Enlarge the screen
  232. @item Ctrl-Alt--
  233. @kindex Ctrl-Alt--
  234. Shrink the screen
  235. @item Ctrl-Alt-u
  236. @kindex Ctrl-Alt-u
  237. Restore the screen's un-scaled dimensions
  238. @item Ctrl-Alt-n
  239. @kindex Ctrl-Alt-n
  240. Switch to virtual console 'n'. Standard console mappings are:
  241. @table @emph
  242. @item 1
  243. Target system display
  244. @item 2
  245. Monitor
  246. @item 3
  247. Serial port
  248. @end table
  249. @item Ctrl-Alt
  250. @kindex Ctrl-Alt
  251. Toggle mouse and keyboard grab.
  252. @end table
  253. @kindex Ctrl-Up
  254. @kindex Ctrl-Down
  255. @kindex Ctrl-PageUp
  256. @kindex Ctrl-PageDown
  257. In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
  258. @key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
  259. @kindex Ctrl-a h
  260. During emulation, if you are using the @option{-nographic} option, use
  261. @key{Ctrl-a h} to get terminal commands:
  262. @table @key
  263. @item Ctrl-a h
  264. @kindex Ctrl-a h
  265. @item Ctrl-a ?
  266. @kindex Ctrl-a ?
  267. Print this help
  268. @item Ctrl-a x
  269. @kindex Ctrl-a x
  270. Exit emulator
  271. @item Ctrl-a s
  272. @kindex Ctrl-a s
  273. Save disk data back to file (if -snapshot)
  274. @item Ctrl-a t
  275. @kindex Ctrl-a t
  276. Toggle console timestamps
  277. @item Ctrl-a b
  278. @kindex Ctrl-a b
  279. Send break (magic sysrq in Linux)
  280. @item Ctrl-a c
  281. @kindex Ctrl-a c
  282. Switch between console and monitor
  283. @item Ctrl-a Ctrl-a
  284. @kindex Ctrl-a a
  285. Send Ctrl-a
  286. @end table
  287. @c man end
  288. @ignore
  289. @c man begin SEEALSO
  290. The HTML documentation of QEMU for more precise information and Linux
  291. user mode emulator invocation.
  292. @c man end
  293. @c man begin AUTHOR
  294. Fabrice Bellard
  295. @c man end
  296. @end ignore
  297. @node pcsys_monitor
  298. @section QEMU Monitor
  299. @cindex QEMU monitor
  300. The QEMU monitor is used to give complex commands to the QEMU
  301. emulator. You can use it to:
  302. @itemize @minus
  303. @item
  304. Remove or insert removable media images
  305. (such as CD-ROM or floppies).
  306. @item
  307. Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
  308. from a disk file.
  309. @item Inspect the VM state without an external debugger.
  310. @end itemize
  311. @subsection Commands
  312. The following commands are available:
  313. @include qemu-monitor.texi
  314. @subsection Integer expressions
  315. The monitor understands integers expressions for every integer
  316. argument. You can use register names to get the value of specifics
  317. CPU registers by prefixing them with @emph{$}.
  318. @node disk_images
  319. @section Disk Images
  320. Since version 0.6.1, QEMU supports many disk image formats, including
  321. growable disk images (their size increase as non empty sectors are
  322. written), compressed and encrypted disk images. Version 0.8.3 added
  323. the new qcow2 disk image format which is essential to support VM
  324. snapshots.
  325. @menu
  326. * disk_images_quickstart:: Quick start for disk image creation
  327. * disk_images_snapshot_mode:: Snapshot mode
  328. * vm_snapshots:: VM snapshots
  329. * qemu_img_invocation:: qemu-img Invocation
  330. * qemu_nbd_invocation:: qemu-nbd Invocation
  331. * disk_images_formats:: Disk image file formats
  332. * host_drives:: Using host drives
  333. * disk_images_fat_images:: Virtual FAT disk images
  334. * disk_images_nbd:: NBD access
  335. * disk_images_sheepdog:: Sheepdog disk images
  336. * disk_images_iscsi:: iSCSI LUNs
  337. * disk_images_gluster:: GlusterFS disk images
  338. * disk_images_ssh:: Secure Shell (ssh) disk images
  339. @end menu
  340. @node disk_images_quickstart
  341. @subsection Quick start for disk image creation
  342. You can create a disk image with the command:
  343. @example
  344. qemu-img create myimage.img mysize
  345. @end example
  346. where @var{myimage.img} is the disk image filename and @var{mysize} is its
  347. size in kilobytes. You can add an @code{M} suffix to give the size in
  348. megabytes and a @code{G} suffix for gigabytes.
  349. See @ref{qemu_img_invocation} for more information.
  350. @node disk_images_snapshot_mode
  351. @subsection Snapshot mode
  352. If you use the option @option{-snapshot}, all disk images are
  353. considered as read only. When sectors in written, they are written in
  354. a temporary file created in @file{/tmp}. You can however force the
  355. write back to the raw disk images by using the @code{commit} monitor
  356. command (or @key{C-a s} in the serial console).
  357. @node vm_snapshots
  358. @subsection VM snapshots
  359. VM snapshots are snapshots of the complete virtual machine including
  360. CPU state, RAM, device state and the content of all the writable
  361. disks. In order to use VM snapshots, you must have at least one non
  362. removable and writable block device using the @code{qcow2} disk image
  363. format. Normally this device is the first virtual hard drive.
  364. Use the monitor command @code{savevm} to create a new VM snapshot or
  365. replace an existing one. A human readable name can be assigned to each
  366. snapshot in addition to its numerical ID.
  367. Use @code{loadvm} to restore a VM snapshot and @code{delvm} to remove
  368. a VM snapshot. @code{info snapshots} lists the available snapshots
  369. with their associated information:
  370. @example
  371. (qemu) info snapshots
  372. Snapshot devices: hda
  373. Snapshot list (from hda):
  374. ID TAG VM SIZE DATE VM CLOCK
  375. 1 start 41M 2006-08-06 12:38:02 00:00:14.954
  376. 2 40M 2006-08-06 12:43:29 00:00:18.633
  377. 3 msys 40M 2006-08-06 12:44:04 00:00:23.514
  378. @end example
  379. A VM snapshot is made of a VM state info (its size is shown in
  380. @code{info snapshots}) and a snapshot of every writable disk image.
  381. The VM state info is stored in the first @code{qcow2} non removable
  382. and writable block device. The disk image snapshots are stored in
  383. every disk image. The size of a snapshot in a disk image is difficult
  384. to evaluate and is not shown by @code{info snapshots} because the
  385. associated disk sectors are shared among all the snapshots to save
  386. disk space (otherwise each snapshot would need a full copy of all the
  387. disk images).
  388. When using the (unrelated) @code{-snapshot} option
  389. (@ref{disk_images_snapshot_mode}), you can always make VM snapshots,
  390. but they are deleted as soon as you exit QEMU.
  391. VM snapshots currently have the following known limitations:
  392. @itemize
  393. @item
  394. They cannot cope with removable devices if they are removed or
  395. inserted after a snapshot is done.
  396. @item
  397. A few device drivers still have incomplete snapshot support so their
  398. state is not saved or restored properly (in particular USB).
  399. @end itemize
  400. @node qemu_img_invocation
  401. @subsection @code{qemu-img} Invocation
  402. @include qemu-img.texi
  403. @node qemu_nbd_invocation
  404. @subsection @code{qemu-nbd} Invocation
  405. @include qemu-nbd.texi
  406. @node disk_images_formats
  407. @subsection Disk image file formats
  408. QEMU supports many image file formats that can be used with VMs as well as with
  409. any of the tools (like @code{qemu-img}). This includes the preferred formats
  410. raw and qcow2 as well as formats that are supported for compatibility with
  411. older QEMU versions or other hypervisors.
  412. Depending on the image format, different options can be passed to
  413. @code{qemu-img create} and @code{qemu-img convert} using the @code{-o} option.
  414. This section describes each format and the options that are supported for it.
  415. @table @option
  416. @item raw
  417. Raw disk image format. This format has the advantage of
  418. being simple and easily exportable to all other emulators. If your
  419. file system supports @emph{holes} (for example in ext2 or ext3 on
  420. Linux or NTFS on Windows), then only the written sectors will reserve
  421. space. Use @code{qemu-img info} to know the real size used by the
  422. image or @code{ls -ls} on Unix/Linux.
  423. @item qcow2
  424. QEMU image format, the most versatile format. Use it to have smaller
  425. images (useful if your filesystem does not supports holes, for example
  426. on Windows), optional AES encryption, zlib based compression and
  427. support of multiple VM snapshots.
  428. Supported options:
  429. @table @code
  430. @item compat
  431. Determines the qcow2 version to use. @code{compat=0.10} uses the
  432. traditional image format that can be read by any QEMU since 0.10.
  433. @code{compat=1.1} enables image format extensions that only QEMU 1.1 and
  434. newer understand (this is the default). Amongst others, this includes
  435. zero clusters, which allow efficient copy-on-read for sparse images.
  436. @item backing_file
  437. File name of a base image (see @option{create} subcommand)
  438. @item backing_fmt
  439. Image format of the base image
  440. @item encryption
  441. If this option is set to @code{on}, the image is encrypted with 128-bit AES-CBC.
  442. The use of encryption in qcow and qcow2 images is considered to be flawed by
  443. modern cryptography standards, suffering from a number of design problems:
  444. @itemize @minus
  445. @item The AES-CBC cipher is used with predictable initialization vectors based
  446. on the sector number. This makes it vulnerable to chosen plaintext attacks
  447. which can reveal the existence of encrypted data.
  448. @item The user passphrase is directly used as the encryption key. A poorly
  449. chosen or short passphrase will compromise the security of the encryption.
  450. @item In the event of the passphrase being compromised there is no way to
  451. change the passphrase to protect data in any qcow images. The files must
  452. be cloned, using a different encryption passphrase in the new file. The
  453. original file must then be securely erased using a program like shred,
  454. though even this is ineffective with many modern storage technologies.
  455. @end itemize
  456. Use of qcow / qcow2 encryption is thus strongly discouraged. Users are
  457. recommended to use an alternative encryption technology such as the
  458. Linux dm-crypt / LUKS system.
  459. @item cluster_size
  460. Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
  461. sizes can improve the image file size whereas larger cluster sizes generally
  462. provide better performance.
  463. @item preallocation
  464. Preallocation mode (allowed values: off, metadata). An image with preallocated
  465. metadata is initially larger but can improve performance when the image needs
  466. to grow.
  467. @item lazy_refcounts
  468. If this option is set to @code{on}, reference count updates are postponed with
  469. the goal of avoiding metadata I/O and improving performance. This is
  470. particularly interesting with @option{cache=writethrough} which doesn't batch
  471. metadata updates. The tradeoff is that after a host crash, the reference count
  472. tables must be rebuilt, i.e. on the next open an (automatic) @code{qemu-img
  473. check -r all} is required, which may take some time.
  474. This option can only be enabled if @code{compat=1.1} is specified.
  475. @item nocow
  476. If this option is set to @code{on}, it will turn off COW of the file. It's only
  477. valid on btrfs, no effect on other file systems.
  478. Btrfs has low performance when hosting a VM image file, even more when the guest
  479. on the VM also using btrfs as file system. Turning off COW is a way to mitigate
  480. this bad performance. Generally there are two ways to turn off COW on btrfs:
  481. a) Disable it by mounting with nodatacow, then all newly created files will be
  482. NOCOW. b) For an empty file, add the NOCOW file attribute. That's what this option
  483. does.
  484. Note: this option is only valid to new or empty files. If there is an existing
  485. file which is COW and has data blocks already, it couldn't be changed to NOCOW
  486. by setting @code{nocow=on}. One can issue @code{lsattr filename} to check if
  487. the NOCOW flag is set or not (Capital 'C' is NOCOW flag).
  488. @end table
  489. @item qed
  490. Old QEMU image format with support for backing files and compact image files
  491. (when your filesystem or transport medium does not support holes).
  492. When converting QED images to qcow2, you might want to consider using the
  493. @code{lazy_refcounts=on} option to get a more QED-like behaviour.
  494. Supported options:
  495. @table @code
  496. @item backing_file
  497. File name of a base image (see @option{create} subcommand).
  498. @item backing_fmt
  499. Image file format of backing file (optional). Useful if the format cannot be
  500. autodetected because it has no header, like some vhd/vpc files.
  501. @item cluster_size
  502. Changes the cluster size (must be power-of-2 between 4K and 64K). Smaller
  503. cluster sizes can improve the image file size whereas larger cluster sizes
  504. generally provide better performance.
  505. @item table_size
  506. Changes the number of clusters per L1/L2 table (must be power-of-2 between 1
  507. and 16). There is normally no need to change this value but this option can be
  508. used for performance benchmarking.
  509. @end table
  510. @item qcow
  511. Old QEMU image format with support for backing files, compact image files,
  512. encryption and compression.
  513. Supported options:
  514. @table @code
  515. @item backing_file
  516. File name of a base image (see @option{create} subcommand)
  517. @item encryption
  518. If this option is set to @code{on}, the image is encrypted.
  519. @end table
  520. @item cow
  521. User Mode Linux Copy On Write image format. It is supported only for
  522. compatibility with previous versions.
  523. Supported options:
  524. @table @code
  525. @item backing_file
  526. File name of a base image (see @option{create} subcommand)
  527. @end table
  528. @item vdi
  529. VirtualBox 1.1 compatible image format.
  530. Supported options:
  531. @table @code
  532. @item static
  533. If this option is set to @code{on}, the image is created with metadata
  534. preallocation.
  535. @end table
  536. @item vmdk
  537. VMware 3 and 4 compatible image format.
  538. Supported options:
  539. @table @code
  540. @item backing_file
  541. File name of a base image (see @option{create} subcommand).
  542. @item compat6
  543. Create a VMDK version 6 image (instead of version 4)
  544. @item subformat
  545. Specifies which VMDK subformat to use. Valid options are
  546. @code{monolithicSparse} (default),
  547. @code{monolithicFlat},
  548. @code{twoGbMaxExtentSparse},
  549. @code{twoGbMaxExtentFlat} and
  550. @code{streamOptimized}.
  551. @end table
  552. @item vpc
  553. VirtualPC compatible image format (VHD).
  554. Supported options:
  555. @table @code
  556. @item subformat
  557. Specifies which VHD subformat to use. Valid options are
  558. @code{dynamic} (default) and @code{fixed}.
  559. @end table
  560. @item VHDX
  561. Hyper-V compatible image format (VHDX).
  562. Supported options:
  563. @table @code
  564. @item subformat
  565. Specifies which VHDX subformat to use. Valid options are
  566. @code{dynamic} (default) and @code{fixed}.
  567. @item block_state_zero
  568. Force use of payload blocks of type 'ZERO'.
  569. @item block_size
  570. Block size; min 1 MB, max 256 MB. 0 means auto-calculate based on image size.
  571. @item log_size
  572. Log size; min 1 MB.
  573. @end table
  574. @end table
  575. @subsubsection Read-only formats
  576. More disk image file formats are supported in a read-only mode.
  577. @table @option
  578. @item bochs
  579. Bochs images of @code{growing} type.
  580. @item cloop
  581. Linux Compressed Loop image, useful only to reuse directly compressed
  582. CD-ROM images present for example in the Knoppix CD-ROMs.
  583. @item dmg
  584. Apple disk image.
  585. @item parallels
  586. Parallels disk image format.
  587. @end table
  588. @node host_drives
  589. @subsection Using host drives
  590. In addition to disk image files, QEMU can directly access host
  591. devices. We describe here the usage for QEMU version >= 0.8.3.
  592. @subsubsection Linux
  593. On Linux, you can directly use the host device filename instead of a
  594. disk image filename provided you have enough privileges to access
  595. it. For example, use @file{/dev/cdrom} to access to the CDROM or
  596. @file{/dev/fd0} for the floppy.
  597. @table @code
  598. @item CD
  599. You can specify a CDROM device even if no CDROM is loaded. QEMU has
  600. specific code to detect CDROM insertion or removal. CDROM ejection by
  601. the guest OS is supported. Currently only data CDs are supported.
  602. @item Floppy
  603. You can specify a floppy device even if no floppy is loaded. Floppy
  604. removal is currently not detected accurately (if you change floppy
  605. without doing floppy access while the floppy is not loaded, the guest
  606. OS will think that the same floppy is loaded).
  607. @item Hard disks
  608. Hard disks can be used. Normally you must specify the whole disk
  609. (@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
  610. see it as a partitioned disk. WARNING: unless you know what you do, it
  611. is better to only make READ-ONLY accesses to the hard disk otherwise
  612. you may corrupt your host data (use the @option{-snapshot} command
  613. line option or modify the device permissions accordingly).
  614. @end table
  615. @subsubsection Windows
  616. @table @code
  617. @item CD
  618. The preferred syntax is the drive letter (e.g. @file{d:}). The
  619. alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
  620. supported as an alias to the first CDROM drive.
  621. Currently there is no specific code to handle removable media, so it
  622. is better to use the @code{change} or @code{eject} monitor commands to
  623. change or eject media.
  624. @item Hard disks
  625. Hard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}
  626. where @var{N} is the drive number (0 is the first hard disk).
  627. WARNING: unless you know what you do, it is better to only make
  628. READ-ONLY accesses to the hard disk otherwise you may corrupt your
  629. host data (use the @option{-snapshot} command line so that the
  630. modifications are written in a temporary file).
  631. @end table
  632. @subsubsection Mac OS X
  633. @file{/dev/cdrom} is an alias to the first CDROM.
  634. Currently there is no specific code to handle removable media, so it
  635. is better to use the @code{change} or @code{eject} monitor commands to
  636. change or eject media.
  637. @node disk_images_fat_images
  638. @subsection Virtual FAT disk images
  639. QEMU can automatically create a virtual FAT disk image from a
  640. directory tree. In order to use it, just type:
  641. @example
  642. qemu-system-i386 linux.img -hdb fat:/my_directory
  643. @end example
  644. Then you access access to all the files in the @file{/my_directory}
  645. directory without having to copy them in a disk image or to export
  646. them via SAMBA or NFS. The default access is @emph{read-only}.
  647. Floppies can be emulated with the @code{:floppy:} option:
  648. @example
  649. qemu-system-i386 linux.img -fda fat:floppy:/my_directory
  650. @end example
  651. A read/write support is available for testing (beta stage) with the
  652. @code{:rw:} option:
  653. @example
  654. qemu-system-i386 linux.img -fda fat:floppy:rw:/my_directory
  655. @end example
  656. What you should @emph{never} do:
  657. @itemize
  658. @item use non-ASCII filenames ;
  659. @item use "-snapshot" together with ":rw:" ;
  660. @item expect it to work when loadvm'ing ;
  661. @item write to the FAT directory on the host system while accessing it with the guest system.
  662. @end itemize
  663. @node disk_images_nbd
  664. @subsection NBD access
  665. QEMU can access directly to block device exported using the Network Block Device
  666. protocol.
  667. @example
  668. qemu-system-i386 linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
  669. @end example
  670. If the NBD server is located on the same host, you can use an unix socket instead
  671. of an inet socket:
  672. @example
  673. qemu-system-i386 linux.img -hdb nbd+unix://?socket=/tmp/my_socket
  674. @end example
  675. In this case, the block device must be exported using qemu-nbd:
  676. @example
  677. qemu-nbd --socket=/tmp/my_socket my_disk.qcow2
  678. @end example
  679. The use of qemu-nbd allows sharing of a disk between several guests:
  680. @example
  681. qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
  682. @end example
  683. @noindent
  684. and then you can use it with two guests:
  685. @example
  686. qemu-system-i386 linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
  687. qemu-system-i386 linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
  688. @end example
  689. If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's
  690. own embedded NBD server), you must specify an export name in the URI:
  691. @example
  692. qemu-system-i386 -cdrom nbd://localhost/debian-500-ppc-netinst
  693. qemu-system-i386 -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
  694. @end example
  695. The URI syntax for NBD is supported since QEMU 1.3. An alternative syntax is
  696. also available. Here are some example of the older syntax:
  697. @example
  698. qemu-system-i386 linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
  699. qemu-system-i386 linux2.img -hdb nbd:unix:/tmp/my_socket
  700. qemu-system-i386 -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
  701. @end example
  702. @node disk_images_sheepdog
  703. @subsection Sheepdog disk images
  704. Sheepdog is a distributed storage system for QEMU. It provides highly
  705. available block level storage volumes that can be attached to
  706. QEMU-based virtual machines.
  707. You can create a Sheepdog disk image with the command:
  708. @example
  709. qemu-img create sheepdog:///@var{image} @var{size}
  710. @end example
  711. where @var{image} is the Sheepdog image name and @var{size} is its
  712. size.
  713. To import the existing @var{filename} to Sheepdog, you can use a
  714. convert command.
  715. @example
  716. qemu-img convert @var{filename} sheepdog:///@var{image}
  717. @end example
  718. You can boot from the Sheepdog disk image with the command:
  719. @example
  720. qemu-system-i386 sheepdog:///@var{image}
  721. @end example
  722. You can also create a snapshot of the Sheepdog image like qcow2.
  723. @example
  724. qemu-img snapshot -c @var{tag} sheepdog:///@var{image}
  725. @end example
  726. where @var{tag} is a tag name of the newly created snapshot.
  727. To boot from the Sheepdog snapshot, specify the tag name of the
  728. snapshot.
  729. @example
  730. qemu-system-i386 sheepdog:///@var{image}#@var{tag}
  731. @end example
  732. You can create a cloned image from the existing snapshot.
  733. @example
  734. qemu-img create -b sheepdog:///@var{base}#@var{tag} sheepdog:///@var{image}
  735. @end example
  736. where @var{base} is a image name of the source snapshot and @var{tag}
  737. is its tag name.
  738. You can use an unix socket instead of an inet socket:
  739. @example
  740. qemu-system-i386 sheepdog+unix:///@var{image}?socket=@var{path}
  741. @end example
  742. If the Sheepdog daemon doesn't run on the local host, you need to
  743. specify one of the Sheepdog servers to connect to.
  744. @example
  745. qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size}
  746. qemu-system-i386 sheepdog://@var{hostname}:@var{port}/@var{image}
  747. @end example
  748. @node disk_images_iscsi
  749. @subsection iSCSI LUNs
  750. iSCSI is a popular protocol used to access SCSI devices across a computer
  751. network.
  752. There are two different ways iSCSI devices can be used by QEMU.
  753. The first method is to mount the iSCSI LUN on the host, and make it appear as
  754. any other ordinary SCSI device on the host and then to access this device as a
  755. /dev/sd device from QEMU. How to do this differs between host OSes.
  756. The second method involves using the iSCSI initiator that is built into
  757. QEMU. This provides a mechanism that works the same way regardless of which
  758. host OS you are running QEMU on. This section will describe this second method
  759. of using iSCSI together with QEMU.
  760. In QEMU, iSCSI devices are described using special iSCSI URLs
  761. @example
  762. URL syntax:
  763. iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
  764. @end example
  765. Username and password are optional and only used if your target is set up
  766. using CHAP authentication for access control.
  767. Alternatively the username and password can also be set via environment
  768. variables to have these not show up in the process list
  769. @example
  770. export LIBISCSI_CHAP_USERNAME=<username>
  771. export LIBISCSI_CHAP_PASSWORD=<password>
  772. iscsi://<host>/<target-iqn-name>/<lun>
  773. @end example
  774. Various session related parameters can be set via special options, either
  775. in a configuration file provided via '-readconfig' or directly on the
  776. command line.
  777. If the initiator-name is not specified qemu will use a default name
  778. of 'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
  779. virtual machine.
  780. @example
  781. Setting a specific initiator name to use when logging in to the target
  782. -iscsi initiator-name=iqn.qemu.test:my-initiator
  783. @end example
  784. @example
  785. Controlling which type of header digest to negotiate with the target
  786. -iscsi header-digest=CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
  787. @end example
  788. These can also be set via a configuration file
  789. @example
  790. [iscsi]
  791. user = "CHAP username"
  792. password = "CHAP password"
  793. initiator-name = "iqn.qemu.test:my-initiator"
  794. # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
  795. header-digest = "CRC32C"
  796. @end example
  797. Setting the target name allows different options for different targets
  798. @example
  799. [iscsi "iqn.target.name"]
  800. user = "CHAP username"
  801. password = "CHAP password"
  802. initiator-name = "iqn.qemu.test:my-initiator"
  803. # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
  804. header-digest = "CRC32C"
  805. @end example
  806. Howto use a configuration file to set iSCSI configuration options:
  807. @example
  808. cat >iscsi.conf <<EOF
  809. [iscsi]
  810. user = "me"
  811. password = "my password"
  812. initiator-name = "iqn.qemu.test:my-initiator"
  813. header-digest = "CRC32C"
  814. EOF
  815. qemu-system-i386 -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
  816. -readconfig iscsi.conf
  817. @end example
  818. Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
  819. @example
  820. This example shows how to set up an iSCSI target with one CDROM and one DISK
  821. using the Linux STGT software target. This target is available on Red Hat based
  822. systems as the package 'scsi-target-utils'.
  823. tgtd --iscsi portal=127.0.0.1:3260
  824. tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
  825. tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
  826. -b /IMAGES/disk.img --device-type=disk
  827. tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
  828. -b /IMAGES/cd.iso --device-type=cd
  829. tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
  830. qemu-system-i386 -iscsi initiator-name=iqn.qemu.test:my-initiator \
  831. -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
  832. -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
  833. @end example
  834. @node disk_images_gluster
  835. @subsection GlusterFS disk images
  836. GlusterFS is an user space distributed file system.
  837. You can boot from the GlusterFS disk image with the command:
  838. @example
  839. qemu-system-x86_64 -drive file=gluster[+@var{transport}]://[@var{server}[:@var{port}]]/@var{volname}/@var{image}[?socket=...]
  840. @end example
  841. @var{gluster} is the protocol.
  842. @var{transport} specifies the transport type used to connect to gluster
  843. management daemon (glusterd). Valid transport types are
  844. tcp, unix and rdma. If a transport type isn't specified, then tcp
  845. type is assumed.
  846. @var{server} specifies the server where the volume file specification for
  847. the given volume resides. This can be either hostname, ipv4 address
  848. or ipv6 address. ipv6 address needs to be within square brackets [ ].
  849. If transport type is unix, then @var{server} field should not be specifed.
  850. Instead @var{socket} field needs to be populated with the path to unix domain
  851. socket.
  852. @var{port} is the port number on which glusterd is listening. This is optional
  853. and if not specified, QEMU will send 0 which will make gluster to use the
  854. default port. If the transport type is unix, then @var{port} should not be
  855. specified.
  856. @var{volname} is the name of the gluster volume which contains the disk image.
  857. @var{image} is the path to the actual disk image that resides on gluster volume.
  858. You can create a GlusterFS disk image with the command:
  859. @example
  860. qemu-img create gluster://@var{server}/@var{volname}/@var{image} @var{size}
  861. @end example
  862. Examples
  863. @example
  864. qemu-system-x86_64 -drive file=gluster://1.2.3.4/testvol/a.img
  865. qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4/testvol/a.img
  866. qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
  867. qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
  868. qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
  869. qemu-system-x86_64 -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
  870. qemu-system-x86_64 -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
  871. qemu-system-x86_64 -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
  872. @end example
  873. @node disk_images_ssh
  874. @subsection Secure Shell (ssh) disk images
  875. You can access disk images located on a remote ssh server
  876. by using the ssh protocol:
  877. @example
  878. qemu-system-x86_64 -drive file=ssh://[@var{user}@@]@var{server}[:@var{port}]/@var{path}[?host_key_check=@var{host_key_check}]
  879. @end example
  880. Alternative syntax using properties:
  881. @example
  882. qemu-system-x86_64 -drive file.driver=ssh[,file.user=@var{user}],file.host=@var{server}[,file.port=@var{port}],file.path=@var{path}[,file.host_key_check=@var{host_key_check}]
  883. @end example
  884. @var{ssh} is the protocol.
  885. @var{user} is the remote user. If not specified, then the local
  886. username is tried.
  887. @var{server} specifies the remote ssh server. Any ssh server can be
  888. used, but it must implement the sftp-server protocol. Most Unix/Linux
  889. systems should work without requiring any extra configuration.
  890. @var{port} is the port number on which sshd is listening. By default
  891. the standard ssh port (22) is used.
  892. @var{path} is the path to the disk image.
  893. The optional @var{host_key_check} parameter controls how the remote
  894. host's key is checked. The default is @code{yes} which means to use
  895. the local @file{.ssh/known_hosts} file. Setting this to @code{no}
  896. turns off known-hosts checking. Or you can check that the host key
  897. matches a specific fingerprint:
  898. @code{host_key_check=md5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8}
  899. (@code{sha1:} can also be used as a prefix, but note that OpenSSH
  900. tools only use MD5 to print fingerprints).
  901. Currently authentication must be done using ssh-agent. Other
  902. authentication methods may be supported in future.
  903. Note: Many ssh servers do not support an @code{fsync}-style operation.
  904. The ssh driver cannot guarantee that disk flush requests are
  905. obeyed, and this causes a risk of disk corruption if the remote
  906. server or network goes down during writes. The driver will
  907. print a warning when @code{fsync} is not supported:
  908. warning: ssh server @code{ssh.example.com:22} does not support fsync
  909. With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is
  910. supported.
  911. @node pcsys_network
  912. @section Network emulation
  913. QEMU can simulate several network cards (PCI or ISA cards on the PC
  914. target) and can connect them to an arbitrary number of Virtual Local
  915. Area Networks (VLANs). Host TAP devices can be connected to any QEMU
  916. VLAN. VLAN can be connected between separate instances of QEMU to
  917. simulate large networks. For simpler usage, a non privileged user mode
  918. network stack can replace the TAP device to have a basic network
  919. connection.
  920. @subsection VLANs
  921. QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
  922. connection between several network devices. These devices can be for
  923. example QEMU virtual Ethernet cards or virtual Host ethernet devices
  924. (TAP devices).
  925. @subsection Using TAP network interfaces
  926. This is the standard way to connect QEMU to a real network. QEMU adds
  927. a virtual network device on your host (called @code{tapN}), and you
  928. can then configure it as if it was a real ethernet card.
  929. @subsubsection Linux host
  930. As an example, you can download the @file{linux-test-xxx.tar.gz}
  931. archive and copy the script @file{qemu-ifup} in @file{/etc} and
  932. configure properly @code{sudo} so that the command @code{ifconfig}
  933. contained in @file{qemu-ifup} can be executed as root. You must verify
  934. that your host kernel supports the TAP network interfaces: the
  935. device @file{/dev/net/tun} must be present.
  936. See @ref{sec_invocation} to have examples of command lines using the
  937. TAP network interfaces.
  938. @subsubsection Windows host
  939. There is a virtual ethernet driver for Windows 2000/XP systems, called
  940. TAP-Win32. But it is not included in standard QEMU for Windows,
  941. so you will need to get it separately. It is part of OpenVPN package,
  942. so download OpenVPN from : @url{http://openvpn.net/}.
  943. @subsection Using the user mode network stack
  944. By using the option @option{-net user} (default configuration if no
  945. @option{-net} option is specified), QEMU uses a completely user mode
  946. network stack (you don't need root privilege to use the virtual
  947. network). The virtual network configuration is the following:
  948. @example
  949. QEMU VLAN <------> Firewall/DHCP server <-----> Internet
  950. | (10.0.2.2)
  951. |
  952. ----> DNS server (10.0.2.3)
  953. |
  954. ----> SMB server (10.0.2.4)
  955. @end example
  956. The QEMU VM behaves as if it was behind a firewall which blocks all
  957. incoming connections. You can use a DHCP client to automatically
  958. configure the network in the QEMU VM. The DHCP server assign addresses
  959. to the hosts starting from 10.0.2.15.
  960. In order to check that the user mode network is working, you can ping
  961. the address 10.0.2.2 and verify that you got an address in the range
  962. 10.0.2.x from the QEMU virtual DHCP server.
  963. Note that ICMP traffic in general does not work with user mode networking.
  964. @code{ping}, aka. ICMP echo, to the local router (10.0.2.2) shall work,
  965. however. If you're using QEMU on Linux >= 3.0, it can use unprivileged ICMP
  966. ping sockets to allow @code{ping} to the Internet. The host admin has to set
  967. the ping_group_range in order to grant access to those sockets. To allow ping
  968. for GID 100 (usually users group):
  969. @example
  970. echo 100 100 > /proc/sys/net/ipv4/ping_group_range
  971. @end example
  972. When using the built-in TFTP server, the router is also the TFTP
  973. server.
  974. When using the @option{-redir} option, TCP or UDP connections can be
  975. redirected from the host to the guest. It allows for example to
  976. redirect X11, telnet or SSH connections.
  977. @subsection Connecting VLANs between QEMU instances
  978. Using the @option{-net socket} option, it is possible to make VLANs
  979. that span several QEMU instances. See @ref{sec_invocation} to have a
  980. basic example.
  981. @node pcsys_other_devs
  982. @section Other Devices
  983. @subsection Inter-VM Shared Memory device
  984. With KVM enabled on a Linux host, a shared memory device is available. Guests
  985. map a POSIX shared memory region into the guest as a PCI device that enables
  986. zero-copy communication to the application level of the guests. The basic
  987. syntax is:
  988. @example
  989. qemu-system-i386 -device ivshmem,size=<size in format accepted by -m>[,shm=<shm name>]
  990. @end example
  991. If desired, interrupts can be sent between guest VMs accessing the same shared
  992. memory region. Interrupt support requires using a shared memory server and
  993. using a chardev socket to connect to it. The code for the shared memory server
  994. is qemu.git/contrib/ivshmem-server. An example syntax when using the shared
  995. memory server is:
  996. @example
  997. qemu-system-i386 -device ivshmem,size=<size in format accepted by -m>[,chardev=<id>]
  998. [,msi=on][,ioeventfd=on][,vectors=n][,role=peer|master]
  999. qemu-system-i386 -chardev socket,path=<path>,id=<id>
  1000. @end example
  1001. When using the server, the guest will be assigned a VM ID (>=0) that allows guests
  1002. using the same server to communicate via interrupts. Guests can read their
  1003. VM ID from a device register (see example code). Since receiving the shared
  1004. memory region from the server is asynchronous, there is a (small) chance the
  1005. guest may boot before the shared memory is attached. To allow an application
  1006. to ensure shared memory is attached, the VM ID register will return -1 (an
  1007. invalid VM ID) until the memory is attached. Once the shared memory is
  1008. attached, the VM ID will return the guest's valid VM ID. With these semantics,
  1009. the guest application can check to ensure the shared memory is attached to the
  1010. guest before proceeding.
  1011. The @option{role} argument can be set to either master or peer and will affect
  1012. how the shared memory is migrated. With @option{role=master}, the guest will
  1013. copy the shared memory on migration to the destination host. With
  1014. @option{role=peer}, the guest will not be able to migrate with the device attached.
  1015. With the @option{peer} case, the device should be detached and then reattached
  1016. after migration using the PCI hotplug support.
  1017. @node direct_linux_boot
  1018. @section Direct Linux Boot
  1019. This section explains how to launch a Linux kernel inside QEMU without
  1020. having to make a full bootable image. It is very useful for fast Linux
  1021. kernel testing.
  1022. The syntax is:
  1023. @example
  1024. qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
  1025. @end example
  1026. Use @option{-kernel} to provide the Linux kernel image and
  1027. @option{-append} to give the kernel command line arguments. The
  1028. @option{-initrd} option can be used to provide an INITRD image.
  1029. When using the direct Linux boot, a disk image for the first hard disk
  1030. @file{hda} is required because its boot sector is used to launch the
  1031. Linux kernel.
  1032. If you do not need graphical output, you can disable it and redirect
  1033. the virtual serial port and the QEMU monitor to the console with the
  1034. @option{-nographic} option. The typical command line is:
  1035. @example
  1036. qemu-system-i386 -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
  1037. -append "root=/dev/hda console=ttyS0" -nographic
  1038. @end example
  1039. Use @key{Ctrl-a c} to switch between the serial console and the
  1040. monitor (@pxref{pcsys_keys}).
  1041. @node pcsys_usb
  1042. @section USB emulation
  1043. QEMU emulates a PCI UHCI USB controller. You can virtually plug
  1044. virtual USB devices or real host USB devices (experimental, works only
  1045. on Linux hosts). QEMU will automatically create and connect virtual USB hubs
  1046. as necessary to connect multiple USB devices.
  1047. @menu
  1048. * usb_devices::
  1049. * host_usb_devices::
  1050. @end menu
  1051. @node usb_devices
  1052. @subsection Connecting USB devices
  1053. USB devices can be connected with the @option{-usbdevice} commandline option
  1054. or the @code{usb_add} monitor command. Available devices are:
  1055. @table @code
  1056. @item mouse
  1057. Virtual Mouse. This will override the PS/2 mouse emulation when activated.
  1058. @item tablet
  1059. Pointer device that uses absolute coordinates (like a touchscreen).
  1060. This means QEMU is able to report the mouse position without having
  1061. to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
  1062. @item disk:@var{file}
  1063. Mass storage device based on @var{file} (@pxref{disk_images})
  1064. @item host:@var{bus.addr}
  1065. Pass through the host device identified by @var{bus.addr}
  1066. (Linux only)
  1067. @item host:@var{vendor_id:product_id}
  1068. Pass through the host device identified by @var{vendor_id:product_id}
  1069. (Linux only)
  1070. @item wacom-tablet
  1071. Virtual Wacom PenPartner tablet. This device is similar to the @code{tablet}
  1072. above but it can be used with the tslib library because in addition to touch
  1073. coordinates it reports touch pressure.
  1074. @item keyboard
  1075. Standard USB keyboard. Will override the PS/2 keyboard (if present).
  1076. @item serial:[vendorid=@var{vendor_id}][,product_id=@var{product_id}]:@var{dev}
  1077. Serial converter. This emulates an FTDI FT232BM chip connected to host character
  1078. device @var{dev}. The available character devices are the same as for the
  1079. @code{-serial} option. The @code{vendorid} and @code{productid} options can be
  1080. used to override the default 0403:6001. For instance,
  1081. @example
  1082. usb_add serial:productid=FA00:tcp:192.168.0.2:4444
  1083. @end example
  1084. will connect to tcp port 4444 of ip 192.168.0.2, and plug that to the virtual
  1085. serial converter, faking a Matrix Orbital LCD Display (USB ID 0403:FA00).
  1086. @item braille
  1087. Braille device. This will use BrlAPI to display the braille output on a real
  1088. or fake device.
  1089. @item net:@var{options}
  1090. Network adapter that supports CDC ethernet and RNDIS protocols. @var{options}
  1091. specifies NIC options as with @code{-net nic,}@var{options} (see description).
  1092. For instance, user-mode networking can be used with
  1093. @example
  1094. qemu-system-i386 [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0
  1095. @end example
  1096. Currently this cannot be used in machines that support PCI NICs.
  1097. @item bt[:@var{hci-type}]
  1098. Bluetooth dongle whose type is specified in the same format as with
  1099. the @option{-bt hci} option, @pxref{bt-hcis,,allowed HCI types}. If
  1100. no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}.
  1101. This USB device implements the USB Transport Layer of HCI. Example
  1102. usage:
  1103. @example
  1104. qemu-system-i386 [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3
  1105. @end example
  1106. @end table
  1107. @node host_usb_devices
  1108. @subsection Using host USB devices on a Linux host
  1109. WARNING: this is an experimental feature. QEMU will slow down when
  1110. using it. USB devices requiring real time streaming (i.e. USB Video
  1111. Cameras) are not supported yet.
  1112. @enumerate
  1113. @item If you use an early Linux 2.4 kernel, verify that no Linux driver
  1114. is actually using the USB device. A simple way to do that is simply to
  1115. disable the corresponding kernel module by renaming it from @file{mydriver.o}
  1116. to @file{mydriver.o.disabled}.
  1117. @item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
  1118. @example
  1119. ls /proc/bus/usb
  1120. 001 devices drivers
  1121. @end example
  1122. @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:
  1123. @example
  1124. chown -R myuid /proc/bus/usb
  1125. @end example
  1126. @item Launch QEMU and do in the monitor:
  1127. @example
  1128. info usbhost
  1129. Device 1.2, speed 480 Mb/s
  1130. Class 00: USB device 1234:5678, USB DISK
  1131. @end example
  1132. You should see the list of the devices you can use (Never try to use
  1133. hubs, it won't work).
  1134. @item Add the device in QEMU by using:
  1135. @example
  1136. usb_add host:1234:5678
  1137. @end example
  1138. Normally the guest OS should report that a new USB device is
  1139. plugged. You can use the option @option{-usbdevice} to do the same.
  1140. @item Now you can try to use the host USB device in QEMU.
  1141. @end enumerate
  1142. When relaunching QEMU, you may have to unplug and plug again the USB
  1143. device to make it work again (this is a bug).
  1144. @node vnc_security
  1145. @section VNC security
  1146. The VNC server capability provides access to the graphical console
  1147. of the guest VM across the network. This has a number of security
  1148. considerations depending on the deployment scenarios.
  1149. @menu
  1150. * vnc_sec_none::
  1151. * vnc_sec_password::
  1152. * vnc_sec_certificate::
  1153. * vnc_sec_certificate_verify::
  1154. * vnc_sec_certificate_pw::
  1155. * vnc_sec_sasl::
  1156. * vnc_sec_certificate_sasl::
  1157. * vnc_generate_cert::
  1158. * vnc_setup_sasl::
  1159. @end menu
  1160. @node vnc_sec_none
  1161. @subsection Without passwords
  1162. The simplest VNC server setup does not include any form of authentication.
  1163. For this setup it is recommended to restrict it to listen on a UNIX domain
  1164. socket only. For example
  1165. @example
  1166. qemu-system-i386 [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc
  1167. @end example
  1168. This ensures that only users on local box with read/write access to that
  1169. path can access the VNC server. To securely access the VNC server from a
  1170. remote machine, a combination of netcat+ssh can be used to provide a secure
  1171. tunnel.
  1172. @node vnc_sec_password
  1173. @subsection With passwords
  1174. The VNC protocol has limited support for password based authentication. Since
  1175. the protocol limits passwords to 8 characters it should not be considered
  1176. to provide high security. The password can be fairly easily brute-forced by
  1177. a client making repeat connections. For this reason, a VNC server using password
  1178. authentication should be restricted to only listen on the loopback interface
  1179. or UNIX domain sockets. Password authentication is not supported when operating
  1180. in FIPS 140-2 compliance mode as it requires the use of the DES cipher. Password
  1181. authentication is requested with the @code{password} option, and then once QEMU
  1182. is running the password is set with the monitor. Until the monitor is used to
  1183. set the password all clients will be rejected.
  1184. @example
  1185. qemu-system-i386 [...OPTIONS...] -vnc :1,password -monitor stdio
  1186. (qemu) change vnc password
  1187. Password: ********
  1188. (qemu)
  1189. @end example
  1190. @node vnc_sec_certificate
  1191. @subsection With x509 certificates
  1192. The QEMU VNC server also implements the VeNCrypt extension allowing use of
  1193. TLS for encryption of the session, and x509 certificates for authentication.
  1194. The use of x509 certificates is strongly recommended, because TLS on its
  1195. own is susceptible to man-in-the-middle attacks. Basic x509 certificate
  1196. support provides a secure session, but no authentication. This allows any
  1197. client to connect, and provides an encrypted session.
  1198. @example
  1199. qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio
  1200. @end example
  1201. In the above example @code{/etc/pki/qemu} should contain at least three files,
  1202. @code{ca-cert.pem}, @code{server-cert.pem} and @code{server-key.pem}. Unprivileged
  1203. users will want to use a private directory, for example @code{$HOME/.pki/qemu}.
  1204. NB the @code{server-key.pem} file should be protected with file mode 0600 to
  1205. only be readable by the user owning it.
  1206. @node vnc_sec_certificate_verify
  1207. @subsection With x509 certificates and client verification
  1208. Certificates can also provide a means to authenticate the client connecting.
  1209. The server will request that the client provide a certificate, which it will
  1210. then validate against the CA certificate. This is a good choice if deploying
  1211. in an environment with a private internal certificate authority.
  1212. @example
  1213. qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio
  1214. @end example
  1215. @node vnc_sec_certificate_pw
  1216. @subsection With x509 certificates, client verification and passwords
  1217. Finally, the previous method can be combined with VNC password authentication
  1218. to provide two layers of authentication for clients.
  1219. @example
  1220. qemu-system-i386 [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio
  1221. (qemu) change vnc password
  1222. Password: ********
  1223. (qemu)
  1224. @end example
  1225. @node vnc_sec_sasl
  1226. @subsection With SASL authentication
  1227. The SASL authentication method is a VNC extension, that provides an
  1228. easily extendable, pluggable authentication method. This allows for
  1229. integration with a wide range of authentication mechanisms, such as
  1230. PAM, GSSAPI/Kerberos, LDAP, SQL databases, one-time keys and more.
  1231. The strength of the authentication depends on the exact mechanism
  1232. configured. If the chosen mechanism also provides a SSF layer, then
  1233. it will encrypt the datastream as well.
  1234. Refer to the later docs on how to choose the exact SASL mechanism
  1235. used for authentication, but assuming use of one supporting SSF,
  1236. then QEMU can be launched with:
  1237. @example
  1238. qemu-system-i386 [...OPTIONS...] -vnc :1,sasl -monitor stdio
  1239. @end example
  1240. @node vnc_sec_certificate_sasl
  1241. @subsection With x509 certificates and SASL authentication
  1242. If the desired SASL authentication mechanism does not supported
  1243. SSF layers, then it is strongly advised to run it in combination
  1244. with TLS and x509 certificates. This provides securely encrypted
  1245. data stream, avoiding risk of compromising of the security
  1246. credentials. This can be enabled, by combining the 'sasl' option
  1247. with the aforementioned TLS + x509 options:
  1248. @example
  1249. qemu-system-i386 [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio
  1250. @end example
  1251. @node vnc_generate_cert
  1252. @subsection Generating certificates for VNC
  1253. The GNU TLS packages provides a command called @code{certtool} which can
  1254. be used to generate certificates and keys in PEM format. At a minimum it
  1255. is necessary to setup a certificate authority, and issue certificates to
  1256. each server. If using certificates for authentication, then each client
  1257. will also need to be issued a certificate. The recommendation is for the
  1258. server to keep its certificates in either @code{/etc/pki/qemu} or for
  1259. unprivileged users in @code{$HOME/.pki/qemu}.
  1260. @menu
  1261. * vnc_generate_ca::
  1262. * vnc_generate_server::
  1263. * vnc_generate_client::
  1264. @end menu
  1265. @node vnc_generate_ca
  1266. @subsubsection Setup the Certificate Authority
  1267. This step only needs to be performed once per organization / organizational
  1268. unit. First the CA needs a private key. This key must be kept VERY secret
  1269. and secure. If this key is compromised the entire trust chain of the certificates
  1270. issued with it is lost.
  1271. @example
  1272. # certtool --generate-privkey > ca-key.pem
  1273. @end example
  1274. A CA needs to have a public certificate. For simplicity it can be a self-signed
  1275. certificate, or one issue by a commercial certificate issuing authority. To
  1276. generate a self-signed certificate requires one core piece of information, the
  1277. name of the organization.
  1278. @example
  1279. # cat > ca.info <<EOF
  1280. cn = Name of your organization
  1281. ca
  1282. cert_signing_key
  1283. EOF
  1284. # certtool --generate-self-signed \
  1285. --load-privkey ca-key.pem
  1286. --template ca.info \
  1287. --outfile ca-cert.pem
  1288. @end example
  1289. The @code{ca-cert.pem} file should be copied to all servers and clients wishing to utilize
  1290. TLS support in the VNC server. The @code{ca-key.pem} must not be disclosed/copied at all.
  1291. @node vnc_generate_server
  1292. @subsubsection Issuing server certificates
  1293. Each server (or host) needs to be issued with a key and certificate. When connecting
  1294. the certificate is sent to the client which validates it against the CA certificate.
  1295. The core piece of information for a server certificate is the hostname. This should
  1296. be the fully qualified hostname that the client will connect with, since the client
  1297. will typically also verify the hostname in the certificate. On the host holding the
  1298. secure CA private key:
  1299. @example
  1300. # cat > server.info <<EOF
  1301. organization = Name of your organization
  1302. cn = server.foo.example.com
  1303. tls_www_server
  1304. encryption_key
  1305. signing_key
  1306. EOF
  1307. # certtool --generate-privkey > server-key.pem
  1308. # certtool --generate-certificate \
  1309. --load-ca-certificate ca-cert.pem \
  1310. --load-ca-privkey ca-key.pem \
  1311. --load-privkey server server-key.pem \
  1312. --template server.info \
  1313. --outfile server-cert.pem
  1314. @end example
  1315. The @code{server-key.pem} and @code{server-cert.pem} files should now be securely copied
  1316. to the server for which they were generated. The @code{server-key.pem} is security
  1317. sensitive and should be kept protected with file mode 0600 to prevent disclosure.
  1318. @node vnc_generate_client
  1319. @subsubsection Issuing client certificates
  1320. If the QEMU VNC server is to use the @code{x509verify} option to validate client
  1321. certificates as its authentication mechanism, each client also needs to be issued
  1322. a certificate. The client certificate contains enough metadata to uniquely identify
  1323. the client, typically organization, state, city, building, etc. On the host holding
  1324. the secure CA private key:
  1325. @example
  1326. # cat > client.info <<EOF
  1327. country = GB
  1328. state = London
  1329. locality = London
  1330. organiazation = Name of your organization
  1331. cn = client.foo.example.com
  1332. tls_www_client
  1333. encryption_key
  1334. signing_key
  1335. EOF
  1336. # certtool --generate-privkey > client-key.pem
  1337. # certtool --generate-certificate \
  1338. --load-ca-certificate ca-cert.pem \
  1339. --load-ca-privkey ca-key.pem \
  1340. --load-privkey client-key.pem \
  1341. --template client.info \
  1342. --outfile client-cert.pem
  1343. @end example
  1344. The @code{client-key.pem} and @code{client-cert.pem} files should now be securely
  1345. copied to the client for which they were generated.
  1346. @node vnc_setup_sasl
  1347. @subsection Configuring SASL mechanisms
  1348. The following documentation assumes use of the Cyrus SASL implementation on a
  1349. Linux host, but the principals should apply to any other SASL impl. When SASL
  1350. is enabled, the mechanism configuration will be loaded from system default
  1351. SASL service config /etc/sasl2/qemu.conf. If running QEMU as an
  1352. unprivileged user, an environment variable SASL_CONF_PATH can be used
  1353. to make it search alternate locations for the service config.
  1354. The default configuration might contain
  1355. @example
  1356. mech_list: digest-md5
  1357. sasldb_path: /etc/qemu/passwd.db
  1358. @end example
  1359. This says to use the 'Digest MD5' mechanism, which is similar to the HTTP
  1360. Digest-MD5 mechanism. The list of valid usernames & passwords is maintained
  1361. in the /etc/qemu/passwd.db file, and can be updated using the saslpasswd2
  1362. command. While this mechanism is easy to configure and use, it is not
  1363. considered secure by modern standards, so only suitable for developers /
  1364. ad-hoc testing.
  1365. A more serious deployment might use Kerberos, which is done with the 'gssapi'
  1366. mechanism
  1367. @example
  1368. mech_list: gssapi
  1369. keytab: /etc/qemu/krb5.tab
  1370. @end example
  1371. For this to work the administrator of your KDC must generate a Kerberos
  1372. principal for the server, with a name of 'qemu/somehost.example.com@@EXAMPLE.COM'
  1373. replacing 'somehost.example.com' with the fully qualified host name of the
  1374. machine running QEMU, and 'EXAMPLE.COM' with the Kerberos Realm.
  1375. Other configurations will be left as an exercise for the reader. It should
  1376. be noted that only Digest-MD5 and GSSAPI provides a SSF layer for data
  1377. encryption. For all other mechanisms, VNC should always be configured to
  1378. use TLS and x509 certificates to protect security credentials from snooping.
  1379. @node gdb_usage
  1380. @section GDB usage
  1381. QEMU has a primitive support to work with gdb, so that you can do
  1382. 'Ctrl-C' while the virtual machine is running and inspect its state.
  1383. In order to use gdb, launch QEMU with the '-s' option. It will wait for a
  1384. gdb connection:
  1385. @example
  1386. qemu-system-i386 -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
  1387. -append "root=/dev/hda"
  1388. Connected to host network interface: tun0
  1389. Waiting gdb connection on port 1234
  1390. @end example
  1391. Then launch gdb on the 'vmlinux' executable:
  1392. @example
  1393. > gdb vmlinux
  1394. @end example
  1395. In gdb, connect to QEMU:
  1396. @example
  1397. (gdb) target remote localhost:1234
  1398. @end example
  1399. Then you can use gdb normally. For example, type 'c' to launch the kernel:
  1400. @example
  1401. (gdb) c
  1402. @end example
  1403. Here are some useful tips in order to use gdb on system code:
  1404. @enumerate
  1405. @item
  1406. Use @code{info reg} to display all the CPU registers.
  1407. @item
  1408. Use @code{x/10i $eip} to display the code at the PC position.
  1409. @item
  1410. Use @code{set architecture i8086} to dump 16 bit code. Then use
  1411. @code{x/10i $cs*16+$eip} to dump the code at the PC position.
  1412. @end enumerate
  1413. Advanced debugging options:
  1414. The default single stepping behavior is step with the IRQs and timer service routines off. It is set this way because when gdb executes a single step it expects to advance beyond the current instruction. With the IRQs and and timer service routines on, a single step might jump into the one of the interrupt or exception vectors instead of executing the current instruction. This means you may hit the same breakpoint a number of times before executing the instruction gdb wants to have executed. Because there are rare circumstances where you want to single step into an interrupt vector the behavior can be controlled from GDB. There are three commands you can query and set the single step behavior:
  1415. @table @code
  1416. @item maintenance packet qqemu.sstepbits
  1417. This will display the MASK bits used to control the single stepping IE:
  1418. @example
  1419. (gdb) maintenance packet qqemu.sstepbits
  1420. sending: "qqemu.sstepbits"
  1421. received: "ENABLE=1,NOIRQ=2,NOTIMER=4"
  1422. @end example
  1423. @item maintenance packet qqemu.sstep
  1424. This will display the current value of the mask used when single stepping IE:
  1425. @example
  1426. (gdb) maintenance packet qqemu.sstep
  1427. sending: "qqemu.sstep"
  1428. received: "0x7"
  1429. @end example
  1430. @item maintenance packet Qqemu.sstep=HEX_VALUE
  1431. This will change the single step mask, so if wanted to enable IRQs on the single step, but not timers, you would use:
  1432. @example
  1433. (gdb) maintenance packet Qqemu.sstep=0x5
  1434. sending: "qemu.sstep=0x5"
  1435. received: "OK"
  1436. @end example
  1437. @end table
  1438. @node pcsys_os_specific
  1439. @section Target OS specific information
  1440. @subsection Linux
  1441. To have access to SVGA graphic modes under X11, use the @code{vesa} or
  1442. the @code{cirrus} X11 driver. For optimal performances, use 16 bit
  1443. color depth in the guest and the host OS.
  1444. When using a 2.6 guest Linux kernel, you should add the option
  1445. @code{clock=pit} on the kernel command line because the 2.6 Linux
  1446. kernels make very strict real time clock checks by default that QEMU
  1447. cannot simulate exactly.
  1448. When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
  1449. not activated because QEMU is slower with this patch. The QEMU
  1450. Accelerator Module is also much slower in this case. Earlier Fedora
  1451. Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporate this
  1452. patch by default. Newer kernels don't have it.
  1453. @subsection Windows
  1454. If you have a slow host, using Windows 95 is better as it gives the
  1455. best speed. Windows 2000 is also a good choice.
  1456. @subsubsection SVGA graphic modes support
  1457. QEMU emulates a Cirrus Logic GD5446 Video
  1458. card. All Windows versions starting from Windows 95 should recognize
  1459. and use this graphic card. For optimal performances, use 16 bit color
  1460. depth in the guest and the host OS.
  1461. If you are using Windows XP as guest OS and if you want to use high
  1462. resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
  1463. 1280x1024x16), then you should use the VESA VBE virtual graphic card
  1464. (option @option{-std-vga}).
  1465. @subsubsection CPU usage reduction
  1466. Windows 9x does not correctly use the CPU HLT
  1467. instruction. The result is that it takes host CPU cycles even when
  1468. idle. You can install the utility from
  1469. @url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
  1470. problem. Note that no such tool is needed for NT, 2000 or XP.
  1471. @subsubsection Windows 2000 disk full problem
  1472. Windows 2000 has a bug which gives a disk full problem during its
  1473. installation. When installing it, use the @option{-win2k-hack} QEMU
  1474. option to enable a specific workaround. After Windows 2000 is
  1475. installed, you no longer need this option (this option slows down the
  1476. IDE transfers).
  1477. @subsubsection Windows 2000 shutdown
  1478. Windows 2000 cannot automatically shutdown in QEMU although Windows 98
  1479. can. It comes from the fact that Windows 2000 does not automatically
  1480. use the APM driver provided by the BIOS.
  1481. In order to correct that, do the following (thanks to Struan
  1482. Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
  1483. Add/Troubleshoot a device => Add a new device & Next => No, select the
  1484. hardware from a list & Next => NT Apm/Legacy Support & Next => Next
  1485. (again) a few times. Now the driver is installed and Windows 2000 now
  1486. correctly instructs QEMU to shutdown at the appropriate moment.
  1487. @subsubsection Share a directory between Unix and Windows
  1488. See @ref{sec_invocation} about the help of the option @option{-smb}.
  1489. @subsubsection Windows XP security problem
  1490. Some releases of Windows XP install correctly but give a security
  1491. error when booting:
  1492. @example
  1493. A problem is preventing Windows from accurately checking the
  1494. license for this computer. Error code: 0x800703e6.
  1495. @end example
  1496. The workaround is to install a service pack for XP after a boot in safe
  1497. mode. Then reboot, and the problem should go away. Since there is no
  1498. network while in safe mode, its recommended to download the full
  1499. installation of SP1 or SP2 and transfer that via an ISO or using the
  1500. vvfat block device ("-hdb fat:directory_which_holds_the_SP").
  1501. @subsection MS-DOS and FreeDOS
  1502. @subsubsection CPU usage reduction
  1503. DOS does not correctly use the CPU HLT instruction. The result is that
  1504. it takes host CPU cycles even when idle. You can install the utility
  1505. from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
  1506. problem.
  1507. @node QEMU System emulator for non PC targets
  1508. @chapter QEMU System emulator for non PC targets
  1509. QEMU is a generic emulator and it emulates many non PC
  1510. machines. Most of the options are similar to the PC emulator. The
  1511. differences are mentioned in the following sections.
  1512. @menu
  1513. * PowerPC System emulator::
  1514. * Sparc32 System emulator::
  1515. * Sparc64 System emulator::
  1516. * MIPS System emulator::
  1517. * ARM System emulator::
  1518. * ColdFire System emulator::
  1519. * Cris System emulator::
  1520. * Microblaze System emulator::
  1521. * SH4 System emulator::
  1522. * Xtensa System emulator::
  1523. @end menu
  1524. @node PowerPC System emulator
  1525. @section PowerPC System emulator
  1526. @cindex system emulation (PowerPC)
  1527. Use the executable @file{qemu-system-ppc} to simulate a complete PREP
  1528. or PowerMac PowerPC system.
  1529. QEMU emulates the following PowerMac peripherals:
  1530. @itemize @minus
  1531. @item
  1532. UniNorth or Grackle PCI Bridge
  1533. @item
  1534. PCI VGA compatible card with VESA Bochs Extensions
  1535. @item
  1536. 2 PMAC IDE interfaces with hard disk and CD-ROM support
  1537. @item
  1538. NE2000 PCI adapters
  1539. @item
  1540. Non Volatile RAM
  1541. @item
  1542. VIA-CUDA with ADB keyboard and mouse.
  1543. @end itemize
  1544. QEMU emulates the following PREP peripherals:
  1545. @itemize @minus
  1546. @item
  1547. PCI Bridge
  1548. @item
  1549. PCI VGA compatible card with VESA Bochs Extensions
  1550. @item
  1551. 2 IDE interfaces with hard disk and CD-ROM support
  1552. @item
  1553. Floppy disk
  1554. @item
  1555. NE2000 network adapters
  1556. @item
  1557. Serial port
  1558. @item
  1559. PREP Non Volatile RAM
  1560. @item
  1561. PC compatible keyboard and mouse.
  1562. @end itemize
  1563. QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
  1564. @url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
  1565. Since version 0.9.1, QEMU uses OpenBIOS @url{http://www.openbios.org/}
  1566. for the g3beige and mac99 PowerMac machines. OpenBIOS is a free (GPL
  1567. v2) portable firmware implementation. The goal is to implement a 100%
  1568. IEEE 1275-1994 (referred to as Open Firmware) compliant firmware.
  1569. @c man begin OPTIONS
  1570. The following options are specific to the PowerPC emulation:
  1571. @table @option
  1572. @item -g @var{W}x@var{H}[x@var{DEPTH}]
  1573. Set the initial VGA graphic mode. The default is 800x600x32.
  1574. @item -prom-env @var{string}
  1575. Set OpenBIOS variables in NVRAM, for example:
  1576. @example
  1577. qemu-system-ppc -prom-env 'auto-boot?=false' \
  1578. -prom-env 'boot-device=hd:2,\yaboot' \
  1579. -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
  1580. @end example
  1581. These variables are not used by Open Hack'Ware.
  1582. @end table
  1583. @c man end
  1584. More information is available at
  1585. @url{http://perso.magic.fr/l_indien/qemu-ppc/}.
  1586. @node Sparc32 System emulator
  1587. @section Sparc32 System emulator
  1588. @cindex system emulation (Sparc32)
  1589. Use the executable @file{qemu-system-sparc} to simulate the following
  1590. Sun4m architecture machines:
  1591. @itemize @minus
  1592. @item
  1593. SPARCstation 4
  1594. @item
  1595. SPARCstation 5
  1596. @item
  1597. SPARCstation 10
  1598. @item
  1599. SPARCstation 20
  1600. @item
  1601. SPARCserver 600MP
  1602. @item
  1603. SPARCstation LX
  1604. @item
  1605. SPARCstation Voyager
  1606. @item
  1607. SPARCclassic
  1608. @item
  1609. SPARCbook
  1610. @end itemize
  1611. The emulation is somewhat complete. SMP up to 16 CPUs is supported,
  1612. but Linux limits the number of usable CPUs to 4.
  1613. QEMU emulates the following sun4m peripherals:
  1614. @itemize @minus
  1615. @item
  1616. IOMMU
  1617. @item
  1618. TCX or cgthree Frame buffer
  1619. @item
  1620. Lance (Am7990) Ethernet
  1621. @item
  1622. Non Volatile RAM M48T02/M48T08
  1623. @item
  1624. Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
  1625. and power/reset logic
  1626. @item
  1627. ESP SCSI controller with hard disk and CD-ROM support
  1628. @item
  1629. Floppy drive (not on SS-600MP)
  1630. @item
  1631. CS4231 sound device (only on SS-5, not working yet)
  1632. @end itemize
  1633. The number of peripherals is fixed in the architecture. Maximum
  1634. memory size depends on the machine type, for SS-5 it is 256MB and for
  1635. others 2047MB.
  1636. Since version 0.8.2, QEMU uses OpenBIOS
  1637. @url{http://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
  1638. firmware implementation. The goal is to implement a 100% IEEE
  1639. 1275-1994 (referred to as Open Firmware) compliant firmware.
  1640. A sample Linux 2.6 series kernel and ram disk image are available on
  1641. the QEMU web site. There are still issues with NetBSD and OpenBSD, but
  1642. some kernel versions work. Please note that currently older Solaris kernels
  1643. don't work probably due to interface issues between OpenBIOS and
  1644. Solaris.
  1645. @c man begin OPTIONS
  1646. The following options are specific to the Sparc32 emulation:
  1647. @table @option
  1648. @item -g @var{W}x@var{H}x[x@var{DEPTH}]
  1649. Set the initial graphics mode. For TCX, the default is 1024x768x8 with the
  1650. option of 1024x768x24. For cgthree, the default is 1024x768x8 with the option
  1651. of 1152x900x8 for people who wish to use OBP.
  1652. @item -prom-env @var{string}
  1653. Set OpenBIOS variables in NVRAM, for example:
  1654. @example
  1655. qemu-system-sparc -prom-env 'auto-boot?=false' \
  1656. -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
  1657. @end example
  1658. @item -M [SS-4|SS-5|SS-10|SS-20|SS-600MP|LX|Voyager|SPARCClassic] [|SPARCbook]
  1659. Set the emulated machine type. Default is SS-5.
  1660. @end table
  1661. @c man end
  1662. @node Sparc64 System emulator
  1663. @section Sparc64 System emulator
  1664. @cindex system emulation (Sparc64)
  1665. Use the executable @file{qemu-system-sparc64} to simulate a Sun4u
  1666. (UltraSPARC PC-like machine), Sun4v (T1 PC-like machine), or generic
  1667. Niagara (T1) machine. The emulator is not usable for anything yet, but
  1668. it can launch some kernels.
  1669. QEMU emulates the following peripherals:
  1670. @itemize @minus
  1671. @item
  1672. UltraSparc IIi APB PCI Bridge
  1673. @item
  1674. PCI VGA compatible card with VESA Bochs Extensions
  1675. @item
  1676. PS/2 mouse and keyboard
  1677. @item
  1678. Non Volatile RAM M48T59
  1679. @item
  1680. PC-compatible serial ports
  1681. @item
  1682. 2 PCI IDE interfaces with hard disk and CD-ROM support
  1683. @item
  1684. Floppy disk
  1685. @end itemize
  1686. @c man begin OPTIONS
  1687. The following options are specific to the Sparc64 emulation:
  1688. @table @option
  1689. @item -prom-env @var{string}
  1690. Set OpenBIOS variables in NVRAM, for example:
  1691. @example
  1692. qemu-system-sparc64 -prom-env 'auto-boot?=false'
  1693. @end example
  1694. @item -M [sun4u|sun4v|Niagara]
  1695. Set the emulated machine type. The default is sun4u.
  1696. @end table
  1697. @c man end
  1698. @node MIPS System emulator
  1699. @section MIPS System emulator
  1700. @cindex system emulation (MIPS)
  1701. Four executables cover simulation of 32 and 64-bit MIPS systems in
  1702. both endian options, @file{qemu-system-mips}, @file{qemu-system-mipsel}
  1703. @file{qemu-system-mips64} and @file{qemu-system-mips64el}.
  1704. Five different machine types are emulated:
  1705. @itemize @minus
  1706. @item
  1707. A generic ISA PC-like machine "mips"
  1708. @item
  1709. The MIPS Malta prototype board "malta"
  1710. @item
  1711. An ACER Pica "pica61". This machine needs the 64-bit emulator.
  1712. @item
  1713. MIPS emulator pseudo board "mipssim"
  1714. @item
  1715. A MIPS Magnum R4000 machine "magnum". This machine needs the 64-bit emulator.
  1716. @end itemize
  1717. The generic emulation is supported by Debian 'Etch' and is able to
  1718. install Debian into a virtual disk image. The following devices are
  1719. emulated:
  1720. @itemize @minus
  1721. @item
  1722. A range of MIPS CPUs, default is the 24Kf
  1723. @item
  1724. PC style serial port
  1725. @item
  1726. PC style IDE disk
  1727. @item
  1728. NE2000 network card
  1729. @end itemize
  1730. The Malta emulation supports the following devices:
  1731. @itemize @minus
  1732. @item
  1733. Core board with MIPS 24Kf CPU and Galileo system controller
  1734. @item
  1735. PIIX4 PCI/USB/SMbus controller
  1736. @item
  1737. The Multi-I/O chip's serial device
  1738. @item
  1739. PCI network cards (PCnet32 and others)
  1740. @item
  1741. Malta FPGA serial device
  1742. @item
  1743. Cirrus (default) or any other PCI VGA graphics card
  1744. @end itemize
  1745. The ACER Pica emulation supports:
  1746. @itemize @minus
  1747. @item
  1748. MIPS R4000 CPU
  1749. @item
  1750. PC-style IRQ and DMA controllers
  1751. @item
  1752. PC Keyboard
  1753. @item
  1754. IDE controller
  1755. @end itemize
  1756. The mipssim pseudo board emulation provides an environment similar
  1757. to what the proprietary MIPS emulator uses for running Linux.
  1758. It supports:
  1759. @itemize @minus
  1760. @item
  1761. A range of MIPS CPUs, default is the 24Kf
  1762. @item
  1763. PC style serial port
  1764. @item
  1765. MIPSnet network emulation
  1766. @end itemize
  1767. The MIPS Magnum R4000 emulation supports:
  1768. @itemize @minus
  1769. @item
  1770. MIPS R4000 CPU
  1771. @item
  1772. PC-style IRQ controller
  1773. @item
  1774. PC Keyboard
  1775. @item
  1776. SCSI controller
  1777. @item
  1778. G364 framebuffer
  1779. @end itemize
  1780. @node ARM System emulator
  1781. @section ARM System emulator
  1782. @cindex system emulation (ARM)
  1783. Use the executable @file{qemu-system-arm} to simulate a ARM
  1784. machine. The ARM Integrator/CP board is emulated with the following
  1785. devices:
  1786. @itemize @minus
  1787. @item
  1788. ARM926E, ARM1026E, ARM946E, ARM1136 or Cortex-A8 CPU
  1789. @item
  1790. Two PL011 UARTs
  1791. @item
  1792. SMC 91c111 Ethernet adapter
  1793. @item
  1794. PL110 LCD controller
  1795. @item
  1796. PL050 KMI with PS/2 keyboard and mouse.
  1797. @item
  1798. PL181 MultiMedia Card Interface with SD card.
  1799. @end itemize
  1800. The ARM Versatile baseboard is emulated with the following devices:
  1801. @itemize @minus
  1802. @item
  1803. ARM926E, ARM1136 or Cortex-A8 CPU
  1804. @item
  1805. PL190 Vectored Interrupt Controller
  1806. @item
  1807. Four PL011 UARTs
  1808. @item
  1809. SMC 91c111 Ethernet adapter
  1810. @item
  1811. PL110 LCD controller
  1812. @item
  1813. PL050 KMI with PS/2 keyboard and mouse.
  1814. @item
  1815. PCI host bridge. Note the emulated PCI bridge only provides access to
  1816. PCI memory space. It does not provide access to PCI IO space.
  1817. This means some devices (eg. ne2k_pci NIC) are not usable, and others
  1818. (eg. rtl8139 NIC) are only usable when the guest drivers use the memory
  1819. mapped control registers.
  1820. @item
  1821. PCI OHCI USB controller.
  1822. @item
  1823. LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
  1824. @item
  1825. PL181 MultiMedia Card Interface with SD card.
  1826. @end itemize
  1827. Several variants of the ARM RealView baseboard are emulated,
  1828. including the EB, PB-A8 and PBX-A9. Due to interactions with the
  1829. bootloader, only certain Linux kernel configurations work out
  1830. of the box on these boards.
  1831. Kernels for the PB-A8 board should have CONFIG_REALVIEW_HIGH_PHYS_OFFSET
  1832. enabled in the kernel, and expect 512M RAM. Kernels for The PBX-A9 board
  1833. should have CONFIG_SPARSEMEM enabled, CONFIG_REALVIEW_HIGH_PHYS_OFFSET
  1834. disabled and expect 1024M RAM.
  1835. The following devices are emulated:
  1836. @itemize @minus
  1837. @item
  1838. ARM926E, ARM1136, ARM11MPCore, Cortex-A8 or Cortex-A9 MPCore CPU
  1839. @item
  1840. ARM AMBA Generic/Distributed Interrupt Controller
  1841. @item
  1842. Four PL011 UARTs
  1843. @item
  1844. SMC 91c111 or SMSC LAN9118 Ethernet adapter
  1845. @item
  1846. PL110 LCD controller
  1847. @item
  1848. PL050 KMI with PS/2 keyboard and mouse
  1849. @item
  1850. PCI host bridge
  1851. @item
  1852. PCI OHCI USB controller
  1853. @item
  1854. LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
  1855. @item
  1856. PL181 MultiMedia Card Interface with SD card.
  1857. @end itemize
  1858. The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi"
  1859. and "Terrier") emulation includes the following peripherals:
  1860. @itemize @minus
  1861. @item
  1862. Intel PXA270 System-on-chip (ARM V5TE core)
  1863. @item
  1864. NAND Flash memory
  1865. @item
  1866. IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
  1867. @item
  1868. On-chip OHCI USB controller
  1869. @item
  1870. On-chip LCD controller
  1871. @item
  1872. On-chip Real Time Clock
  1873. @item
  1874. TI ADS7846 touchscreen controller on SSP bus
  1875. @item
  1876. Maxim MAX1111 analog-digital converter on I@math{^2}C bus
  1877. @item
  1878. GPIO-connected keyboard controller and LEDs
  1879. @item
  1880. Secure Digital card connected to PXA MMC/SD host
  1881. @item
  1882. Three on-chip UARTs
  1883. @item
  1884. WM8750 audio CODEC on I@math{^2}C and I@math{^2}S busses
  1885. @end itemize
  1886. The Palm Tungsten|E PDA (codename "Cheetah") emulation includes the
  1887. following elements:
  1888. @itemize @minus
  1889. @item
  1890. Texas Instruments OMAP310 System-on-chip (ARM 925T core)
  1891. @item
  1892. ROM and RAM memories (ROM firmware image can be loaded with -option-rom)
  1893. @item
  1894. On-chip LCD controller
  1895. @item
  1896. On-chip Real Time Clock
  1897. @item
  1898. TI TSC2102i touchscreen controller / analog-digital converter / Audio
  1899. CODEC, connected through MicroWire and I@math{^2}S busses
  1900. @item
  1901. GPIO-connected matrix keypad
  1902. @item
  1903. Secure Digital card connected to OMAP MMC/SD host
  1904. @item
  1905. Three on-chip UARTs
  1906. @end itemize
  1907. Nokia N800 and N810 internet tablets (known also as RX-34 and RX-44 / 48)
  1908. emulation supports the following elements:
  1909. @itemize @minus
  1910. @item
  1911. Texas Instruments OMAP2420 System-on-chip (ARM 1136 core)
  1912. @item
  1913. RAM and non-volatile OneNAND Flash memories
  1914. @item
  1915. Display connected to EPSON remote framebuffer chip and OMAP on-chip
  1916. display controller and a LS041y3 MIPI DBI-C controller
  1917. @item
  1918. TI TSC2301 (in N800) and TI TSC2005 (in N810) touchscreen controllers
  1919. driven through SPI bus
  1920. @item
  1921. National Semiconductor LM8323-controlled qwerty keyboard driven
  1922. through I@math{^2}C bus
  1923. @item
  1924. Secure Digital card connected to OMAP MMC/SD host
  1925. @item
  1926. Three OMAP on-chip UARTs and on-chip STI debugging console
  1927. @item
  1928. A Bluetooth(R) transceiver and HCI connected to an UART
  1929. @item
  1930. Mentor Graphics "Inventra" dual-role USB controller embedded in a TI
  1931. TUSB6010 chip - only USB host mode is supported
  1932. @item
  1933. TI TMP105 temperature sensor driven through I@math{^2}C bus
  1934. @item
  1935. TI TWL92230C power management companion with an RTC on I@math{^2}C bus
  1936. @item
  1937. Nokia RETU and TAHVO multi-purpose chips with an RTC, connected
  1938. through CBUS
  1939. @end itemize
  1940. The Luminary Micro Stellaris LM3S811EVB emulation includes the following
  1941. devices:
  1942. @itemize @minus
  1943. @item
  1944. Cortex-M3 CPU core.
  1945. @item
  1946. 64k Flash and 8k SRAM.
  1947. @item
  1948. Timers, UARTs, ADC and I@math{^2}C interface.
  1949. @item
  1950. OSRAM Pictiva 96x16 OLED with SSD0303 controller on I@math{^2}C bus.
  1951. @end itemize
  1952. The Luminary Micro Stellaris LM3S6965EVB emulation includes the following
  1953. devices:
  1954. @itemize @minus
  1955. @item
  1956. Cortex-M3 CPU core.
  1957. @item
  1958. 256k Flash and 64k SRAM.
  1959. @item
  1960. Timers, UARTs, ADC, I@math{^2}C and SSI interfaces.
  1961. @item
  1962. OSRAM Pictiva 128x64 OLED with SSD0323 controller connected via SSI.
  1963. @end itemize
  1964. The Freecom MusicPal internet radio emulation includes the following
  1965. elements:
  1966. @itemize @minus
  1967. @item
  1968. Marvell MV88W8618 ARM core.
  1969. @item
  1970. 32 MB RAM, 256 KB SRAM, 8 MB flash.
  1971. @item
  1972. Up to 2 16550 UARTs
  1973. @item
  1974. MV88W8xx8 Ethernet controller
  1975. @item
  1976. MV88W8618 audio controller, WM8750 CODEC and mixer
  1977. @item
  1978. 128×64 display with brightness control
  1979. @item
  1980. 2 buttons, 2 navigation wheels with button function
  1981. @end itemize
  1982. The Siemens SX1 models v1 and v2 (default) basic emulation.
  1983. The emulation includes the following elements:
  1984. @itemize @minus
  1985. @item
  1986. Texas Instruments OMAP310 System-on-chip (ARM 925T core)
  1987. @item
  1988. ROM and RAM memories (ROM firmware image can be loaded with -pflash)
  1989. V1
  1990. 1 Flash of 16MB and 1 Flash of 8MB
  1991. V2
  1992. 1 Flash of 32MB
  1993. @item
  1994. On-chip LCD controller
  1995. @item
  1996. On-chip Real Time Clock
  1997. @item
  1998. Secure Digital card connected to OMAP MMC/SD host
  1999. @item
  2000. Three on-chip UARTs
  2001. @end itemize
  2002. A Linux 2.6 test image is available on the QEMU web site. More
  2003. information is available in the QEMU mailing-list archive.
  2004. @c man begin OPTIONS
  2005. The following options are specific to the ARM emulation:
  2006. @table @option
  2007. @item -semihosting
  2008. Enable semihosting syscall emulation.
  2009. On ARM this implements the "Angel" interface.
  2010. Note that this allows guest direct access to the host filesystem,
  2011. so should only be used with trusted guest OS.
  2012. @end table
  2013. @node ColdFire System emulator
  2014. @section ColdFire System emulator
  2015. @cindex system emulation (ColdFire)
  2016. @cindex system emulation (M68K)
  2017. Use the executable @file{qemu-system-m68k} to simulate a ColdFire machine.
  2018. The emulator is able to boot a uClinux kernel.
  2019. The M5208EVB emulation includes the following devices:
  2020. @itemize @minus
  2021. @item
  2022. MCF5208 ColdFire V2 Microprocessor (ISA A+ with EMAC).
  2023. @item
  2024. Three Two on-chip UARTs.
  2025. @item
  2026. Fast Ethernet Controller (FEC)
  2027. @end itemize
  2028. The AN5206 emulation includes the following devices:
  2029. @itemize @minus
  2030. @item
  2031. MCF5206 ColdFire V2 Microprocessor.
  2032. @item
  2033. Two on-chip UARTs.
  2034. @end itemize
  2035. @c man begin OPTIONS
  2036. The following options are specific to the ColdFire emulation:
  2037. @table @option
  2038. @item -semihosting
  2039. Enable semihosting syscall emulation.
  2040. On M68K this implements the "ColdFire GDB" interface used by libgloss.
  2041. Note that this allows guest direct access to the host filesystem,
  2042. so should only be used with trusted guest OS.
  2043. @end table
  2044. @node Cris System emulator
  2045. @section Cris System emulator
  2046. @cindex system emulation (Cris)
  2047. TODO
  2048. @node Microblaze System emulator
  2049. @section Microblaze System emulator
  2050. @cindex system emulation (Microblaze)
  2051. TODO
  2052. @node SH4 System emulator
  2053. @section SH4 System emulator
  2054. @cindex system emulation (SH4)
  2055. TODO
  2056. @node Xtensa System emulator
  2057. @section Xtensa System emulator
  2058. @cindex system emulation (Xtensa)
  2059. Two executables cover simulation of both Xtensa endian options,
  2060. @file{qemu-system-xtensa} and @file{qemu-system-xtensaeb}.
  2061. Two different machine types are emulated:
  2062. @itemize @minus
  2063. @item
  2064. Xtensa emulator pseudo board "sim"
  2065. @item
  2066. Avnet LX60/LX110/LX200 board
  2067. @end itemize
  2068. The sim pseudo board emulation provides an environment similar
  2069. to one provided by the proprietary Tensilica ISS.
  2070. It supports:
  2071. @itemize @minus
  2072. @item
  2073. A range of Xtensa CPUs, default is the DC232B
  2074. @item
  2075. Console and filesystem access via semihosting calls
  2076. @end itemize
  2077. The Avnet LX60/LX110/LX200 emulation supports:
  2078. @itemize @minus
  2079. @item
  2080. A range of Xtensa CPUs, default is the DC232B
  2081. @item
  2082. 16550 UART
  2083. @item
  2084. OpenCores 10/100 Mbps Ethernet MAC
  2085. @end itemize
  2086. @c man begin OPTIONS
  2087. The following options are specific to the Xtensa emulation:
  2088. @table @option
  2089. @item -semihosting
  2090. Enable semihosting syscall emulation.
  2091. Xtensa semihosting provides basic file IO calls, such as open/read/write/seek/select.
  2092. Tensilica baremetal libc for ISS and linux platform "sim" use this interface.
  2093. Note that this allows guest direct access to the host filesystem,
  2094. so should only be used with trusted guest OS.
  2095. @end table
  2096. @node QEMU User space emulator
  2097. @chapter QEMU User space emulator
  2098. @menu
  2099. * Supported Operating Systems ::
  2100. * Linux User space emulator::
  2101. * BSD User space emulator ::
  2102. @end menu
  2103. @node Supported Operating Systems
  2104. @section Supported Operating Systems
  2105. The following OS are supported in user space emulation:
  2106. @itemize @minus
  2107. @item
  2108. Linux (referred as qemu-linux-user)
  2109. @item
  2110. BSD (referred as qemu-bsd-user)
  2111. @end itemize
  2112. @node Linux User space emulator
  2113. @section Linux User space emulator
  2114. @menu
  2115. * Quick Start::
  2116. * Wine launch::
  2117. * Command line options::
  2118. * Other binaries::
  2119. @end menu
  2120. @node Quick Start
  2121. @subsection Quick Start
  2122. In order to launch a Linux process, QEMU needs the process executable
  2123. itself and all the target (x86) dynamic libraries used by it.
  2124. @itemize
  2125. @item On x86, you can just try to launch any process by using the native
  2126. libraries:
  2127. @example
  2128. qemu-i386 -L / /bin/ls
  2129. @end example
  2130. @code{-L /} tells that the x86 dynamic linker must be searched with a
  2131. @file{/} prefix.
  2132. @item Since QEMU is also a linux process, you can launch QEMU with
  2133. QEMU (NOTE: you can only do that if you compiled QEMU from the sources):
  2134. @example
  2135. qemu-i386 -L / qemu-i386 -L / /bin/ls
  2136. @end example
  2137. @item On non x86 CPUs, you need first to download at least an x86 glibc
  2138. (@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
  2139. @code{LD_LIBRARY_PATH} is not set:
  2140. @example
  2141. unset LD_LIBRARY_PATH
  2142. @end example
  2143. Then you can launch the precompiled @file{ls} x86 executable:
  2144. @example
  2145. qemu-i386 tests/i386/ls
  2146. @end example
  2147. You can look at @file{scripts/qemu-binfmt-conf.sh} so that
  2148. QEMU is automatically launched by the Linux kernel when you try to
  2149. launch x86 executables. It requires the @code{binfmt_misc} module in the
  2150. Linux kernel.
  2151. @item The x86 version of QEMU is also included. You can try weird things such as:
  2152. @example
  2153. qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
  2154. /usr/local/qemu-i386/bin/ls-i386
  2155. @end example
  2156. @end itemize
  2157. @node Wine launch
  2158. @subsection Wine launch
  2159. @itemize
  2160. @item Ensure that you have a working QEMU with the x86 glibc
  2161. distribution (see previous section). In order to verify it, you must be
  2162. able to do:
  2163. @example
  2164. qemu-i386 /usr/local/qemu-i386/bin/ls-i386
  2165. @end example
  2166. @item Download the binary x86 Wine install
  2167. (@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
  2168. @item Configure Wine on your account. Look at the provided script
  2169. @file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
  2170. @code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
  2171. @item Then you can try the example @file{putty.exe}:
  2172. @example
  2173. qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
  2174. /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
  2175. @end example
  2176. @end itemize
  2177. @node Command line options
  2178. @subsection Command line options
  2179. @example
  2180. usage: qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B offset] [-R size] program [arguments...]
  2181. @end example
  2182. @table @option
  2183. @item -h
  2184. Print the help
  2185. @item -L path
  2186. Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
  2187. @item -s size
  2188. Set the x86 stack size in bytes (default=524288)
  2189. @item -cpu model
  2190. Select CPU model (-cpu help for list and additional feature selection)
  2191. @item -E @var{var}=@var{value}
  2192. Set environment @var{var} to @var{value}.
  2193. @item -U @var{var}
  2194. Remove @var{var} from the environment.
  2195. @item -B offset
  2196. Offset guest address by the specified number of bytes. This is useful when
  2197. the address region required by guest applications is reserved on the host.
  2198. This option is currently only supported on some hosts.
  2199. @item -R size
  2200. Pre-allocate a guest virtual address space of the given size (in bytes).
  2201. "G", "M", and "k" suffixes may be used when specifying the size.
  2202. @end table
  2203. Debug options:
  2204. @table @option
  2205. @item -d item1,...
  2206. Activate logging of the specified items (use '-d help' for a list of log items)
  2207. @item -p pagesize
  2208. Act as if the host page size was 'pagesize' bytes
  2209. @item -g port
  2210. Wait gdb connection to port
  2211. @item -singlestep
  2212. Run the emulation in single step mode.
  2213. @end table
  2214. Environment variables:
  2215. @table @env
  2216. @item QEMU_STRACE
  2217. Print system calls and arguments similar to the 'strace' program
  2218. (NOTE: the actual 'strace' program will not work because the user
  2219. space emulator hasn't implemented ptrace). At the moment this is
  2220. incomplete. All system calls that don't have a specific argument
  2221. format are printed with information for six arguments. Many
  2222. flag-style arguments don't have decoders and will show up as numbers.
  2223. @end table
  2224. @node Other binaries
  2225. @subsection Other binaries
  2226. @cindex user mode (Alpha)
  2227. @command{qemu-alpha} TODO.
  2228. @cindex user mode (ARM)
  2229. @command{qemu-armeb} TODO.
  2230. @cindex user mode (ARM)
  2231. @command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
  2232. binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
  2233. configurations), and arm-uclinux bFLT format binaries.
  2234. @cindex user mode (ColdFire)
  2235. @cindex user mode (M68K)
  2236. @command{qemu-m68k} is capable of running semihosted binaries using the BDM
  2237. (m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
  2238. coldfire uClinux bFLT format binaries.
  2239. The binary format is detected automatically.
  2240. @cindex user mode (Cris)
  2241. @command{qemu-cris} TODO.
  2242. @cindex user mode (i386)
  2243. @command{qemu-i386} TODO.
  2244. @command{qemu-x86_64} TODO.
  2245. @cindex user mode (Microblaze)
  2246. @command{qemu-microblaze} TODO.
  2247. @cindex user mode (MIPS)
  2248. @command{qemu-mips} TODO.
  2249. @command{qemu-mipsel} TODO.
  2250. @cindex user mode (PowerPC)
  2251. @command{qemu-ppc64abi32} TODO.
  2252. @command{qemu-ppc64} TODO.
  2253. @command{qemu-ppc} TODO.
  2254. @cindex user mode (SH4)
  2255. @command{qemu-sh4eb} TODO.
  2256. @command{qemu-sh4} TODO.
  2257. @cindex user mode (SPARC)
  2258. @command{qemu-sparc} can execute Sparc32 binaries (Sparc32 CPU, 32 bit ABI).
  2259. @command{qemu-sparc32plus} can execute Sparc32 and SPARC32PLUS binaries
  2260. (Sparc64 CPU, 32 bit ABI).
  2261. @command{qemu-sparc64} can execute some Sparc64 (Sparc64 CPU, 64 bit ABI) and
  2262. SPARC32PLUS binaries (Sparc64 CPU, 32 bit ABI).
  2263. @node BSD User space emulator
  2264. @section BSD User space emulator
  2265. @menu
  2266. * BSD Status::
  2267. * BSD Quick Start::
  2268. * BSD Command line options::
  2269. @end menu
  2270. @node BSD Status
  2271. @subsection BSD Status
  2272. @itemize @minus
  2273. @item
  2274. target Sparc64 on Sparc64: Some trivial programs work.
  2275. @end itemize
  2276. @node BSD Quick Start
  2277. @subsection Quick Start
  2278. In order to launch a BSD process, QEMU needs the process executable
  2279. itself and all the target dynamic libraries used by it.
  2280. @itemize
  2281. @item On Sparc64, you can just try to launch any process by using the native
  2282. libraries:
  2283. @example
  2284. qemu-sparc64 /bin/ls
  2285. @end example
  2286. @end itemize
  2287. @node BSD Command line options
  2288. @subsection Command line options
  2289. @example
  2290. usage: qemu-sparc64 [-h] [-d] [-L path] [-s size] [-bsd type] program [arguments...]
  2291. @end example
  2292. @table @option
  2293. @item -h
  2294. Print the help
  2295. @item -L path
  2296. Set the library root path (default=/)
  2297. @item -s size
  2298. Set the stack size in bytes (default=524288)
  2299. @item -ignore-environment
  2300. Start with an empty environment. Without this option,
  2301. the initial environment is a copy of the caller's environment.
  2302. @item -E @var{var}=@var{value}
  2303. Set environment @var{var} to @var{value}.
  2304. @item -U @var{var}
  2305. Remove @var{var} from the environment.
  2306. @item -bsd type
  2307. Set the type of the emulated BSD Operating system. Valid values are
  2308. FreeBSD, NetBSD and OpenBSD (default).
  2309. @end table
  2310. Debug options:
  2311. @table @option
  2312. @item -d item1,...
  2313. Activate logging of the specified items (use '-d help' for a list of log items)
  2314. @item -p pagesize
  2315. Act as if the host page size was 'pagesize' bytes
  2316. @item -singlestep
  2317. Run the emulation in single step mode.
  2318. @end table
  2319. @node compilation
  2320. @chapter Compilation from the sources
  2321. @menu
  2322. * Linux/Unix::
  2323. * Windows::
  2324. * Cross compilation for Windows with Linux::
  2325. * Mac OS X::
  2326. * Make targets::
  2327. @end menu
  2328. @node Linux/Unix
  2329. @section Linux/Unix
  2330. @subsection Compilation
  2331. First you must decompress the sources:
  2332. @example
  2333. cd /tmp
  2334. tar zxvf qemu-x.y.z.tar.gz
  2335. cd qemu-x.y.z
  2336. @end example
  2337. Then you configure QEMU and build it (usually no options are needed):
  2338. @example
  2339. ./configure
  2340. make
  2341. @end example
  2342. Then type as root user:
  2343. @example
  2344. make install
  2345. @end example
  2346. to install QEMU in @file{/usr/local}.
  2347. @node Windows
  2348. @section Windows
  2349. @itemize
  2350. @item Install the current versions of MSYS and MinGW from
  2351. @url{http://www.mingw.org/}. You can find detailed installation
  2352. instructions in the download section and the FAQ.
  2353. @item Download
  2354. the MinGW development library of SDL 1.2.x
  2355. (@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
  2356. @url{http://www.libsdl.org}. Unpack it in a temporary place and
  2357. edit the @file{sdl-config} script so that it gives the
  2358. correct SDL directory when invoked.
  2359. @item Install the MinGW version of zlib and make sure
  2360. @file{zlib.h} and @file{libz.dll.a} are in
  2361. MinGW's default header and linker search paths.
  2362. @item Extract the current version of QEMU.
  2363. @item Start the MSYS shell (file @file{msys.bat}).
  2364. @item Change to the QEMU directory. Launch @file{./configure} and
  2365. @file{make}. If you have problems using SDL, verify that
  2366. @file{sdl-config} can be launched from the MSYS command line.
  2367. @item You can install QEMU in @file{Program Files/QEMU} by typing
  2368. @file{make install}. Don't forget to copy @file{SDL.dll} in
  2369. @file{Program Files/QEMU}.
  2370. @end itemize
  2371. @node Cross compilation for Windows with Linux
  2372. @section Cross compilation for Windows with Linux
  2373. @itemize
  2374. @item
  2375. Install the MinGW cross compilation tools available at
  2376. @url{http://www.mingw.org/}.
  2377. @item Download
  2378. the MinGW development library of SDL 1.2.x
  2379. (@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
  2380. @url{http://www.libsdl.org}. Unpack it in a temporary place and
  2381. edit the @file{sdl-config} script so that it gives the
  2382. correct SDL directory when invoked. Set up the @code{PATH} environment
  2383. variable so that @file{sdl-config} can be launched by
  2384. the QEMU configuration script.
  2385. @item Install the MinGW version of zlib and make sure
  2386. @file{zlib.h} and @file{libz.dll.a} are in
  2387. MinGW's default header and linker search paths.
  2388. @item
  2389. Configure QEMU for Windows cross compilation:
  2390. @example
  2391. PATH=/usr/i686-pc-mingw32/sys-root/mingw/bin:$PATH ./configure --cross-prefix='i686-pc-mingw32-'
  2392. @end example
  2393. The example assumes @file{sdl-config} is installed under @file{/usr/i686-pc-mingw32/sys-root/mingw/bin} and
  2394. MinGW cross compilation tools have names like @file{i686-pc-mingw32-gcc} and @file{i686-pc-mingw32-strip}.
  2395. We set the @code{PATH} environment variable to ensure the MinGW version of @file{sdl-config} is used and
  2396. use --cross-prefix to specify the name of the cross compiler.
  2397. You can also use --prefix to set the Win32 install path which defaults to @file{c:/Program Files/QEMU}.
  2398. Under Fedora Linux, you can run:
  2399. @example
  2400. yum -y install mingw32-gcc mingw32-SDL mingw32-zlib
  2401. @end example
  2402. to get a suitable cross compilation environment.
  2403. @item You can install QEMU in the installation directory by typing
  2404. @code{make install}. Don't forget to copy @file{SDL.dll} and @file{zlib1.dll} into the
  2405. installation directory.
  2406. @end itemize
  2407. Wine can be used to launch the resulting qemu-system-i386.exe
  2408. and all other qemu-system-@var{target}.exe compiled for Win32.
  2409. @node Mac OS X
  2410. @section Mac OS X
  2411. The Mac OS X patches are not fully merged in QEMU, so you should look
  2412. at the QEMU mailing list archive to have all the necessary
  2413. information.
  2414. @node Make targets
  2415. @section Make targets
  2416. @table @code
  2417. @item make
  2418. @item make all
  2419. Make everything which is typically needed.
  2420. @item install
  2421. TODO
  2422. @item install-doc
  2423. TODO
  2424. @item make clean
  2425. Remove most files which were built during make.
  2426. @item make distclean
  2427. Remove everything which was built during make.
  2428. @item make dvi
  2429. @item make html
  2430. @item make info
  2431. @item make pdf
  2432. Create documentation in dvi, html, info or pdf format.
  2433. @item make cscope
  2434. TODO
  2435. @item make defconfig
  2436. (Re-)create some build configuration files.
  2437. User made changes will be overwritten.
  2438. @item tar
  2439. @item tarbin
  2440. TODO
  2441. @end table
  2442. @node License
  2443. @appendix License
  2444. QEMU is a trademark of Fabrice Bellard.
  2445. QEMU is released under the GNU General Public License (TODO: add link).
  2446. Parts of QEMU have specific licenses, see file LICENSE.
  2447. TODO (refer to file LICENSE, include it, include the GPL?)
  2448. @node Index
  2449. @appendix Index
  2450. @menu
  2451. * Concept Index::
  2452. * Function Index::
  2453. * Keystroke Index::
  2454. * Program Index::
  2455. * Data Type Index::
  2456. * Variable Index::
  2457. @end menu
  2458. @node Concept Index
  2459. @section Concept Index
  2460. This is the main index. Should we combine all keywords in one index? TODO
  2461. @printindex cp
  2462. @node Function Index
  2463. @section Function Index
  2464. This index could be used for command line options and monitor functions.
  2465. @printindex fn
  2466. @node Keystroke Index
  2467. @section Keystroke Index
  2468. This is a list of all keystrokes which have a special function
  2469. in system emulation.
  2470. @printindex ky
  2471. @node Program Index
  2472. @section Program Index
  2473. @printindex pg
  2474. @node Data Type Index
  2475. @section Data Type Index
  2476. This index could be used for qdev device names and options.
  2477. @printindex tp
  2478. @node Variable Index
  2479. @section Variable Index
  2480. @printindex vr
  2481. @bye