Ravenports generated: 13 Dec 2019 07:39
[ravenports.git] / bucket_A9 / qemu
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               qemu
4 VERSION=                4.2.0
5 KEYWORDS=               emulators
6 VARIANTS=               standard
7 SDESC[standard]=        Fast CPU emulator and virtualizer for x86 platform
8 HOMEPAGE=               https://www.qemu.org/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            https://download.qemu.org/
13 DISTFILE[1]=            qemu-4.2.0.tar.xz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        complete
16                         primary
17                         docs
18
19 OPTIONS_AVAILABLE=      none
20 OPTIONS_STANDARD=       none
21
22 BUILD_DEPENDS=          texi2html:primary:standard
23                         python-Sphinx:single:python_default
24 BUILDRUN_DEPENDS=       nettle:primary:standard
25                         fontconfig:primary:standard
26                         freetype:primary:standard
27                         gnutls:single:standard
28                         cyrus-sasl:primary:standard
29                         curl:primary:standard
30                         vde2:single:standard
31                         libepoxy:single:standard
32
33 USES=                   cpe gmake pkgconfig bison perl:build python:build
34                         jpeg png mesa gettext-runtime gettext-tools ncurses
35                         makeinfo
36 GNOME_COMPONENTS=       gdkpixbuf gtk2 vte
37 SDL_COMPONENTS=         sdl2
38 XORG_COMPONENTS=        x11 xext
39
40 LICENSE=                GPLv2:primary
41 LICENSE_TERMS=          primary:{{WRKSRC}}/LICENSE
42 LICENSE_FILE=           GPLv2:{{WRKSRC}}/COPYING
43 LICENSE_SCHEME=         solo
44
45 FPC_EQUIVALENT=         emulators/qemu
46
47 MUST_CONFIGURE=         yes
48 CONFIGURE_ARGS=         --disable-usb-redir
49                         --disable-stack-protector
50                         --disable-kvm
51                         --disable-xen
52                         --disable-vde
53                         --enable-pcap
54                         --enable-docs
55                         --enable-debug
56                         --enable-debug-info
57                         --prefix={{PREFIX}}
58                         --cc={{CC}}
59                         --python={{PYTHON_CMD}}
60                         --localstatedir=/var
61                         --extra-cflags="-I{{WRKSRC}} -I{{LOCALBASE}}/include -DPREFIX=\\\"\"{{PREFIX}}\\\"\""
62                         --extra-ldflags="-L/usr/lib -L{{LOCALBASE}}/lib"
63
64 MAKE_ENV=               BSD_MAKE="{{MAKE}}"
65                         V=1
66
67 INSTALL_REQ_TOOLCHAIN=  yes
68
69 VAR_OPSYS[freebsd]=     CONFIGURE_ARGS=--enable-netmap
70                         CONFIGURE_ARGS=--disable-linux-user
71                         CONFIGURE_ARGS=--disable-linux-aio
72 VAR_OPSYS[linux]=       CONFIGURE_ARGS=--enable-netmap
73 VAR_OPSYS[dragonfly]=   CONFIGURE_ARGS=--disable-netmap
74                         CONFIGURE_ARGS=--disable-linux-user
75                         CONFIGURE_ARGS=--disable-linux-aio
76
77 post-patch:
78         ${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \
79                  -e '/libusb/s/ --atleast-version=1\.0\.[0-9]*//' \
80                 ${WRKSRC}/configure
81         ${REINPLACE_CMD} -e '/libs_qga=/s|glib_libs|glib_libs -lintl|' \
82                 ${WRKSRC}/configure
83         ${REINPLACE_CMD} -E \
84                 -e "/^by Tibor .TS. S/s|Sch.*z.$$|Schuetz.|" \
85                 ${WRKSRC}/qemu-doc.texi
86         ${REINPLACE_CMD} -E \
87                 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing|" \
88                 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
89                 ${WRKSRC}/Makefile.target
90         ${REINPLACE_CMD} -E \
91                 -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \
92                 -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \
93                 ${WRKSRC}/Makefile
94         ${REINPLACE_CMD} -E \
95                 -e "1s|^(#! )/usr/bin/perl|\1${PERL}|" \
96                 ${WRKSRC}/scripts/texi2pod.pl
97         # GNS3 (promiscuous multicast)
98         ${REINPLACE_CMD} -e 's|(buf\[0\] & 1) && (rctl & E1000_RCTL_MPE)|buf[0] \& 1|' \
99                 ${WRKSRC}/hw/net/e1000.c
100         # broken build for optionrom
101         ${REINPLACE_CMD} -e '/roms="optionrom"/d' ${WRKSRC}/configure
102         # silence some include warnings
103         ${MKDIR} ${WRKSRC}/bsd-user/dragonfly
104
105 pre-install:
106         # for some reason file is considered out-of-date
107         ${TOUCH} ${WRKSRC}/config-host.mak
108
109 post-install:
110         ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample \
111                 ${STAGEDIR}${PREFIX}/etc
112         ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample \
113                 ${STAGEDIR}${PREFIX}/etc
114         ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
115         (cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${STD_DOCDIR}/)
116         # remove empty directories
117         ${RM} -r ${STAGEDIR}/var
118
119 [FILE:782:descriptions/desc.primary]
120 QEMU is a fast processor emulator using dynamic translation to achieve
121 good emulation speed.  QEMU has two operating modes:
122
123  * Full system emulation. In this mode, QEMU emulates a full system (for
124    example a PC), including a processor and various peripherials.  It can
125    be used to launch different Operating Systems without rebooting the PC
126    or to debug system code.
127  * User mode emulation (Linux host only). In this mode, QEMU can launch
128    Linux processes compiled for one CPU on another CPU. It can be used to
129    launch the Wine Windows API emulator or to ease cross-compilation and
130    cross-debugging.
131
132 As QEMU requires no host kernel patches to run, it is safe and easy to use.
133
134 See also the preconfigured system images on http://oszoo.org/
135 Many live cd isos also work.
136
137
138 [FILE:96:distinfo]
139 d3481d4108ce211a053ef15be69af1bdd9dde1510fda80d92be0f6c3e98768f0     62222068 qemu-4.2.0.tar.xz
140
141
142 [FILE:3171:manifests/plist.primary]
143 @sample etc/qemu-ifdown.sample
144 @sample etc/qemu-ifup.sample
145 bin/
146  elf2dmp
147  qemu-edid
148  qemu-ga
149  qemu-i386
150  qemu-img
151  qemu-io
152  qemu-nbd
153  qemu-sparc
154  qemu-sparc64
155  qemu-system-aarch64
156  qemu-system-alpha
157  qemu-system-arm
158  qemu-system-cris
159  qemu-system-hppa
160  qemu-system-i386
161  qemu-system-lm32
162  qemu-system-m68k
163  qemu-system-microblaze
164  qemu-system-microblazeel
165  qemu-system-mips
166  qemu-system-mips64
167  qemu-system-mips64el
168  qemu-system-mipsel
169  qemu-system-moxie
170  qemu-system-nios2
171  qemu-system-or1k
172  qemu-system-ppc
173  qemu-system-ppc64
174  qemu-system-riscv32
175  qemu-system-riscv64
176  qemu-system-s390x
177  qemu-system-sh4
178  qemu-system-sh4eb
179  qemu-system-sparc
180  qemu-system-sparc64
181  qemu-system-tricore
182  qemu-system-unicore32
183  qemu-system-x86_64
184  qemu-system-xtensa
185  qemu-system-xtensaeb
186  qemu-x86_64
187 share/applications/qemu.desktop
188 share/icons/hicolor/128x128/apps/qemu.png
189 share/icons/hicolor/16x16/apps/qemu.png
190 share/icons/hicolor/24x24/apps/qemu.png
191 share/icons/hicolor/256x256/apps/qemu.png
192 share/icons/hicolor/32x32/apps/
193  qemu.bmp
194  qemu.png
195 share/icons/hicolor/48x48/apps/qemu.png
196 share/icons/hicolor/512x512/apps/qemu.png
197 share/icons/hicolor/64x64/apps/qemu.png
198 share/icons/hicolor/scalable/apps/qemu.svg
199 share/locale/bg/LC_MESSAGES/qemu.mo
200 share/locale/de_DE/LC_MESSAGES/qemu.mo
201 share/locale/fr_FR/LC_MESSAGES/qemu.mo
202 share/locale/hu/LC_MESSAGES/qemu.mo
203 share/locale/it/LC_MESSAGES/qemu.mo
204 share/locale/tr/LC_MESSAGES/qemu.mo
205 share/locale/zh_CN/LC_MESSAGES/qemu.mo
206 share/man/man1/
207  qemu-img.1.gz
208  qemu.1.gz
209 share/man/man7/
210  qemu-block-drivers.7.gz
211  qemu-cpu-models.7.gz
212  qemu-ga-ref.7.gz
213  qemu-qmp-ref.7.gz
214 share/man/man8/
215  qemu-ga.8.gz
216  qemu-nbd.8.gz
217 share/qemu/
218  QEMU,cgthree.bin
219  QEMU,tcx.bin
220  bamboo.dtb
221  bios-256k.bin
222  bios-microvm.bin
223  bios.bin
224  canyonlands.dtb
225  edk2-aarch64-code.fd
226  edk2-arm-code.fd
227  edk2-arm-vars.fd
228  edk2-i386-code.fd
229  edk2-i386-secure-code.fd
230  edk2-i386-vars.fd
231  edk2-licenses.txt
232  edk2-x86_64-code.fd
233  edk2-x86_64-secure-code.fd
234  efi-e1000.rom
235  efi-e1000e.rom
236  efi-eepro100.rom
237  efi-ne2k_pci.rom
238  efi-pcnet.rom
239  efi-rtl8139.rom
240  efi-virtio.rom
241  efi-vmxnet3.rom
242  hppa-firmware.img
243  kvmvapic.bin
244  linuxboot.bin
245  linuxboot_dma.bin
246  multiboot.bin
247  openbios-ppc
248  openbios-sparc32
249  openbios-sparc64
250  opensbi-riscv32-virt-fw_jump.bin
251  opensbi-riscv64-sifive_u-fw_jump.bin
252  opensbi-riscv64-virt-fw_jump.bin
253  palcode-clipper
254  petalogix-ml605.dtb
255  petalogix-s3adsp1800.dtb
256  ppc_rom.bin
257  pvh.bin
258  pxe-e1000.rom
259  pxe-eepro100.rom
260  pxe-ne2k_pci.rom
261  pxe-pcnet.rom
262  pxe-rtl8139.rom
263  pxe-virtio.rom
264  qemu-nsis.bmp
265  qemu_vga.ndrv
266  s390-ccw.img
267  s390-netboot.img
268  sgabios.bin
269  skiboot.lid
270  slof.bin
271  trace-events-all
272  u-boot-sam460-20100605.bin
273  u-boot.e500
274  vgabios-ati.bin
275  vgabios-bochs-display.bin
276  vgabios-cirrus.bin
277  vgabios-qxl.bin
278  vgabios-ramfb.bin
279  vgabios-stdvga.bin
280  vgabios-virtio.bin
281  vgabios-vmware.bin
282  vgabios.bin
283 share/qemu/firmware/
284  50-edk2-i386-secure.json
285  50-edk2-x86_64-secure.json
286  60-edk2-aarch64.json
287  60-edk2-arm.json
288  60-edk2-i386.json
289  60-edk2-x86_64.json
290 share/qemu/keymaps/
291  ar
292  bepo
293  cz
294  da
295  de
296  de-ch
297  en-gb
298  en-us
299  es
300  et
301  fi
302  fo
303  fr
304  fr-be
305  fr-ca
306  fr-ch
307  hr
308  hu
309  is
310  it
311  ja
312  lt
313  lv
314  mk
315  nl
316  no
317  pl
318  pt
319  pt-br
320  ru
321  sl
322  sv
323  th
324  tr
325
326
327 [FILE:5218:manifests/plist.docs]
328 share/doc/qemu/
329  qemu-doc.html
330  qemu-doc.txt
331  qemu-ga-ref.html
332  qemu-ga-ref.txt
333  qemu-qmp-ref.html
334  qemu-qmp-ref.txt
335 share/doc/qemu/docs/
336  COLO-FT.txt
337  amd-memory-encryption.txt
338  arm-cpu-features.rst
339  barrier.txt
340  block-replication.txt
341  bootindex.txt
342  can.txt
343  ccid.txt
344  colo-proxy.txt
345  conf.py
346  cpu-hotplug.rst
347  generic-loader.txt
348  hyperv.txt
349  igd-assign.txt
350  image-fuzzer.txt
351  index.rst
352  memory-hotplug.txt
353  microvm.rst
354  multi-thread-compression.txt
355  multiseat.txt
356  nvdimm.txt
357  pci_expander_bridge.txt
358  pcie.txt
359  pcie_pci_bridge.txt
360  pr-manager.rst
361  pvrdma.txt
362  qcow2-cache.txt
363  qdev-device-use.txt
364  qemu-block-drivers.7
365  qemu-block-drivers.7.pod
366  qemu-block-drivers.texi
367  qemu-cpu-models.7
368  qemu-cpu-models.7.pod
369  qemu-cpu-models.texi
370  qemu_logo.pdf
371  qemupciserial.inf
372  rdma.txt
373  replay.txt
374  security.texi
375  spice-port-fqdn.txt
376  throttle.txt
377  usb-storage.txt
378  usb2.txt
379  version.texi
380  vfio-ap.txt
381  virtio-balloon-stats.txt
382  virtio-net-failover.rst
383  virtio-pmem.rst
384  xbzrle.txt
385  xen-save-devices-state.txt
386 share/doc/qemu/docs/built/devel/
387  .buildinfo
388  decodetree.html
389  genindex.html
390  index.html
391  kconfig.html
392  loads-stores.html
393  memory.html
394  migration.html
395  objects.inv
396  search.html
397  searchindex.js
398  secure-coding-practices.html
399  stable-process.html
400  tcg-plugins.html
401  tcg.html
402  testing.html
403 share/doc/qemu/docs/built/devel/_static/
404  alabaster.css
405  basic.css
406  custom.css
407  doctools.js
408  documentation_options.js
409  file.png
410  jquery-3.4.1.js
411  jquery.js
412  language_data.js
413  minus.png
414  plus.png
415  pygments.css
416  searchtools.js
417  underscore-1.3.1.js
418  underscore.js
419 share/doc/qemu/docs/built/interop/
420  .buildinfo
421  bitmaps.html
422  genindex.html
423  index.html
424  live-block-operations.html
425  objects.inv
426  pr-helper.html
427  qemu-ga.8
428  qemu-ga.html
429  search.html
430  searchindex.js
431  vhost-user-gpu.html
432  vhost-user.html
433 share/doc/qemu/docs/built/interop/_static/
434  alabaster.css
435  basic.css
436  custom.css
437  doctools.js
438  documentation_options.js
439  file.png
440  jquery-3.4.1.js
441  jquery.js
442  language_data.js
443  minus.png
444  plus.png
445  pygments.css
446  searchtools.js
447  underscore-1.3.1.js
448  underscore.js
449 share/doc/qemu/docs/built/specs/
450  .buildinfo
451  acpi_hw_reduced_hotplug.html
452  genindex.html
453  index.html
454  objects.inv
455  ppc-spapr-xive.html
456  ppc-xive.html
457  search.html
458  searchindex.js
459 share/doc/qemu/docs/built/specs/_static/
460  alabaster.css
461  basic.css
462  custom.css
463  doctools.js
464  documentation_options.js
465  file.png
466  jquery-3.4.1.js
467  jquery.js
468  language_data.js
469  minus.png
470  plus.png
471  pygments.css
472  searchtools.js
473  underscore-1.3.1.js
474  underscore.js
475 share/doc/qemu/docs/config/
476  ich9-ehci-uhci.cfg
477  mach-virt-graphical.cfg
478  mach-virt-serial.cfg
479  q35-emulated.cfg
480  q35-virtio-graphical.cfg
481  q35-virtio-serial.cfg
482 share/doc/qemu/docs/devel/
483  atomics.txt
484  blkdebug.txt
485  blkverify.txt
486  build-system.txt
487  conf.py
488  decodetree.rst
489  index.rst
490  kconfig.rst
491  loads-stores.rst
492  lockcnt.txt
493  memory.rst
494  migration.rst
495  multi-thread-tcg.txt
496  multiple-iothreads.txt
497  qapi-code-gen.txt
498  rcu.txt
499  replay.txt
500  s390-dasd-ipl.txt
501  secure-coding-practices.rst
502  stable-process.rst
503  tcg-plugins.rst
504  tcg.rst
505  testing.rst
506  tracing.txt
507  virtio-migration.txt
508  writing-qmp-commands.txt
509 share/doc/qemu/docs/interop/
510  bitmaps.rst
511  conf.py
512  firmware.json
513  index.rst
514  live-block-operations.rst
515  nbd.txt
516  parallels.txt
517  pr-helper.rst
518  prl-xml.txt
519  qcow2.txt
520  qed_spec.txt
521  qemu-ga-qapi.texi
522  qemu-ga-ref.7
523  qemu-ga-ref.7.pod
524  qemu-ga-ref.html
525  qemu-ga-ref.texi
526  qemu-ga-ref.txt
527  qemu-ga.rst
528  qemu-qmp-qapi.texi
529  qemu-qmp-ref.7
530  qemu-qmp-ref.7.pod
531  qemu-qmp-ref.html
532  qemu-qmp-ref.texi
533  qemu-qmp-ref.txt
534  qmp-intro.txt
535  qmp-spec.txt
536  vhost-user-gpu.rst
537  vhost-user.json
538  vhost-user.rst
539  vnc-ledstate-Pseudo-encoding.txt
540 share/doc/qemu/docs/specs/
541  acpi_cpu_hotplug.txt
542  acpi_hw_reduced_hotplug.rst
543  acpi_mem_hotplug.txt
544  acpi_nvdimm.txt
545  acpi_pci_hotplug.txt
546  conf.py
547  edu.txt
548  fw_cfg.txt
549  index.rst
550  ivshmem-spec.txt
551  pci-ids.txt
552  pci-serial.txt
553  pci-testdev.txt
554  ppc-spapr-hcalls.txt
555  ppc-spapr-hotplug.txt
556  ppc-spapr-uv-hcalls.txt
557  ppc-spapr-xive.rst
558  ppc-xive.rst
559  pvpanic.txt
560  rocker.txt
561  standard-vga.txt
562  tpm.txt
563  vmcoreinfo.txt
564  vmgenid.txt
565  vmw_pvscsi-spec.txt
566 share/doc/qemu/docs/sphinx/qmp_lexer.py
567 share/doc/qemu/docs/sphinx/__pycache__/qmp_lexer.cpython-37.pyc
568 share/doc/qemu/docs/spin/
569  aio_notify.promela
570  aio_notify_accept.promela
571  aio_notify_bug.promela
572  tcg-exclusive.promela
573  win32-qemu-event.promela
574 share/doc/qemu/interop/
575  .buildinfo
576  bitmaps.html
577  genindex.html
578  index.html
579  live-block-operations.html
580  objects.inv
581  pr-helper.html
582  qemu-ga.html
583  search.html
584  searchindex.js
585  vhost-user-gpu.html
586  vhost-user.html
587 share/doc/qemu/interop/_static/
588  alabaster.css
589  basic.css
590  custom.css
591  doctools.js
592  documentation_options.js
593  file.png
594  jquery-3.4.1.js
595  jquery.js
596  language_data.js
597  minus.png
598  plus.png
599  pygments.css
600  searchtools.js
601  underscore-1.3.1.js
602  underscore.js
603 share/doc/qemu/specs/
604  .buildinfo
605  acpi_hw_reduced_hotplug.html
606  genindex.html
607  index.html
608  objects.inv
609  ppc-spapr-xive.html
610  ppc-xive.html
611  search.html
612  searchindex.js
613 share/doc/qemu/specs/_static/
614  alabaster.css
615  basic.css
616  custom.css
617  doctools.js
618  documentation_options.js
619  file.png
620  jquery-3.4.1.js
621  jquery.js
622  language_data.js
623  minus.png
624  plus.png
625  pygments.css
626  searchtools.js
627  underscore-1.3.1.js
628  underscore.js
629
630
631 [FILE:4086:patches/patch-configure]
632 --- configure.orig      2019-12-12 18:20:47 UTC
633 +++ configure
634 @@ -489,6 +489,9 @@ numa=""
635  tcmalloc="no"
636  jemalloc="no"
637  replication="yes"
638 +pcap="no"
639 +pcap_create="no"
640 +bpf="no"
641  vxhs=""
642  bochs="yes"
643  cloop="yes"
644 @@ -1125,6 +1128,10 @@ for opt do
645    ;;
646    --enable-vnc-png) vnc_png="yes"
647    ;;
648 +  --enable-pcap) pcap="yes"
649 +  ;;
650 +  --disable-pcap) pcap="no"
651 +  ;;
652    --disable-slirp) slirp="no"
653    ;;
654    --enable-slirp=git) slirp="git"
655 @@ -3023,6 +3030,14 @@ if ! check_include "ifaddrs.h" ; then
656  fi
657  
658  ##########################################
659 +# getifaddrs (for tests/test-io-channel-socket )
660 +
661 +have_ifaddrs_h=yes
662 +if ! check_include "ifaddrs.h" ; then
663 +  have_ifaddrs_h=no
664 +fi
665 +
666 +##########################################
667  # VTE probe
668  
669  if test "$vte" != "no"; then
670 @@ -3710,7 +3725,7 @@ for i in $glib_modules; do
671          glib_libs=$($pkg_config --libs $i)
672          QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS"
673          LIBS="$glib_libs $LIBS"
674 -        libs_qga="$glib_libs $libs_qga"
675 +        libs_qga="$glib_libs -lintl $libs_qga"
676      else
677          error_exit "glib-$glib_req_ver $i is required to compile QEMU"
678      fi
679 @@ -4802,11 +4817,6 @@ has_sphinx_build() {
680  if test "$docs" != "no" ; then
681    if has makeinfo && has pod2man && has_sphinx_build; then
682      docs=yes
683 -  else
684 -    if test "$docs" = "yes" ; then
685 -      feature_not_found "docs" "Install texinfo, Perl/perl-podlators and python-sphinx"
686 -    fi
687 -    docs=no
688    fi
689  fi
690  
691 @@ -4940,7 +4950,7 @@ fi
692  
693  # check for libusb
694  if test "$libusb" != "no" ; then
695 -    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
696 +    if $pkg_config libusb-1.0; then
697          libusb="yes"
698          libusb_cflags=$($pkg_config --cflags libusb-1.0)
699          libusb_libs=$($pkg_config --libs libusb-1.0)
700 @@ -5330,6 +5340,50 @@ if test "$debug_stack_usage" = "yes"; th
701    fi
702  fi
703  
704 +##########################################
705 +# pcap probe
706 +
707 +if test "$pcap" = "yes" -a "$pcap" != "no"; then
708 +  cat > $TMPC << EOF
709 +#include <pcap.h>
710 +int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); }
711 +EOF
712 +  if test "$mingw32" = "no" ; then
713 +    libpcap=-lpcap
714 +  else
715 +    libpcap=-lwpcap
716 +  fi
717 +  if compile_prog "" "$libpcap" ; then
718 +    :
719 +  else
720 +    echo
721 +    echo "Error: Could not find pcap"
722 +    echo "Make sure to have the pcap libs and headers installed."
723 +    echo
724 +    exit 1
725 +  fi
726 +  cat > $TMPC << EOF
727 +#include <pcap.h>
728 +int main(void)
729 +{
730 +  char errbuf[PCAP_ERRBUF_SIZE];
731 +  return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0);
732 +}
733 +EOF
734 +  if compile_prog "" "$libpcap" ; then
735 +    pcap_create="yes"
736 +  fi
737 +  cat > $TMPC << EOF
738 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
739 +#include <pcap.h>
740 +#include <net/bpf.h>
741 +int main(void) { return (BPF_MAJOR_VERSION); }
742 +EOF
743 +  if compile_prog ; then
744 +    bpf="yes"
745 +  fi
746 +  libs_softmmu="$libpcap $libs_softmmu"
747 +fi # test "$pcap"
748  
749  ##########################################
750  # check if we have open_by_handle_at
751 @@ -6497,6 +6551,7 @@ echo "Audio drivers     $audio_drv_list"
752  echo "Block whitelist (rw) $block_drv_rw_whitelist"
753  echo "Block whitelist (ro) $block_drv_ro_whitelist"
754  echo "VirtFS support    $virtfs"
755 +echo "pcap support      $pcap"
756  echo "Multipath support $mpath"
757  echo "VNC support       $vnc"
758  if test "$vnc" = "yes" ; then
759 @@ -6739,6 +6794,15 @@ fi
760  if test "$want_tools" = "yes" ; then
761    echo "CONFIG_TOOLS=y" >> $config_host_mak
762  fi
763 +if test "$pcap" = "yes" ; then
764 +  echo "CONFIG_PCAP=y" >> $config_host_mak
765 +  if test "$pcap_create" = "yes" ; then
766 +    echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak
767 +  fi
768 +  if test "$bpf" = "yes" ; then
769 +    echo "CONFIG_BPF=y" >> $config_host_mak
770 +  fi
771 +fi
772  if test "$slirp" != "no"; then
773    echo "CONFIG_SLIRP=y" >> $config_host_mak
774    echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
775 @@ -6987,6 +7051,9 @@ fi
776  if test "$have_fsxattr" = "yes" ; then
777      echo "HAVE_FSXATTR=y" >> $config_host_mak
778  fi
779 +if test "$have_ifaddrs_h" = "yes" ; then
780 +    echo "HAVE_IFADDRS_H=y" >> $config_host_mak
781 +fi
782  if test "$have_copy_file_range" = "yes" ; then
783      echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak
784  fi
785
786
787 [FILE:365:patches/patch-disas_libvixl_vixl_a64_disasm-a64.cc]
788 --- disas/libvixl/vixl/a64/disasm-a64.cc.orig   2019-12-12 18:20:47 UTC
789 +++ disas/libvixl/vixl/a64/disasm-a64.cc
790 @@ -2693,7 +2693,7 @@ void Disassembler::AppendPCRelativeOffse
791    if (offset < 0) {
792      abs_offset = -abs_offset;
793    }
794 -  AppendToOutput("#%c0x%" PRIx64, sign, abs_offset);
795 +  AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset);
796  }
797  
798  
799
800
801 [FILE:582:patches/patch-include_net_net.h]
802 --- include/net/net.h.orig      2019-12-12 18:20:48 UTC
803 +++ include/net/net.h
804 @@ -208,8 +208,8 @@ void qmp_netdev_add(QDict *qdict, QObjec
805  int net_hub_id_for_client(NetClientState *nc, int *id);
806  NetClientState *net_hub_port_find(int hub_id);
807  
808 -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
809 -#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
810 +#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup"
811 +#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown"
812  #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
813  #define DEFAULT_BRIDGE_INTERFACE "br0"
814  
815
816
817 [FILE:2733:patches/patch-include_qemu_atomic.h]
818 --- include/qemu/atomic.h.orig  2019-12-12 18:20:48 UTC
819 +++ include/qemu/atomic.h
820 @@ -208,10 +208,12 @@
821  /* Provide shorter names for GCC atomic builtins, return old value */
822  #define atomic_fetch_inc(ptr)  __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
823  #define atomic_fetch_dec(ptr)  __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)
824 +#ifndef __cplusplus
825  #define atomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST)
826  #define atomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST)
827  #define atomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)
828  #define atomic_fetch_or(ptr, n)  __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)
829 +#endif
830  #define atomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST)
831  
832  #define atomic_inc_fetch(ptr)    __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
833 @@ -225,10 +227,12 @@
834  /* And even shorter names that return void.  */
835  #define atomic_inc(ptr)    ((void) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST))
836  #define atomic_dec(ptr)    ((void) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST))
837 +#ifndef __cplusplus
838  #define atomic_add(ptr, n) ((void) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST))
839  #define atomic_sub(ptr, n) ((void) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST))
840  #define atomic_and(ptr, n) ((void) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST))
841  #define atomic_or(ptr, n)  ((void) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST))
842 +#endif
843  #define atomic_xor(ptr, n) ((void) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST))
844  
845  #else /* __ATOMIC_RELAXED */
846 @@ -400,10 +404,12 @@
847  
848  #define atomic_inc_fetch(ptr)  __sync_add_and_fetch(ptr, 1)
849  #define atomic_dec_fetch(ptr)  __sync_add_and_fetch(ptr, -1)
850 +#ifndef __cplusplus
851  #define atomic_add_fetch(ptr, n) __sync_add_and_fetch(ptr, n)
852  #define atomic_sub_fetch(ptr, n) __sync_sub_and_fetch(ptr, n)
853  #define atomic_and_fetch(ptr, n) __sync_and_and_fetch(ptr, n)
854  #define atomic_or_fetch(ptr, n) __sync_or_and_fetch(ptr, n)
855 +#endif
856  #define atomic_xor_fetch(ptr, n) __sync_xor_and_fetch(ptr, n)
857  
858  #define atomic_cmpxchg(ptr, old, new) __sync_val_compare_and_swap(ptr, old, new)
859 @@ -412,10 +418,12 @@
860  /* And even shorter names that return void.  */
861  #define atomic_inc(ptr)        ((void) __sync_fetch_and_add(ptr, 1))
862  #define atomic_dec(ptr)        ((void) __sync_fetch_and_add(ptr, -1))
863 +#ifndef __cplusplus
864  #define atomic_add(ptr, n)     ((void) __sync_fetch_and_add(ptr, n))
865  #define atomic_sub(ptr, n)     ((void) __sync_fetch_and_sub(ptr, n))
866  #define atomic_and(ptr, n)     ((void) __sync_fetch_and_and(ptr, n))
867  #define atomic_or(ptr, n)      ((void) __sync_fetch_and_or(ptr, n))
868 +#endif
869  #define atomic_xor(ptr, n)     ((void) __sync_fetch_and_xor(ptr, n))
870  
871  #endif /* __ATOMIC_RELAXED */
872
873
874 [FILE:436:patches/patch-net_clients.h]
875 --- net/clients.h.orig  2019-12-12 18:20:48 UTC
876 +++ net/clients.h
877 @@ -61,4 +61,10 @@ int net_init_netmap(const Netdev *netdev
878  int net_init_vhost_user(const Netdev *netdev, const char *name,
879                          NetClientState *peer, Error **errp);
880  
881 +#ifdef CONFIG_PCAP
882 +int net_init_pcap(const Netdev *netdev, const char *name,
883 +                    NetClientState *peer, Error **errp);
884 +#endif
885 +
886 +
887  #endif /* QEMU_NET_CLIENTS_H */
888
889
890 [FILE:6930:patches/patch-net_net.c]
891 --- net/net.c.orig      2019-12-12 18:20:48 UTC
892 +++ net/net.c
893 @@ -55,6 +55,11 @@
894  #include "net/filter.h"
895  #include "qapi/string-output-visitor.h"
896  
897 +#include <sys/ioctl.h>
898 +#if defined(__FreeBSD__) || defined(__DragonFly__)
899 +#include <net/if.h>
900 +#endif
901 +
902  /* Net bridge is currently not supported for W32. */
903  #if !defined(_WIN32)
904  # define CONFIG_NET_BRIDGE
905 @@ -935,7 +940,225 @@ static int net_init_nic(const Netdev *ne
906      return idx;
907  }
908  
909 +#if defined(CONFIG_PCAP)
910 +#if defined(CONFIG_BPF)
911 +#define PCAP_DONT_INCLUDE_PCAP_BPF_H
912 +#include <net/bpf.h>
913 +#endif
914 +#include <pcap.h>
915 +
916 +struct PCAPState {
917 +    NetClientState     nc;
918 +    pcap_t            *handle;
919 +    int                max_eth_frame_size;
920 +};
921 +
922 +static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size)
923 +{
924 +    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
925 +
926 +    return pcap_inject(s->handle, (u_char*)buf, size);
927 +}
928 +
929 +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata
930 +               )
931 +{
932 +    NetClientState *nc = (NetClientState *)user;
933 +
934 +    int len = phdr->len;
935 +#if defined(__FreeBSD__) || defined(__DragonFly__)
936 +    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
937 +    int max_eth_frame_size = s->max_eth_frame_size;
938 +
939 +    if (len > max_eth_frame_size) {
940 +        fprintf(stderr,
941 +            "pcap_send: packet size > %d (%d), truncating\n",
942 +            max_eth_frame_size, len);
943 +        len = max_eth_frame_size;
944 +    }
945 +#endif
946 +    qemu_send_packet(nc, pdata, len);
947 +}
948 +
949 +static void pcap_send(void *opaque)
950 +{
951 +    struct PCAPState *s = (struct PCAPState *)opaque;
952 +
953 +    for (;;) {
954 +        if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0)
955 +            break;
956 +    }
957 +}
958 +
959 +static void pcap_cleanup(NetClientState *nc)
960 +{
961 +    struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc);
962 +
963 +    qemu_purge_queued_packets(nc);
964 +    pcap_close(s->handle);
965 +}
966 +
967 +static NetClientInfo net_pcap_info = {
968 +    .type = NET_CLIENT_DRIVER_PCAP,
969 +    .size = sizeof(struct PCAPState),
970 +    .receive = pcap_receive,
971 +//    .receive_raw = pcap_receive_raw,
972 +//    .receive_iov = pcap_receive_iov,
973 +//    .poll = pcap_poll,
974 +    .cleanup = pcap_cleanup,
975 +};
976 +/*
977 + * ... -net pcap,ifname="..."
978 + */
979 +
980 +int net_init_pcap(const Netdev *netdev,
981 +    const char *name, NetClientState *peer, Error **errp)
982 +{
983 +    const NetdevPcapOptions *pcap_opts;
984 +    NetClientState *nc;
985 +    struct PCAPState *s;
986 +    const char *ifname;
987 +    char errbuf[PCAP_ERRBUF_SIZE];
988 +#if defined(_WIN32)
989 +    HANDLE h;
990 +#endif
991 +    int i;
992 +
993 +    assert(netdev->type == NET_CLIENT_DRIVER_PCAP);
994 +    pcap_opts = &netdev->u.pcap;
995 +    if (!pcap_opts->has_ifname)
996 +        return -1;
997 +
998 +    ifname = pcap_opts->ifname;
999 +
1000 +    /* create the object */
1001 +    nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname);
1002 +    s = DO_UPCAST(struct PCAPState, nc, nc);
1003 +
1004 +    if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
1005 +        fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1006 +        goto fail;
1007 +    }
1008
1009 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1010 +    /*
1011 +     * We want to avoid passing oversize packets to the guest, which
1012 +     * at least on FreeBSD can happen if the host interface uses tso
1013 +     * (seen with an em(4) in this case) - so find out the host
1014 +    * interface's mtu and assume the guest is configured the same.
1015 +     */
1016 +    s->max_eth_frame_size = 1514;
1017 +    i = socket(AF_INET, SOCK_DGRAM, 0);
1018 +    if (i >= 0) {
1019 +        struct ifreq ifr;
1020 +
1021 +        (void) memset(&ifr, 0, sizeof(ifr));
1022 +        strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
1023 +        if (ioctl(i, SIOCGIFMTU, &ifr) != -1)
1024 +            s->max_eth_frame_size = ifr.ifr_mtu + 14;
1025 +        close(i);
1026 +    }
1027 +#endif
1028 +
1029 +#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32)
1030 +    /*
1031 +     * Create pcap handle for the device, set promiscuous mode and activate.
1032 +     */
1033 +    s->handle = (void *)pcap_create(ifname, errbuf);
1034 +    if (!s->handle) {
1035 +        fprintf(stderr, "qemu: pcap_create: %s\n", errbuf);
1036 +        goto fail;
1037 +    }
1038 +    if (pcap_set_promisc(s->handle, 1) != 0) {
1039 +        pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:");
1040 +        goto fail;
1041 +    }
1042 +   if (pcap_activate(s->handle) != 0) {
1043 +        pcap_perror(s->handle, (char *)"qemu: pcap_activate:");
1044 +        goto fail;
1045 +    }
1046 +#else
1047 +    /* Attempt to connect device. */
1048 +    s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf);
1049 +    if (!s->handle) {
1050 +        fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf);
1051 +        goto fail;
1052 +    }
1053 +#endif
1054 +
1055 +    /* Set non-blocking mode. */
1056 +    if (pcap_setnonblock(s->handle, 1, errbuf) < 0) {
1057 +        fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf);
1058 +        goto fail;
1059 +    }
1060 +
1061 +#if defined(_WIN32)
1062 +    /*
1063 +     * Tell the kernel that the packet has to be seen immediately.
1064 +     */
1065 +    if (pcap_setmintocopy(s->handle, 0) < 0) {
1066 +        fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1067 +        goto fail;
1068 +    }
1069 +#else /* !_WIN32 */
1070 +#if defined(CONFIG_BPF)
1071 +#if defined(BIOCIMMEDIATE)
1072 +    /*
1073 +     * Tell the kernel that the packet has to be seen immediately.
1074 +     */
1075 +    {
1076 +        unsigned int one = 1;
1077 +        if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) {
1078 +            fprintf(stderr, "qemu: pcap failed to set immediate mode\n");
1079 +            goto fail;
1080 +        }
1081 +    }
1082 +#endif /* BIOCIMMEDIATE */
1083 +#if defined(BIOCFEEDBACK)
1084 +    /*
1085 +     * Tell the kernel that the sent packet has to be fed back.
1086 +     * This is necessary to connect host and guest.
1087 +     */
1088 +    {
1089 +        unsigned int one = 1;
1090 +        if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) {
1091 +            fprintf(stderr, "qemu: pcap failed to set feedback mode\n");
1092 +            goto fail;
1093 +        }
1094 +    }
1095 +#endif /* BIOCFEEDBACK */
1096 +#endif /* CONFIG_BPF */
1097 +#endif /* _WIN32 */
1098 +
1099 +    snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector");
1100 +
1101 +#if defined(_WIN32)
1102 +    if ((h = pcap_getevent(s->handle)) == NULL) {
1103 +        fprintf(stderr, "qemu: pcap_getevent failed\n");
1104 +        goto fail;
1105 +    }
1106 +    qemu_add_wait_object(h, pcap_send, s);
1107 +#else /* !_WIN32 */
1108 +    if ((i = pcap_get_selectable_fd(s->handle)) < 0) {
1109 +        fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
1110 +        goto fail;
1111 +    }
1112 +    qemu_set_fd_handler(i, pcap_send, NULL, s);
1113 +#endif /* _WIN32 */
1114 +
1115 +    return 0;
1116 +
1117 +fail:
1118 +    if (s) {
1119 +        if (s->handle)
1120 +            pcap_close(s->handle);
1121 +    }
1122 +
1123 +    return -1;
1124 +}
1125  
1126 +#endif
1127
1128  static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
1129      const Netdev *netdev,
1130      const char *name,
1131 @@ -962,6 +1185,9 @@ static int (* const net_client_init_fun[
1132  #ifdef CONFIG_L2TPV3
1133          [NET_CLIENT_DRIVER_L2TPV3]    = net_init_l2tpv3,
1134  #endif
1135 +#ifdef CONFIG_PCAP
1136 +       [NET_CLIENT_DRIVER_PCAP]      = net_init_pcap,
1137 +#endif
1138  };
1139  
1140  
1141
1142
1143 [FILE:423:patches/patch-net_tap-bsd.c]
1144 --- net/tap-bsd.c.orig  2019-12-12 18:20:48 UTC
1145 +++ net/tap-bsd.c
1146 @@ -31,9 +31,16 @@
1147  
1148  #if defined(__NetBSD__) || defined(__FreeBSD__)
1149  #include <sys/ioctl.h>
1150 +#include <sys/socket.h>
1151  #include <net/if.h>
1152  #include <net/if_tap.h>
1153  #endif
1154 +#if defined(__DragonFly)
1155 +#include <sys/ioctl.h>
1156 +#include <sys/socket.h>
1157 +#include <net/if.h>
1158 +#include <net/tap/if_tap.h>
1159 +#endif
1160  
1161  #if defined(__OpenBSD__)
1162  #include <sys/param.h>
1163
1164
1165 [FILE:1550:patches/patch-qapi_net.json]
1166 --- qapi/net.json.orig  2019-12-12 18:20:48 UTC
1167 +++ qapi/net.json
1168 @@ -385,6 +385,19 @@
1169      '*helper': 'str' } }
1170  
1171  ##
1172 +# @NetdevPcapOptions:
1173 +#
1174 +# Use ifname as a source to capture
1175 +#
1176 +# @ifname: #required to determine which interface to capture
1177 +#
1178 +# Since: 1.2
1179 +##
1180 +{ 'struct': 'NetdevPcapOptions',
1181 +  'data': {
1182 +    '*ifname':     'str' } }
1183 +
1184 +##
1185  # @NetdevHubPortOptions:
1186  #
1187  # Connect two or more net clients through a software hub.
1188 @@ -451,7 +464,7 @@
1189  ##
1190  { 'enum': 'NetClientDriver',
1191    'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1192 -            'bridge', 'hubport', 'netmap', 'vhost-user' ] }
1193 +            'bridge', 'hubport', 'netmap', 'vhost-user', 'pcap' ] }
1194  
1195  ##
1196  # @Netdev:
1197 @@ -474,6 +487,7 @@
1198      'user':     'NetdevUserOptions',
1199      'tap':      'NetdevTapOptions',
1200      'l2tpv3':   'NetdevL2TPv3Options',
1201 +    'pcap':     'NetdevPcapOptions',
1202      'socket':   'NetdevSocketOptions',
1203      'vde':      'NetdevVdeOptions',
1204      'bridge':   'NetdevBridgeOptions',
1205 @@ -509,7 +523,7 @@
1206  ##
1207  { 'enum': 'NetLegacyOptionsType',
1208    'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
1209 -           'bridge', 'netmap', 'vhost-user'] }
1210 +           'bridge', 'netmap', 'vhost-user', 'pcap'] }
1211  
1212  ##
1213  # @NetLegacyOptions:
1214 @@ -526,6 +540,7 @@
1215      'user':     'NetdevUserOptions',
1216      'tap':      'NetdevTapOptions',
1217      'l2tpv3':   'NetdevL2TPv3Options',
1218 +    'pcap':     'NetdevPcapOptions',
1219      'socket':   'NetdevSocketOptions',
1220      'vde':      'NetdevVdeOptions',
1221      'bridge':   'NetdevBridgeOptions',
1222
1223
1224 [FILE:756:patches/patch-qemu-doc.texi]
1225 --- qemu-doc.texi.orig  2019-12-12 18:20:48 UTC
1226 +++ qemu-doc.texi
1227 @@ -205,7 +205,7 @@ VGA BIOS.
1228  QEMU uses YM3812 emulation by Tatsuyuki Satoh.
1229  
1230  QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
1231 -by Tibor "TS" Schütz.
1232 +by Tibor "TS" Schuetz.
1233  
1234  Note that, by default, GUS shares IRQ(7) with parallel ports and so
1235  QEMU must be told to not have parallel ports to have working GUS.
1236 @@ -573,7 +573,8 @@ Send the escape character to the fronten
1237  
1238  @c man begin SEEALSO
1239  The HTML documentation of QEMU for more precise information and Linux
1240 -user mode emulator invocation.
1241 +user mode emulator invocation, as well as the FreeBSD host notes in
1242 +@file{pkg-message} in the relevant qemu port directory.
1243  @c man end
1244  
1245  @c man begin AUTHOR
1246
1247
1248 [FILE:7685:files/pkg-message-single]
1249 FreeBSD host notes
1250 ==================
1251
1252 - Needs to set net.link.tap.user_open sysctl in order to use /dev/tap*
1253   networking as non-root.  Don't forget to adjust device node permissions in
1254   /etc/devfs.rules.
1255
1256 - slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you
1257   still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but
1258   i've been told that that's normal.  (fixed on FreeSBIE 1.1.) And you have
1259   to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is
1260   routed to 127.1 on the host.
1261
1262 - Expect timer problems when guest kernel HZ is > hosts, for example time
1263   sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe
1264   with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000,
1265   and FreeBSD's default is 100...  (no longer a problem with FreeSBIE 1.1.)
1266   The linux 2.6 kernel uses 1000 by default btw.  (changed to 250 later, and
1267   recent linux kernels now no longer have a fixed HZ, aka `tickless
1268   kernel'...)  Enabling /dev/rtc doesn't seem to help either (not included
1269   since it needs a patch to emulators/rtc.)
1270
1271 - Update: the above problem has gotten worse with FreeBSD guests
1272   somewhere before 8.0, mainly since the kernel now usually wants
1273   double or even quadruple number of timer irqs compared to HZ if
1274   it detects an apic (and at least early versions of FreeBSD 8 had
1275   a bug that essentially halved qemu's clock rate too); the only
1276   reason you usually don't see symptoms of this with FreeBSD 8
1277   guests is they automatically reduce their HZ to 100 when running
1278   in a VM while the default for the host kernel is still HZ=1000.
1279   Workaround: you can disable the apic clock in the guest by setting
1280
1281     hint.apic.0.clock="0"
1282
1283   in loader.conf(5) (or manually at the loader prompt), if that
1284   doesn't work the only things you can do is either reduce the
1285   guest's HZ to, say, 100 by setting e.g.
1286
1287     kern.hz="100"
1288
1289   from the loader as above (which usually is a good idea in a VM
1290   anyway and FreeBSD 8 now does by itself as mentioned), or otherwise
1291   increase the host's HZ to 2000 or even 4000 from the loader in
1292   the same way.
1293
1294 - The -smb option (smb-export local dir to guest using the default
1295   slirp networking) needs the samba port/package installed
1296   in addition to qemu. (SAMBA knob.)
1297
1298 - If you want to use usb devices connected to the host in the guest
1299   yot need either recent 10-current (not tested yet much) or you can
1300   use usbredir over the network (see below); also unless you are
1301   running qemu as root you then need to fix permissions for /dev/ugen*
1302   device nodes: if you are on 5.x or later (devfs) put a rule in
1303   /etc/devfs.rules, activate it in /etc/rc.conf and run /etc/rc.d/devfs
1304   restart.  Example devfs.rules:
1305
1306     [ugen_ruleset=20]
1307     add path 'ugen*' mode 660 group operator
1308
1309   corresponding rc.conf line:
1310
1311     devfs_system_ruleset="ugen_ruleset"
1312
1313 - If you want to test the new (in 0.15.0) usb network redirection (USBREDIR
1314   option) see this thread by Hans de Goede <hdegoede <at> redhat.com>:
1315
1316     http://thread.gmane.org/gmane.comp.emulators.qemu/110176/focus=110183
1317
1318   Quote:
1319
1320   Example usage:
1321
1322   1) Start usbredirserver for a usb device:
1323   sudo usbredirserver 045e:0772
1324   2) Start qemu with usb2 support + a chardev talking to usbredirserver +
1325      a usb-redir device using this chardev:
1326   qemu -usb \
1327     -readconfig docs/ich9-ehci-uhci.cfg \
1328     -chardev socket,id=usbredirchardev,host=localhost,port=4000 \
1329     -device usb-redir,chardev=usbredirchardev,id=usbredirdev ...
1330
1331   [you would replace docs/ich9-ehci-uhci.cfg with e.g.
1332   /raven/share/doc/qemu/docs/ich9-ehci-uhci.cfg, but turns out
1333   ehci was broken for me here with FreeBSD guests and the previous
1334   qemu version at least, I got:
1335
1336     FETCHENTRY: entry at 22C5484 is of type 2 which is not supported yet processing error - resetting ehci HC
1337     Assertion failed: (0), function ehci_advance_state, file /data/ports/emulators/qemu-devel/work/qemu-0.15.0/hw/usb-ehci.c, line 2045.
1338
1339   The new qemu version works better tho.]
1340
1341 - Still usb: since the hub is no longer attached to the uchi controller and
1342   the wakeup mechanism, resume interrupt is not implemented yet linux guests
1343   will suspend the bus, i.e. they wont see devices usb_add'ed after its
1344   (linux') uhci module got loaded.  Workaround: either add devices before
1345   linux loads the module or rmmod and modprobe it afterwards.  [Not sure
1346   if this still applies to the new libusb host code used on recent
1347   10-current.]
1348
1349 - If you build qemu wihout SDL and then get crashes running it try passing it
1350   -nographic.  This should probably be default in that case...
1351
1352 - qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a
1353   multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot)
1354   you can do like
1355
1356     cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu
1357
1358   and then use pxeboot-qemu.  Actually you need recent btx code
1359   (from after 7.0 was released) because of the real mode boot
1360   problem, so use at least pxeboot from there.  And I just did that
1361   for the pxeboot extracted out of
1362
1363     ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso
1364
1365   and placed it here:
1366
1367     http://people.freebsd.org/~nox/qemu/pxeboot-qemu
1368
1369 - If you use slirp (usernet, the default) and want to mount nfs into the guest
1370   and you are not running qemu as root, then mountd(8) on the exporting box
1371   needs to be run with -n in order to accept requests from ports >= 1024.
1372
1373 - (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at
1374   least) win2k guests on recent kvm (which uses similar qcow2 code than qemu
1375   now, see this thread:
1376
1377     http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html -
1378
1379   the consensus on that thread seems to be that qcow(2) code has always been
1380   experimental and you should use raw images if you want reliability; raw is
1381   also usually faster.)  You should be able to migrate existing images to raw
1382   using qemu-img(1)'s convert function; raw doesn't support advanced features
1383   like snapshots tho.  [a few important qcow2 bugfixed have been committed in
1384   the meantime so this _might_ be less of an issue now; and meanwhile there
1385   also is the new qed format - I don't know how stable that one is.]
1386
1387 - (also not FreeBSD-specific:)  It is recommended to pass raw images using the
1388   new -drive syntax, specifying format=raw explicitly in order to avoid
1389   malicious guests being able to exploit the format autodetection thats
1390   otherwise getting used.  (Not that you should run malicious guests anyway,
1391   but this eleminates at least a known attack vector.)
1392
1393 - qemu now has improved physical cdrom support, but still there is at
1394   least one known problem: you need to have the guest eject the disc if you
1395   want to change it/take it out, or otherwise the guest may continue using
1396   state (like size) of the old disc.  (You can also do like `change ide1-cd0
1397   /dev/acd0' in the monitor after taking out the disc if a guest cannot eject
1398   it itself.)
1399
1400 - The default configuration location (qemu-ifup script etc.) has been changed
1401   from /etc to PREFIX/etc (usually /raven/etc).  Move your files accordingly.
1402
1403 - The pcap code (-net nic... -net pcap,ifname=...) should work properly now,
1404   with only one exception:  Advanced features like TSO used on the host
1405   interface can cause oversize packets which now do get truncated to avoid
1406   confusing/panicing guests but of course still will cause retransmissions.
1407   So if you see slow throughput and `pcap_send: packet size > ..., truncating'
1408   messages on qemu's tty try disabling TSO etc on the host interface at least
1409   while using pcap.
1410
1411
1412 [FILE:20:files/qemu-ifdown.sample]
1413 #!/bin/sh
1414 exec true
1415
1416
1417 [FILE:20:files/qemu-ifup.sample]
1418 #!/bin/sh
1419 exec true
1420
1421
1422 [FILE:66:files/special.mk]
1423 .if "${ARCH_STANDARD}" == "x86_64"
1424 MAKE_ARGS+=     ARCH=x86_64
1425 .endif
1426
1427
1428 [FILE:436:dragonfly/patch-disas_libvixl_vixl_utils.h]
1429 --- disas/libvixl/vixl/utils.h.orig     2019-12-12 18:20:47 UTC
1430 +++ disas/libvixl/vixl/utils.h
1431 @@ -42,6 +42,13 @@ namespace vixl {
1432  #define PRINTF_CHECK(format_index, varargs_index)
1433  #endif
1434  
1435 +#ifndef INT64_C
1436 +#define INT32_C(c) c
1437 +#define INT64_C(c) (c ## LL)
1438 +#define UINT32_C(c) (c ## U)
1439 +#define UINT64_C(c) (c ## ULL)
1440 +#endif
1441 +
1442  // Check number width.
1443  inline bool is_intn(unsigned n, int64_t x) {
1444    VIXL_ASSERT((0 < n) && (n < 64));
1445
1446
1447 [FILE:323:dragonfly/patch-hw-ppc_newworld.c]
1448 --- hw/ppc/mac_newworld.c.orig  2019-12-12 18:20:47 UTC
1449 +++ hw/ppc/mac_newworld.c
1450 @@ -75,6 +75,11 @@
1451  #include "hw/sysbus.h"
1452  #include "trace.h"
1453  
1454 +/* FreeBSD headers define this */
1455 +#ifdef round_page
1456 +#undef round_page
1457 +#endif
1458 +
1459  #define MAX_IDE_BUS 2
1460  #define CFG_ADDR 0xf0000510
1461  #define TBFREQ (100UL * 1000UL * 1000UL)
1462
1463
1464 [FILE:334:dragonfly/patch-hw_ppc_mac__oldworld.c]
1465 --- hw/ppc/mac_oldworld.c.orig  2019-12-12 18:20:47 UTC
1466 +++ hw/ppc/mac_oldworld.c
1467 @@ -61,6 +61,11 @@
1468  
1469  #define GRACKLE_BASE 0xfec00000
1470  
1471 +/* FreeBSD headers define this */
1472 +#ifdef round_page
1473 +#undef round_page
1474 +#endif
1475 +
1476  static void fw_cfg_boot_set(void *opaque, const char *boot_device,
1477                              Error **errp)
1478  {
1479
1480
1481 [FILE:843:dragonfly/patch-util_coroutine-ucontext.c]
1482 --- util/coroutine-ucontext.c.orig      2019-12-12 18:20:48 UTC
1483 +++ util/coroutine-ucontext.c
1484 @@ -158,7 +158,15 @@ Coroutine *qemu_coroutine_new(void)
1485                  2, arg.i[0], arg.i[1]);
1486  
1487      /* swapcontext() in, siglongjmp() back out */
1488 -    if (!sigsetjmp(old_env, 0)) {
1489 +    /* Save signal mask in this sigsetjmp, because makecontext on DragonFly
1490 +     * leaves all signals blocked when entering the new context with
1491 +     * swapcontext.
1492 +     * Workaround this, by just having the signal mask restored by the
1493 +     * siglongjmp that brings us back from qemu_coroutine_new().
1494 +     * XXX Remove this workaround when the makecontext behaviour is fixed
1495 +     *     on DragonFly.
1496 +     */
1497 +    if (!sigsetjmp(old_env, 1)) {
1498          start_switch_fiber(&fake_stack_save, co->stack, co->stack_size);
1499          swapcontext(&old_uc, &uc);
1500      }
1501