qemu-doc.texi 79 KB

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