You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

qemu-doc.texi 93KB

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