diff options
author | Muhammad Moinur Rahman <bofh@FreeBSD.org> | 2019-09-27 17:55:47 +0000 |
---|---|---|
committer | Muhammad Moinur Rahman <bofh@FreeBSD.org> | 2019-09-27 17:55:47 +0000 |
commit | 4ece99d6b2f49f27badd8ae18ddaa599517521b1 (patch) | |
tree | 8deb3031b295ca18efce0921f7c6c6d5b0486093 /emulators | |
parent | 0dc8ba193b3809a75a5fdb4a8b52e9cc84e5561d (diff) | |
download | freebsd-ports-4ece99d6b2f49f27badd8ae18ddaa599517521b1.zip |
emulators/qemu-devel: Update version 4.0.0=>4.1.0
- Merge 4.0.X branch into emulators/qemu40
- See UPDATING for more info
Diffstat (limited to 'emulators')
21 files changed, 1208 insertions, 24 deletions
diff --git a/emulators/Makefile b/emulators/Makefile index a9a5cdf416d5..216ad395f7ff 100644 --- a/emulators/Makefile +++ b/emulators/Makefile @@ -120,6 +120,7 @@ SUBDIR += qemu-user-static SUBDIR += qemu-utils SUBDIR += qemu30 + SUBDIR += qemu40 SUBDIR += qmc2 SUBDIR += quasi88 SUBDIR += riscv-fesvr diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile index b4ffaf8a4b99..81a2c4700f80 100644 --- a/emulators/qemu-devel/Makefile +++ b/emulators/qemu-devel/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= qemu -PORTVERSION= 4.0.0 +PORTVERSION= 4.1.0 CATEGORIES= emulators MASTER_SITES= https://download.qemu.org/ PKGNAMESUFFIX= -devel @@ -21,7 +21,7 @@ LIB_DEPENDS= libnettle.so:security/nettle \ libepoxy.so:graphics/libepoxy \ libpcre2-8.so:devel/pcre2 -USES= bison cpe gmake gnome iconv:wchar_t perl5 pkgconfig python:build tar:xz +USES= bison cpe gmake gnome iconv:wchar_t perl5 pkgconfig python:build tar:xz xorg USE_GNOME= cairo glib20 libxml2 USE_PERL5= build USE_XORG= pixman @@ -90,12 +90,12 @@ DOCS_USES= makeinfo DOCS_MAKE_ARGS_OFF= NOPORTDOCS=1 PORTDOCS= docs interop/.buildinfo interop/* qemu-doc.html qemu-doc.txt qemu-ga-ref.html qemu-ga-ref.txt \ - qemu-qmp-ref.html qemu-qmp-ref.txt + qemu-qmp-ref.html qemu-qmp-ref.txt specs/.buildinfo specs/* WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation CFLAGS:= ${CFLAGS:C/-fno-tree-vrp//} CONFIGURE_ARGS= --localstatedir=/var --extra-ldflags=-L\"/usr/lib\" \ - --extra-ldflags=-L\"${LOCALBASE}/lib\" --disable-libssh2 --enable-debug \ + --extra-ldflags=-L\"${LOCALBASE}/lib\" --enable-debug \ --prefix=${PREFIX} --cc=${CC} --enable-netmap --enable-docs --disable-kvm \ --disable-linux-user --disable-linux-aio --disable-xen \ --enable-debug-info --python=${PYTHON_CMD} \ diff --git a/emulators/qemu-devel/distinfo b/emulators/qemu-devel/distinfo index 6ad6264b1d46..6b165cca39fa 100644 --- a/emulators/qemu-devel/distinfo +++ b/emulators/qemu-devel/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1556455551 -SHA256 (qemu/4.0.0/qemu-4.0.0.tar.xz) = 13a93dfe75b86734326f8d5b475fde82ec692d5b5a338b4262aeeb6b0fa4e469 -SIZE (qemu/4.0.0/qemu-4.0.0.tar.xz) = 55628624 +TIMESTAMP = 1569438904 +SHA256 (qemu/4.1.0/qemu-4.1.0.tar.xz) = 656e60218689bdeec69903087fd7582d5d3e72238d02f4481d8dc6d79fd909c6 +SIZE (qemu/4.1.0/qemu-4.1.0.tar.xz) = 54001708 diff --git a/emulators/qemu-devel/pkg-plist b/emulators/qemu-devel/pkg-plist index bf144fa1a856..8a7c10d7a7c0 100644 --- a/emulators/qemu-devel/pkg-plist +++ b/emulators/qemu-devel/pkg-plist @@ -55,6 +55,15 @@ man/man8/qemu-nbd.8.gz %%DATADIR%%/bios-256k.bin %%DATADIR%%/bios.bin %%DATADIR%%/canyonlands.dtb +%%DATADIR%%/edk2-aarch64-code.fd +%%DATADIR%%/edk2-arm-code.fd +%%DATADIR%%/edk2-arm-vars.fd +%%DATADIR%%/edk2-i386-code.fd +%%DATADIR%%/edk2-i386-secure-code.fd +%%DATADIR%%/edk2-i386-vars.fd +%%DATADIR%%/edk2-licenses.txt +%%DATADIR%%/edk2-x86_64-code.fd +%%DATADIR%%/edk2-x86_64-secure-code.fd %%DATADIR%%/efi-e1000.rom %%DATADIR%%/efi-e1000e.rom %%DATADIR%%/efi-eepro100.rom @@ -63,34 +72,45 @@ man/man8/qemu-nbd.8.gz %%DATADIR%%/efi-rtl8139.rom %%DATADIR%%/efi-virtio.rom %%DATADIR%%/efi-vmxnet3.rom +%%DATADIR%%/firmware/50-edk2-i386-secure.json +%%DATADIR%%/firmware/50-edk2-x86_64-secure.json +%%DATADIR%%/firmware/60-edk2-aarch64.json +%%DATADIR%%/firmware/60-edk2-arm.json +%%DATADIR%%/firmware/60-edk2-i386.json +%%DATADIR%%/firmware/60-edk2-x86_64.json %%DATADIR%%/hppa-firmware.img -%%DATADIR%%/qemu_vga.ndrv -%%DATADIR%%/s390-netboot.img -%%DATADIR%%/u-boot-sam460-20100605.bin -%%DATADIR%%/vgabios.bin -%%DATADIR%%/vgabios-cirrus.bin -%%DATADIR%%/vgabios-qxl.bin -%%DATADIR%%/vgabios-stdvga.bin -%%DATADIR%%/vgabios-virtio.bin -%%DATADIR%%/vgabios-vmware.bin -%%DATADIR%%/palcode-clipper -%%DATADIR%%/ppc_rom.bin +%%DATADIR%%/linuxboot.bin +%%LINUXBOOT_DMA%%%%DATADIR%%/linuxboot_dma.bin +%%DATADIR%%/multiboot.bin %%DATADIR%%/openbios-ppc %%DATADIR%%/openbios-sparc32 %%DATADIR%%/openbios-sparc64 +%%DATADIR%%/opensbi-riscv32-virt-fw_jump.bin +%%DATADIR%%/opensbi-riscv64-sifive_u-fw_jump.bin +%%DATADIR%%/opensbi-riscv64-virt-fw_jump.bin +%%DATADIR%%/palcode-clipper +%%DATADIR%%/petalogix-ml605.dtb +%%DATADIR%%/ppc_rom.bin %%DATADIR%%/pxe-e1000.rom %%DATADIR%%/pxe-eepro100.rom %%DATADIR%%/pxe-ne2k_pci.rom %%DATADIR%%/pxe-rtl8139.rom %%DATADIR%%/pxe-pcnet.rom %%DATADIR%%/pxe-virtio.rom -%%DATADIR%%/petalogix-ml605.dtb -%%DATADIR%%/spapr-rtas.bin -%%DATADIR%%/slof.bin +%%DATADIR%%/qemu-nsis.bmp +%%DATADIR%%/qemu_vga.ndrv %%DATADIR%%/s390-ccw.img -%%DATADIR%%/linuxboot.bin -%%LINUXBOOT_DMA%%%%DATADIR%%/linuxboot_dma.bin -%%DATADIR%%/multiboot.bin +%%DATADIR%%/s390-netboot.img +%%DATADIR%%/slof.bin +%%DATADIR%%/spapr-rtas.bin +%%DATADIR%%/u-boot-sam460-20100605.bin +%%DATADIR%%/vgabios.bin +%%DATADIR%%/vgabios-ati.bin +%%DATADIR%%/vgabios-cirrus.bin +%%DATADIR%%/vgabios-qxl.bin +%%DATADIR%%/vgabios-stdvga.bin +%%DATADIR%%/vgabios-virtio.bin +%%DATADIR%%/vgabios-vmware.bin %%DATADIR%%/sgabios.bin %%DATADIR%%/skiboot.lid %%DATADIR%%/trace-events-all diff --git a/emulators/qemu40/Makefile b/emulators/qemu40/Makefile new file mode 100644 index 000000000000..68d836953def --- /dev/null +++ b/emulators/qemu40/Makefile @@ -0,0 +1,161 @@ +# Created by: Juergen Lock <nox@jelal.kn-bremen.de> +# $FreeBSD$ + +PORTNAME= qemu +PORTVERSION= 4.0.0 +CATEGORIES= emulators +MASTER_SITES= https://download.qemu.org/ +PKGNAMESUFFIX= 40 +DIST_SUBDIR= qemu/${PORTVERSION} + +MAINTAINER= bofh@FreeBSD.org +COMMENT= QEMU CPU Emulator - 4.0.X version + +LICENSE= GPLv2 + +ONLY_FOR_ARCHS= amd64 i386 powerpc powerpc64 + +LIB_DEPENDS= libnettle.so:security/nettle \ + libfontconfig.so:x11-fonts/fontconfig \ + libfreetype.so:print/freetype2 \ + libepoxy.so:graphics/libepoxy \ + libpcre2-8.so:devel/pcre2 + +USES= bison cpe gmake gnome iconv:wchar_t perl5 pkgconfig python:build tar:xz +USE_GNOME= cairo glib20 libxml2 +USE_PERL5= build + +#BROKEN_powerpc64= fails to compile: In function aio_bh_poll: internal compiler error: Segmentation fault + +#.if !defined(PKGNAMESUFFIX) || (${PKGNAMESUFFIX} != "-utils" && ${PKGNAMESUFFIX} != "-guest-agent") +#.endif + +HAS_CONFIGURE= yes +MAKE_ENV+= BSD_MAKE="${MAKE}" V=1 + +OPTIONS_DEFINE= SAMBA X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CURL \ + VDE CDROM_DMA PCAP USBREDIR X86_TARGETS \ + STATIC_LINK DOCS NCURSES +SAMBA_DESC= samba dependency (for -smb) +GNUTLS_DESC= gnutls dependency (vnc encryption) +SASL_DESC= cyrus-sasl dependency (vnc encryption) +JPEG_DESC= jpeg dependency (vnc lossy compression) +PNG_DESC= png dependency (vnc compression) +CDROM_DMA_DESC= IDE CDROM DMA +PCAP_DESC= pcap dependency (networking with bpf) +USBREDIR_DESC= usb device network redirection (experimental!) +X86_TARGETS_DESC= Build only x86 system targets +STATIC_LINK_DESC= Statically link the executables +VDE_DESC= vde dependency (for vde networking) +OPTIONS_DEFAULT=X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CDROM_DMA CURL PCAP NCURSES VDE +OPTIONS_SUB= yes +X11_USE= SDL=sdl2 XORG=x11,xext GNOME=gdkpixbuf2 +X11_USES= sdl +X11_CONFIGURE_ENABLE= sdl +GTK3_LIB_DEPENDS= libxkbcommon.so:x11/libxkbcommon +GTK3_USE= GNOME=gdkpixbuf2,gtk30,vte3 XORG=x11,xext +GTK3_USES= gettext gl +GTK3_CONFIGURE_OFF= --disable-gtk --disable-vte +GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls +GNUTLS_CONFIGURE_OFF= --disable-gnutls +SASL_LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2 +SASL_CONFIGURE_OFF= --disable-vnc-sasl +JPEG_USES= jpeg +JPEG_CONFIGURE_OFF= --disable-vnc-jpeg +PNG_LIB_DEPENDS= libpng.so:graphics/png +PNG_CONFIGURE_OFF= --disable-vnc-png +CURL_LIB_DEPENDS= libcurl.so:ftp/curl +CURL_CONFIGURE_OFF= --disable-curl +OPENGL_USE= GL=gl +OPENGL_USES= gl +OPENGL_CONFIGURE_OFF= --disable-opengl +USBREDIR_BUILD_DEPENDS= usbredir>=0.6:net/usbredir +USBREDIR_RUN_DEPENDS= usbredir>=0.6:net/usbredir +USBREDIR_CONFIGURE_OFF= --disable-usb-redir +PCAP_CONFIGURE_ON= --enable-pcap +PCAP_EXTRA_PATCHES= ${FILESDIR}/pcap-patch-qapi_net.json ${FILESDIR}/pcap-patch-net_net.c \ + ${FILESDIR}/pcap-patch-net_clients.h +VDE_LIB_DEPENDS= libvdeplug.so:net/vde2 +VDE_CONFIGURE_OFF= --disable-vde +STATIC_LINK_CONFIGURE_ON= --static +STATIC_LINK_PREVENTS= GTK3 X11 +STATIC_LINK_PREVENTS_MSG= X11 ui cannot be built static +NCURSES_USES= ncurses:base +SAMBA_USES= samba:run # smbd +SAMBA_CONFIGURE_ON= --smbd=${LOCALBASE}/sbin/smbd +DOCS_BUILD_DEPENDS= texi2html:textproc/texi2html \ + sphinx-build:textproc/py-sphinx +DOCS_USES= makeinfo +DOCS_MAKE_ARGS_OFF= NOPORTDOCS=1 +X86_TARGETS_USE_OFF= XORG=pixman,x11 +X86_TARGETS_USES_OFF= xorg + +PORTDOCS= docs interop/.buildinfo interop/* qemu-doc.html qemu-doc.txt qemu-ga-ref.html qemu-ga-ref.txt \ + qemu-qmp-ref.html qemu-qmp-ref.txt + +WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation +CFLAGS:= ${CFLAGS:C/-fno-tree-vrp//} +CONFIGURE_ARGS= --localstatedir=/var --extra-ldflags=-L\"/usr/lib\" \ + --extra-ldflags=-L\"${LOCALBASE}/lib\" --disable-libssh2 --enable-debug \ + --prefix=${PREFIX} --cc=${CC} --enable-netmap --enable-docs --disable-kvm \ + --disable-linux-user --disable-linux-aio --disable-xen \ + --enable-debug-info --python=${PYTHON_CMD} \ + --extra-cflags=-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=\\\"\"${PREFIX}\\\"\" +INSTALLS_ICONS= yes + +.include <bsd.port.options.mk> + +.if !defined(STRIP) || ${STRIP} == "" +CONFIGURE_ARGS+=--disable-strip +.endif + +.if ${ARCH} == "amd64" +MAKE_ARGS+= ARCH=x86_64 +.endif + +.if ${ARCH} == "powerpc" +MAKE_ARGS+= ARCH=ppc +.endif + +.if ${ARCH} == "powerpc64" +MAKE_ARGS+= ARCH=ppc64 +.endif + +.if ${ARCH} == "sparc64" +CONFIGURE_ARGS+= --sparc_cpu=v9 +.endif + +PLIST_SUB+= LINUXBOOT_DMA="" + +# -lprocstat actually only _needs_ -lelf after r249666 or r250870 (MFC) +# but it shouldn't matter much +post-patch: + @${REINPLACE_CMD} -e '/LIBS/s|-lprocstat|-lprocstat -lelf|' \ + -e '/libusb/s/ --atleast-version=1\.0\.[0-9]*//' \ + ${WRKSRC}/configure + @${REINPLACE_CMD} -E \ + -e "s|^(CFLAGS=).*|\1${CFLAGS} -fno-strict-aliasing -I.|" \ + -e "s|^(LDFLAGS=).*|\1${LDFLAGS}|" \ + ${WRKSRC}/Makefile + +post-patch-CDROM_DMA-off: + @${REINPLACE_CMD} -e '/USE_DMA_CDROM/d' ${WRKSRC}/include/hw/ide/internal.h + +# XXX need to disable usb host code on head while it's not ported to the +# new usb stack yet +post-configure: + @${REINPLACE_CMD} -E \ + -e "s|^(HOST_USB=)bsd|\1stub|" \ + ${WRKSRC}/config-host.mak + +.if !target(post-install) +post-install: + ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${STAGEDIR}${PREFIX}/etc + ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${STAGEDIR}${PREFIX}/etc + @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-* + +post-install-DOCS-on: + @(cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${DOCSDIR}/) +.endif + +.include <bsd.port.mk> diff --git a/emulators/qemu40/distinfo b/emulators/qemu40/distinfo new file mode 100644 index 000000000000..6ad6264b1d46 --- /dev/null +++ b/emulators/qemu40/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1556455551 +SHA256 (qemu/4.0.0/qemu-4.0.0.tar.xz) = 13a93dfe75b86734326f8d5b475fde82ec692d5b5a338b4262aeeb6b0fa4e469 +SIZE (qemu/4.0.0/qemu-4.0.0.tar.xz) = 55628624 diff --git a/emulators/qemu40/files/patch-Makefile b/emulators/qemu40/files/patch-Makefile new file mode 100644 index 000000000000..095b684f8e80 --- /dev/null +++ b/emulators/qemu40/files/patch-Makefile @@ -0,0 +1,42 @@ +--- Makefile.orig 2019-04-23 18:14:45 UTC ++++ Makefile +@@ -311,9 +311,14 @@ LIBS+=-lz $(LIBS_TOOLS) + HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = qemu-bridge-helper$(EXESUF) + + ifdef BUILD_DOCS ++ifdef NOPORTDOCS ++DOCS=qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8 ++DOCS+=docs/interop/qemu-qmp-ref.7 docs/interop/qemu-ga-ref.7 ++else + DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8 + DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7 + DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7 ++endif + DOCS+=docs/qemu-block-drivers.7 + DOCS+=docs/qemu-cpu-models.7 + ifdef CONFIG_VIRTFS +@@ -742,11 +747,13 @@ install-sphinxdocs: sphinxdocs + $(call install-manual,interop) + + install-doc: $(DOCS) install-sphinxdocs ++ifndef NOPORTDOCS + $(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)" + $(INSTALL_DATA) qemu-doc.html "$(DESTDIR)$(qemu_docdir)" + $(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)" + $(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)" + $(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)" ++endif + ifdef CONFIG_POSIX + $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" + $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1" +@@ -764,8 +771,10 @@ ifdef CONFIG_TRACE_SYSTEMTAP + endif + ifneq (,$(findstring qemu-ga,$(TOOLS))) + $(INSTALL_DATA) qemu-ga.8 "$(DESTDIR)$(mandir)/man8" ++ifndef NOPORTDOCS + $(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir)" + $(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)" ++endif + $(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7" + endif + endif diff --git a/emulators/qemu40/files/patch-configure b/emulators/qemu40/files/patch-configure new file mode 100644 index 000000000000..c41037e2774c --- /dev/null +++ b/emulators/qemu40/files/patch-configure @@ -0,0 +1,163 @@ +--- configure.orig 2019-04-23 18:14:45 UTC ++++ configure +@@ -396,7 +396,7 @@ DSOSUF=".so" + LDFLAGS_SHARED="-shared" + modules="no" + prefix="/usr/local" +-mandir="\${prefix}/share/man" ++mandir="\${prefix}/man" + datadir="\${prefix}/share" + firmwarepath="\${prefix}/share/qemu-firmware" + qemu_docdir="\${prefix}/share/doc/qemu" +@@ -476,6 +476,9 @@ numa="" + tcmalloc="no" + jemalloc="no" + replication="yes" ++pcap="no" ++pcap_create="no" ++bpf="no" + vxhs="" + bochs="yes" + cloop="yes" +@@ -1118,6 +1121,10 @@ for opt do + ;; + --enable-vnc-png) vnc_png="yes" + ;; ++ --enable-pcap) pcap="yes" ++ ;; ++ --disable-pcap) pcap="no" ++ ;; + --disable-slirp) slirp="no" + ;; + --enable-slirp=system) slirp="system" +@@ -2972,6 +2979,14 @@ if ! check_include "ifaddrs.h" ; then + fi + + ########################################## ++# getifaddrs (for tests/test-io-channel-socket ) ++ ++have_ifaddrs_h=yes ++if ! check_include "ifaddrs.h" ; then ++ have_ifaddrs_h=no ++fi ++ ++########################################## + # VTE probe + + if test "$vte" != "no"; then +@@ -3629,7 +3644,7 @@ for i in $glib_modules; do + glib_libs=$($pkg_config --libs $i) + QEMU_CFLAGS="$glib_cflags $QEMU_CFLAGS" + LIBS="$glib_libs $LIBS" +- libs_qga="$glib_libs $libs_qga" ++ libs_qga="$glib_libs -lintl $libs_qga" + else + error_exit "glib-$glib_req_ver $i is required to compile QEMU" + fi +@@ -4723,11 +4738,6 @@ has_sphinx_build() { + if test "$docs" != "no" ; then + if has makeinfo && has pod2man && has_sphinx_build; then + docs=yes +- else +- if test "$docs" = "yes" ; then +- feature_not_found "docs" "Install texinfo, Perl/perl-podlators and python-sphinx" +- fi +- docs=no + fi + fi + +@@ -4861,7 +4871,7 @@ fi + + # check for libusb + if test "$libusb" != "no" ; then +- if $pkg_config --atleast-version=1.0.13 libusb-1.0; then ++ if $pkg_config libusb-1.0; then + libusb="yes" + libusb_cflags=$($pkg_config --cflags libusb-1.0) + libusb_libs=$($pkg_config --libs libusb-1.0) +@@ -5251,7 +5261,51 @@ if test "$debug_stack_usage" = "yes"; then + fi + fi + ++########################################## ++# pcap probe + ++if test "$pcap" = "yes" -a "$pcap" != "no"; then ++ cat > $TMPC << EOF ++#include <pcap.h> ++int main(void) { return (pcap_lib_version() == (char *)0 ? 1 : 0); } ++EOF ++ if test "$mingw32" = "no" ; then ++ libpcap=-lpcap ++ else ++ libpcap=-lwpcap ++ fi ++ if compile_prog "" "$libpcap" ; then ++ : ++ else ++ echo ++ echo "Error: Could not find pcap" ++ echo "Make sure to have the pcap libs and headers installed." ++ echo ++ exit 1 ++ fi ++ cat > $TMPC << EOF ++#include <pcap.h> ++int main(void) ++{ ++ char errbuf[PCAP_ERRBUF_SIZE]; ++ return (pcap_create("foo", errbuf) == (pcap_t *)0 ? 1 : 0); ++} ++EOF ++ if compile_prog "" "$libpcap" ; then ++ pcap_create="yes" ++ fi ++ cat > $TMPC << EOF ++#define PCAP_DONT_INCLUDE_PCAP_BPF_H ++#include <pcap.h> ++#include <net/bpf.h> ++int main(void) { return (BPF_MAJOR_VERSION); } ++EOF ++ if compile_prog ; then ++ bpf="yes" ++ fi ++ libs_softmmu="$libpcap $libs_softmmu" ++fi # test "$pcap" ++ + ########################################## + # check if we have open_by_handle_at + +@@ -6332,6 +6386,7 @@ echo "Audio drivers $audio_drv_list" + echo "Block whitelist (rw) $block_drv_rw_whitelist" + echo "Block whitelist (ro) $block_drv_ro_whitelist" + echo "VirtFS support $virtfs" ++echo "pcap support $pcap" + echo "Multipath support $mpath" + echo "VNC support $vnc" + if test "$vnc" = "yes" ; then +@@ -6565,6 +6620,15 @@ fi + if test "$profiler" = "yes" ; then + echo "CONFIG_PROFILER=y" >> $config_host_mak + fi ++if test "$pcap" = "yes" ; then ++ echo "CONFIG_PCAP=y" >> $config_host_mak ++ if test "$pcap_create" = "yes" ; then ++ echo "CONFIG_PCAP_CREATE=y" >> $config_host_mak ++ fi ++ if test "$bpf" = "yes" ; then ++ echo "CONFIG_BPF=y" >> $config_host_mak ++ fi ++fi + if test "$slirp" != "no"; then + echo "CONFIG_SLIRP=y" >> $config_host_mak + echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak +@@ -6812,6 +6876,9 @@ fi + # if this macro is set. + if test "$have_fsxattr" = "yes" ; then + echo "HAVE_FSXATTR=y" >> $config_host_mak ++fi ++if test "$have_ifaddrs_h" = "yes" ; then ++ echo "HAVE_IFADDRS_H=y" >> $config_host_mak + fi + if test "$have_copy_file_range" = "yes" ; then + echo "HAVE_COPY_FILE_RANGE=y" >> $config_host_mak diff --git a/emulators/qemu40/files/patch-disas_libvixl_vixl_a64_disasm-a64.cc b/emulators/qemu40/files/patch-disas_libvixl_vixl_a64_disasm-a64.cc new file mode 100644 index 000000000000..546595845c62 --- /dev/null +++ b/emulators/qemu40/files/patch-disas_libvixl_vixl_a64_disasm-a64.cc @@ -0,0 +1,11 @@ +--- disas/libvixl/vixl/a64/disasm-a64.cc.orig 2019-04-23 18:14:45 UTC ++++ disas/libvixl/vixl/a64/disasm-a64.cc +@@ -2693,7 +2693,7 @@ void Disassembler::AppendPCRelativeOffsetToOutput(cons + if (offset < 0) { + abs_offset = -abs_offset; + } +- AppendToOutput("#%c0x%" PRIx64, sign, abs_offset); ++ AppendToOutput("#%c0x%" PRIx64, sign, offset < 0 ? -offset : offset); + } + + diff --git a/emulators/qemu40/files/patch-include_net_net.h b/emulators/qemu40/files/patch-include_net_net.h new file mode 100644 index 000000000000..92d57989a03f --- /dev/null +++ b/emulators/qemu40/files/patch-include_net_net.h @@ -0,0 +1,13 @@ +--- include/net/net.h.orig 2019-04-23 18:14:46 UTC ++++ include/net/net.h +@@ -209,8 +209,8 @@ void qmp_netdev_add(QDict *qdict, QObject **ret, Error + int net_hub_id_for_client(NetClientState *nc, int *id); + NetClientState *net_hub_port_find(int hub_id); + +-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" +-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" ++#define DEFAULT_NETWORK_SCRIPT PREFIX "/etc/qemu-ifup" ++#define DEFAULT_NETWORK_DOWN_SCRIPT PREFIX "/etc/qemu-ifdown" + #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" + #define DEFAULT_BRIDGE_INTERFACE "br0" + diff --git a/emulators/qemu40/files/patch-include_qemu_atomic.h b/emulators/qemu40/files/patch-include_qemu_atomic.h new file mode 100644 index 000000000000..623073e0b29a --- /dev/null +++ b/emulators/qemu40/files/patch-include_qemu_atomic.h @@ -0,0 +1,54 @@ +--- include/qemu/atomic.h.orig 2019-04-23 18:14:46 UTC ++++ include/qemu/atomic.h +@@ -201,10 +201,12 @@ + /* Provide shorter names for GCC atomic builtins, return old value */ + #define atomic_fetch_inc(ptr) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST) + #define atomic_fetch_dec(ptr) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST) ++#ifndef __cplusplus + #define atomic_fetch_add(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST) + #define atomic_fetch_sub(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST) + #define atomic_fetch_and(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST) + #define atomic_fetch_or(ptr, n) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST) ++#endif + #define atomic_fetch_xor(ptr, n) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST) + + #define atomic_inc_fetch(ptr) __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST) +@@ -218,10 +220,12 @@ + /* And even shorter names that return void. */ + #define atomic_inc(ptr) ((void) __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)) + #define atomic_dec(ptr) ((void) __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)) ++#ifndef __cplusplus + #define atomic_add(ptr, n) ((void) __atomic_fetch_add(ptr, n, __ATOMIC_SEQ_CST)) + #define atomic_sub(ptr, n) ((void) __atomic_fetch_sub(ptr, n, __ATOMIC_SEQ_CST)) + #define atomic_and(ptr, n) ((void) __atomic_fetch_and(ptr, n, __ATOMIC_SEQ_CST)) + #define atomic_or(ptr, n) ((void) __atomic_fetch_or(ptr, n, __ATOMIC_SEQ_CST)) ++#endif + #define atomic_xor(ptr, n) ((void) __atomic_fetch_xor(ptr, n, __ATOMIC_SEQ_CST)) + + #else /* __ATOMIC_RELAXED */ +@@ -389,10 +393,12 @@ + + #define atomic_inc_fetch(ptr) __sync_add_and_fetch(ptr, 1) + #define atomic_dec_fetch(ptr) __sync_add_and_fetch(ptr, -1) ++#ifndef __cplusplus + #define atomic_add_fetch(ptr, n) __sync_add_and_fetch(ptr, n) + #define atomic_sub_fetch(ptr, n) __sync_sub_and_fetch(ptr, n) + #define atomic_and_fetch(ptr, n) __sync_and_and_fetch(ptr, n) + #define atomic_or_fetch(ptr, n) __sync_or_and_fetch(ptr, n) ++#endif + #define atomic_xor_fetch(ptr, n) __sync_xor_and_fetch(ptr, n) + + #define atomic_cmpxchg(ptr, old, new) __sync_val_compare_and_swap(ptr, old, new) +@@ -401,10 +407,12 @@ + /* And even shorter names that return void. */ + #define atomic_inc(ptr) ((void) __sync_fetch_and_add(ptr, 1)) + #define atomic_dec(ptr) ((void) __sync_fetch_and_add(ptr, -1)) ++#ifndef __cplusplus + #define atomic_add(ptr, n) ((void) __sync_fetch_and_add(ptr, n)) + #define atomic_sub(ptr, n) ((void) __sync_fetch_and_sub(ptr, n)) + #define atomic_and(ptr, n) ((void) __sync_fetch_and_and(ptr, n)) + #define atomic_or(ptr, n) ((void) __sync_fetch_and_or(ptr, n)) ++#endif + #define atomic_xor(ptr, n) ((void) __sync_fetch_and_xor(ptr, n)) + + #endif /* __ATOMIC_RELAXED */ diff --git a/emulators/qemu40/files/patch-net_tap-bsd.c b/emulators/qemu40/files/patch-net_tap-bsd.c new file mode 100644 index 000000000000..6d94c1bde1ca --- /dev/null +++ b/emulators/qemu40/files/patch-net_tap-bsd.c @@ -0,0 +1,10 @@ +--- net/tap-bsd.c.orig 2019-04-23 18:14:46 UTC ++++ net/tap-bsd.c +@@ -31,6 +31,7 @@ + + #if defined(__NetBSD__) || defined(__FreeBSD__) + #include <sys/ioctl.h> ++#include <sys/socket.h> + #include <net/if.h> + #include <net/if_tap.h> + #endif diff --git a/emulators/qemu40/files/patch-qemu-doc.texi b/emulators/qemu40/files/patch-qemu-doc.texi new file mode 100644 index 000000000000..aa79d423f792 --- /dev/null +++ b/emulators/qemu40/files/patch-qemu-doc.texi @@ -0,0 +1,21 @@ +--- qemu-doc.texi.orig 2019-04-23 18:14:46 UTC ++++ qemu-doc.texi +@@ -200,7 +200,7 @@ VGA BIOS. + QEMU uses YM3812 emulation by Tatsuyuki Satoh. + + QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/}) +-by Tibor "TS" Schütz. ++by Tibor "TS" Schuetz. + + Note that, by default, GUS shares IRQ(7) with parallel ports and so + QEMU must be told to not have parallel ports to have working GUS. +@@ -560,7 +560,8 @@ Send the escape character to the frontend + + @c man begin SEEALSO + The HTML documentation of QEMU for more precise information and Linux +-user mode emulator invocation. ++user mode emulator invocation, as well as the FreeBSD host notes in ++@file{pkg-message} in the relevant qemu port directory. + @c man end + + @c man begin AUTHOR diff --git a/emulators/qemu40/files/pcap-patch-net_clients.h b/emulators/qemu40/files/pcap-patch-net_clients.h new file mode 100644 index 000000000000..5b56f1b2f49a --- /dev/null +++ b/emulators/qemu40/files/pcap-patch-net_clients.h @@ -0,0 +1,13 @@ +--- net/clients.h.orig 2018-04-24 16:30:47 UTC ++++ net/clients.h +@@ -61,4 +61,10 @@ int net_init_netmap(const Netdev *netdev, const char * + int net_init_vhost_user(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp); + ++#ifdef CONFIG_PCAP ++int net_init_pcap(const Netdev *netdev, const char *name, ++ NetClientState *peer, Error **errp); ++#endif ++ ++ + #endif /* QEMU_NET_CLIENTS_H */ diff --git a/emulators/qemu40/files/pcap-patch-net_net.c b/emulators/qemu40/files/pcap-patch-net_net.c new file mode 100644 index 000000000000..6fa5ca941f7d --- /dev/null +++ b/emulators/qemu40/files/pcap-patch-net_net.c @@ -0,0 +1,250 @@ +--- net/net.c.orig 2018-04-24 16:30:47 UTC ++++ net/net.c +@@ -52,6 +52,11 @@ + #include "net/filter.h" + #include "qapi/string-output-visitor.h" + ++#include <sys/ioctl.h> ++#ifdef __FreeBSD__ ++#include <net/if.h> ++#endif ++ + /* Net bridge is currently not supported for W32. */ + #if !defined(_WIN32) + # define CONFIG_NET_BRIDGE +@@ -929,7 +934,225 @@ static int net_init_nic(const Netdev *netdev, const ch + return idx; + } + ++#if defined(CONFIG_PCAP) ++#if defined(CONFIG_BPF) ++#define PCAP_DONT_INCLUDE_PCAP_BPF_H ++#include <net/bpf.h> ++#endif ++#include <pcap.h> + ++struct PCAPState { ++ NetClientState nc; ++ pcap_t *handle; ++ int max_eth_frame_size; ++}; ++ ++static ssize_t pcap_receive(NetClientState *nc, const uint8_t *buf, size_t size) ++{ ++ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc); ++ ++ return pcap_inject(s->handle, (u_char*)buf, size); ++} ++ ++static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata ++ ) ++{ ++ NetClientState *nc = (NetClientState *)user; ++ ++ int len = phdr->len; ++#ifdef __FreeBSD__ ++ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc); ++ int max_eth_frame_size = s->max_eth_frame_size; ++ ++ if (len > max_eth_frame_size) { ++ fprintf(stderr, ++ "pcap_send: packet size > %d (%d), truncating\n", ++ max_eth_frame_size, len); ++ len = max_eth_frame_size; ++ } ++#endif ++ qemu_send_packet(nc, pdata, len); ++} ++ ++static void pcap_send(void *opaque) ++{ ++ struct PCAPState *s = (struct PCAPState *)opaque; ++ ++ for (;;) { ++ if (pcap_dispatch(s->handle, 0, (pcap_handler)&pcap_callback, (u_char *)&s->nc) >= 0) ++ break; ++ } ++} ++ ++static void pcap_cleanup(NetClientState *nc) ++{ ++ struct PCAPState *s = DO_UPCAST(struct PCAPState, nc, nc); ++ ++ qemu_purge_queued_packets(nc); ++ pcap_close(s->handle); ++} ++ ++static NetClientInfo net_pcap_info = { ++ .type = NET_CLIENT_DRIVER_PCAP, ++ .size = sizeof(struct PCAPState), ++ .receive = pcap_receive, ++// .receive_raw = pcap_receive_raw, ++// .receive_iov = pcap_receive_iov, ++// .poll = pcap_poll, ++ .cleanup = pcap_cleanup, ++}; ++/* ++ * ... -net pcap,ifname="..." ++ */ ++ ++int net_init_pcap(const Netdev *netdev, ++ const char *name, NetClientState *peer, Error **errp) ++{ ++ const NetdevPcapOptions *pcap_opts; ++ NetClientState *nc; ++ struct PCAPState *s; ++ const char *ifname; ++ char errbuf[PCAP_ERRBUF_SIZE]; ++#if defined(_WIN32) ++ HANDLE h; ++#endif ++ int i; ++ ++ assert(netdev->type == NET_CLIENT_DRIVER_PCAP); ++ pcap_opts = &netdev->u.pcap; ++ if (!pcap_opts->has_ifname) ++ return -1; ++ ++ ifname = pcap_opts->ifname; ++ ++ /* create the object */ ++ nc = qemu_new_net_client(&net_pcap_info, peer, "pcap", ifname); ++ s = DO_UPCAST(struct PCAPState, nc, nc); ++ ++ if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) { ++ fprintf(stderr, "qemu: pcap_create: %s\n", errbuf); ++ goto fail; ++ } ++ ++#ifdef __FreeBSD__ ++ /* ++ * We want to avoid passing oversize packets to the guest, which ++ * at least on FreeBSD can happen if the host interface uses tso ++ * (seen with an em(4) in this case) - so find out the host ++ * interface's mtu and assume the guest is configured the same. ++ */ ++ s->max_eth_frame_size = 1514; ++ i = socket(AF_INET, SOCK_DGRAM, 0); ++ if (i >= 0) { ++ struct ifreq ifr; ++ ++ (void) memset(&ifr, 0, sizeof(ifr)); ++ strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); ++ if (ioctl(i, SIOCGIFMTU, &ifr) != -1) ++ s->max_eth_frame_size = ifr.ifr_mtu + 14; ++ close(i); ++ } ++#endif ++ ++#if defined(CONFIG_PCAP_CREATE) || defined(_WIN32) ++ /* ++ * Create pcap handle for the device, set promiscuous mode and activate. ++ */ ++ s->handle = (void *)pcap_create(ifname, errbuf); ++ if (!s->handle) { ++ fprintf(stderr, "qemu: pcap_create: %s\n", errbuf); ++ goto fail; ++ } ++ if (pcap_set_promisc(s->handle, 1) != 0) { ++ pcap_perror(s->handle, (char *)"qemu: pcap_set_promisc:"); ++ goto fail; ++ } ++ if (pcap_activate(s->handle) != 0) { ++ pcap_perror(s->handle, (char *)"qemu: pcap_activate:"); ++ goto fail; ++ } ++#else ++ /* Attempt to connect device. */ ++ s->handle = (void *)pcap_open_live(ifname, 65535, 1, 0, errbuf); ++ if (!s->handle) { ++ fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf); ++ goto fail; ++ } ++#endif ++ ++ /* Set non-blocking mode. */ ++ if (pcap_setnonblock(s->handle, 1, errbuf) < 0) { ++ fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf); ++ goto fail; ++ } ++ ++#if defined(_WIN32) ++ /* ++ * Tell the kernel that the packet has to be seen immediately. ++ */ ++ if (pcap_setmintocopy(s->handle, 0) < 0) { ++ fprintf(stderr, "qemu: pcap failed to set immediate mode\n"); ++ goto fail; ++ } ++#else /* !_WIN32 */ ++#if defined(CONFIG_BPF) ++#if defined(BIOCIMMEDIATE) ++ /* ++ * Tell the kernel that the packet has to be seen immediately. ++ */ ++ { ++ unsigned int one = 1; ++ if (ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one) < 0) { ++ fprintf(stderr, "qemu: pcap failed to set immediate mode\n"); ++ goto fail; ++ } ++ } ++#endif /* BIOCIMMEDIATE */ ++#if defined(BIOCFEEDBACK) ++ /* ++ * Tell the kernel that the sent packet has to be fed back. ++ * This is necessary to connect host and guest. ++ */ ++ { ++ unsigned int one = 1; ++ if (ioctl(pcap_fileno(s->handle), BIOCFEEDBACK, &one) < 0) { ++ fprintf(stderr, "qemu: pcap failed to set feedback mode\n"); ++ goto fail; ++ } ++ } ++#endif /* BIOCFEEDBACK */ ++#endif /* CONFIG_BPF */ ++#endif /* _WIN32 */ ++ ++ snprintf(s->nc.info_str, sizeof(s->nc.info_str), "pcap redirector"); ++ ++#if defined(_WIN32) ++ if ((h = pcap_getevent(s->handle)) == NULL) { ++ fprintf(stderr, "qemu: pcap_getevent failed\n"); ++ goto fail; ++ } ++ qemu_add_wait_object(h, pcap_send, s); ++#else /* !_WIN32 */ ++ if ((i = pcap_get_selectable_fd(s->handle)) < 0) { ++ fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n"); ++ goto fail; ++ } ++ qemu_set_fd_handler(i, pcap_send, NULL, s); ++#endif /* _WIN32 */ ++ ++ return 0; ++ ++fail: ++ if (s) { ++ if (s->handle) ++ pcap_close(s->handle); ++ } ++ ++ return -1; ++} ++ ++#endif ++ + static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])( + const Netdev *netdev, + const char *name, +@@ -955,6 +1178,9 @@ static int (* const net_client_init_fun[NET_CLIENT_DRI + #endif + #ifdef CONFIG_L2TPV3 + [NET_CLIENT_DRIVER_L2TPV3] = net_init_l2tpv3, ++#endif ++#ifdef CONFIG_PCAP ++ [NET_CLIENT_DRIVER_PCAP] = net_init_pcap, + #endif + }; + diff --git a/emulators/qemu40/files/pcap-patch-qapi_net.json b/emulators/qemu40/files/pcap-patch-qapi_net.json new file mode 100644 index 000000000000..39114c65d591 --- /dev/null +++ b/emulators/qemu40/files/pcap-patch-qapi_net.json @@ -0,0 +1,56 @@ +--- qapi/net.json.orig 2018-04-24 16:30:47 UTC ++++ qapi/net.json +@@ -388,6 +388,19 @@ + '*helper': 'str' } } + + ## ++# @NetdevPcapOptions: ++# ++# Use ifname as a source to capture ++# ++# @ifname: #required to determine which interface to capture ++# ++# Since: 1.2 ++## ++{ 'struct': 'NetdevPcapOptions', ++ 'data': { ++ '*ifname': 'str' } } ++ ++## + # @NetdevHubPortOptions: + # + # Connect two or more net clients through a software hub. +@@ -454,7 +467,7 @@ + ## + { 'enum': 'NetClientDriver', + 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', +- 'bridge', 'hubport', 'netmap', 'vhost-user' ] } ++ 'bridge', 'hubport', 'netmap', 'vhost-user', 'pcap' ] } + + ## + # @Netdev: +@@ -478,6 +491,7 @@ + 'user': 'NetdevUserOptions', + 'tap': 'NetdevTapOptions', + 'l2tpv3': 'NetdevL2TPv3Options', ++ 'pcap': 'NetdevPcapOptions', + 'socket': 'NetdevSocketOptions', + 'vde': 'NetdevVdeOptions', + 'bridge': 'NetdevBridgeOptions', +@@ -514,7 +528,7 @@ + ## + { 'enum': 'NetLegacyOptionsType', + 'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', +- 'bridge', 'netmap', 'vhost-user'] } ++ 'bridge', 'netmap', 'vhost-user', 'pcap'] } + + ## + # @NetLegacyOptions: +@@ -532,6 +546,7 @@ + 'user': 'NetdevUserOptions', + 'tap': 'NetdevTapOptions', + 'l2tpv3': 'NetdevL2TPv3Options', ++ 'pcap': 'NetdevPcapOptions', + 'socket': 'NetdevSocketOptions', + 'vde': 'NetdevVdeOptions', + 'bridge': 'NetdevBridgeOptions', diff --git a/emulators/qemu40/files/qemu-ifdown.sample b/emulators/qemu40/files/qemu-ifdown.sample new file mode 100644 index 000000000000..89d9a9bff436 --- /dev/null +++ b/emulators/qemu40/files/qemu-ifdown.sample @@ -0,0 +1,2 @@ +#!/bin/sh +exec true diff --git a/emulators/qemu40/files/qemu-ifup.sample b/emulators/qemu40/files/qemu-ifup.sample new file mode 100644 index 000000000000..89d9a9bff436 --- /dev/null +++ b/emulators/qemu40/files/qemu-ifup.sample @@ -0,0 +1,2 @@ +#!/bin/sh +exec true diff --git a/emulators/qemu40/pkg-descr b/emulators/qemu40/pkg-descr new file mode 100644 index 000000000000..018952f53cf1 --- /dev/null +++ b/emulators/qemu40/pkg-descr @@ -0,0 +1,19 @@ +QEMU is a FAST! processor emulator using dynamic translation to achieve +good emulation speed. +QEMU has two operating modes: + + * Full system emulation. In this mode, QEMU emulates a full system +(for example a PC), including a processor and various peripherials. +It can be used to launch different Operating Systems without rebooting +the PC or to debug system code. + * User mode emulation (Linux host only). In this mode, QEMU can launch +Linux processes compiled for one CPU on another CPU. It can be used to +launch the Wine Windows API emulator or to ease cross-compilation and +cross-debugging. + +As QEMU requires no host kernel patches to run, it is very safe and easy to use. + +See also the preconfigured system images on http://oszoo.org/ +Many live cd isos also work. + +WWW: http://wiki.qemu.org/Main_Page diff --git a/emulators/qemu40/pkg-message b/emulators/qemu40/pkg-message new file mode 100644 index 000000000000..4ce5e9a61853 --- /dev/null +++ b/emulators/qemu40/pkg-message @@ -0,0 +1,188 @@ +[ +{ type: install + message: <<EOM +FreeBSD host notes +================== + +- Needs to set net.link.tap.user_open sysctl in order to use /dev/tap* + networking as non-root. Don't forget to adjust device node permissions in + /etc/devfs.rules. + +- slirp (usermode networking) is fixed now in cvs, on FreeSBIE 1.0 guests you + still have to manually do: echo nameserver 10.0.2.3 >/etc/resolv.conf but + i've been told that that's normal. (fixed on FreeSBIE 1.1.) And you have + to wait a bit for dhclient to do its thing; traffic to address 10.0.2.2 is + routed to 127.1 on the host. + +- Expect timer problems when guest kernel HZ is > hosts, for example time + sleep 1 takes 49 seconds and booting sleeps for minutes at the acd0 probe + with a FreeSBIE 1.0 guest, thats because its kernel is built with HZ=5000, + and FreeBSD's default is 100... (no longer a problem with FreeSBIE 1.1.) + The linux 2.6 kernel uses 1000 by default btw. (changed to 250 later, and + recent linux kernels now no longer have a fixed HZ, aka `tickless + kernel'...) Enabling /dev/rtc doesn't seem to help either (not included + since it needs a patch to emulators/rtc.) + +- Update: the above problem has gotten worse with FreeBSD guests + somewhere before 8.0, mainly since the kernel now usually wants + double or even quadruple number of timer irqs compared to HZ if + it detects an apic (and at least early versions of FreeBSD 8 had + a bug that essentially halved qemu's clock rate too); the only + reason you usually don't see symptoms of this with FreeBSD 8 + guests is they automatically reduce their HZ to 100 when running + in a VM while the default for the host kernel is still HZ=1000. + Workaround: you can disable the apic clock in the guest by setting + + hint.apic.0.clock="0" + + in loader.conf(5) (or manually at the loader prompt), if that + doesn't work the only things you can do is either reduce the + guest's HZ to, say, 100 by setting e.g. + + kern.hz="100" + + from the loader as above (which usually is a good idea in a VM + anyway and FreeBSD 8 now does by itself as mentioned), or otherwise + increase the host's HZ to 2000 or even 4000 from the loader in + the same way. + +- The -smb option (smb-export local dir to guest using the default + slirp networking) needs the samba port/package installed + in addition to qemu. (SAMBA knob.) + +- If you want to use usb devices connected to the host in the guest + yot need either recent 10-current (not tested yet much) or you can + use usbredir over the network (see below); also unless you are + running qemu as root you then need to fix permissions for /dev/ugen* + device nodes: if you are on 5.x or later (devfs) put a rule in + /etc/devfs.rules, activate it in /etc/rc.conf and run /etc/rc.d/devfs + restart. Example devfs.rules: + + [ugen_ruleset=20] + add path 'ugen*' mode 660 group operator + + corresponding rc.conf line: + + devfs_system_ruleset="ugen_ruleset" + +- If you want to test the new (in 0.15.0) usb network redirection (USBREDIR + option) see this thread by Hans de Goede <hdegoede <at> redhat.com>: + + http://thread.gmane.org/gmane.comp.emulators.qemu/110176/focus=110183 + + Quote: + + Example usage: + + 1) Start usbredirserver for a usb device: + sudo usbredirserver 045e:0772 + 2) Start qemu with usb2 support + a chardev talking to usbredirserver + + a usb-redir device using this chardev: + qemu -usb \ + -readconfig docs/ich9-ehci-uhci.cfg \ + -chardev socket,id=usbredirchardev,host=localhost,port=4000 \ + -device usb-redir,chardev=usbredirchardev,id=usbredirdev ... + + [you would replace docs/ich9-ehci-uhci.cfg with e.g. + /usr/local/share/doc/qemu/docs/ich9-ehci-uhci.cfg, but turns out + ehci was broken for me here with FreeBSD guests and the previous + qemu version at least, I got: + + FETCHENTRY: entry at 22C5484 is of type 2 which is not supported yet +processing error - resetting ehci HC + Assertion failed: (0), function ehci_advance_state, file /data/ports/emulators/qemu-devel/work/qemu-0.15.0/hw/usb-ehci.c, line 2045. + + The new qemu version works better tho.] + +- Still usb: since the hub is no longer attached to the uchi controller and + the wakeup mechanism, resume interrupt is not implemented yet linux guests + will suspend the bus, i.e. they wont see devices usb_add'ed after its + (linux') uhci module got loaded. Workaround: either add devices before + linux loads the module or rmmod and modprobe it afterwards. [Not sure + if this still applies to the new libusb host code used on recent + 10-current.] + +- If you get repeated `atapi_poll called!' console messages with FreeBSD + guests or other weird cdrom problems then thats probably because the guest + has atapicam loaded, which for reasons still to be determined has problems + with qemu's now by default enabled cdrom dma. You can build the port with + CDROM_DMA disabled to disable it. [Looks like this is fixed in recent + FreeBSD guest versions.] + +- If you build qemu wihout SDL and then get crashes running it try passing it + -nographic. This should probably be default in that case... + +- qemu's network boot roms (-boot n) have a bug when bootfiles sizes are a + multiple of blksize, if this affects you (like with FreeBSD's /boot/pxeboot) + you can do like + + cp /boot/pxeboot pxeboot-qemu && chmod +w pxeboot-qemu && echo >>pxeboot-qemu + + and then use pxeboot-qemu. Actually you need recent btx code + (from after 7.0 was released) because of the real mode boot + problem, so use at least pxeboot from there. And I just did that + for the pxeboot extracted out of + + ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/200805/7.0-STABLE-200805-i386-bootonly.iso + + and placed it here: + + http://people.freebsd.org/~nox/qemu/pxeboot-qemu + +- If you use slirp (usernet, the default) and want to mount nfs into the guest + and you are not running qemu as root, then mountd(8) on the exporting box + needs to be run with -n in order to accept requests from ports >= 1024. + +- (not FreeBSD-specific:) There have been reports of qcow2 corruption with (at + least) win2k guests on recent kvm (which uses similar qcow2 code than qemu + now, see this thread: + + http://lists.gnu.org/archive/html/qemu-devel/2009-02/msg00713.html - + + the consensus on that thread seems to be that qcow(2) code has always been + experimental and you should use raw images if you want reliability; raw is + also usually faster.) You should be able to migrate existing images to raw + using qemu-img(1)'s convert function; raw doesn't support advanced features + like snapshots tho. [a few important qcow2 bugfixed have been committed in + the meantime so this _might_ be less of an issue now; and meanwhile there + also is the new qed format - I don't know how stable that one is.] + +- (also not FreeBSD-specific:) It is recommended to pass raw images using the + new -drive syntax, specifying format=raw explicitly in order to avoid + malicious guests being able to exploit the format autodetection thats + otherwise getting used. (Not that you should run malicious guests anyway, + but this eleminates at least a known attack vector.) + +- qemu now has improved physical cdrom support, but still there is at + least one known problem: you need to have the guest eject the disc if you + want to change it/take it out, or otherwise the guest may continue using + state (like size) of the old disc. (You can also do like `change ide1-cd0 + /dev/acd0' in the monitor after taking out the disc if a guest cannot eject + it itself.) + +- The default configuration location (qemu-ifup script etc.) has been changed + from /etc to PREFIX/etc (usually /usr/local/etc). Move your files + accordingly. + +- The pcap code (-net nic... -net pcap,ifname=...) should work properly now, + with only one exception: Advanced features like TSO used on the host + interface can cause oversize packets which now do get truncated to avoid + confusing/panicing guests but of course still will cause retransmissions. + So if you see slow throughput and `pcap_send: packet size > ..., truncating' + messages on qemu's tty try disabling TSO etc on the host interface at least + while using pcap. + +- kqemu is no longer supported in qemu upstream after the 0.11 branch + was created, which means also not in this version. (Linux has moved + on to kvm now for qemu(-like) virtualization needs, so if you want qemu + to go faster and don't want to switch to virtualbox or stick to the older + emulators/qemu port which is at 0.11.1 atm and as such still supports + kqemu you should help getting the FreeBSD kvm port updated and + completed: + + http://wiki.freebsd.org/FabioChecconi/PortingLinuxKVMToFreeBSD + + ) +EOM +} +] diff --git a/emulators/qemu40/pkg-plist b/emulators/qemu40/pkg-plist new file mode 100644 index 000000000000..bf144fa1a856 --- /dev/null +++ b/emulators/qemu40/pkg-plist @@ -0,0 +1,155 @@ +bin/elf2dmp +bin/qemu-edid +bin/qemu-ga +bin/qemu-i386 +bin/qemu-img +bin/qemu-io +%%GTK3%%bin/qemu-keymap +bin/qemu-nbd +%%NO_X86_TARGETS%%bin/qemu-sparc +%%NO_X86_TARGETS%%bin/qemu-sparc64 +%%NO_X86_TARGETS%%bin/qemu-system-aarch64 +%%NO_X86_TARGETS%%bin/qemu-system-alpha +%%NO_X86_TARGETS%%bin/qemu-system-arm +%%NO_X86_TARGETS%%bin/qemu-system-cris +%%NO_X86_TARGETS%%bin/qemu-system-hppa +bin/qemu-system-i386 +%%NO_X86_TARGETS%%bin/qemu-system-lm32 +%%NO_X86_TARGETS%%bin/qemu-system-m68k +%%NO_X86_TARGETS%%bin/qemu-system-microblaze +%%NO_X86_TARGETS%%bin/qemu-system-microblazeel +%%NO_X86_TARGETS%%bin/qemu-system-mips +%%NO_X86_TARGETS%%bin/qemu-system-mips64 +%%NO_X86_TARGETS%%bin/qemu-system-mips64el +%%NO_X86_TARGETS%%bin/qemu-system-mipsel +%%NO_X86_TARGETS%%bin/qemu-system-moxie +%%NO_X86_TARGETS%%bin/qemu-system-nios2 +%%NO_X86_TARGETS%%bin/qemu-system-or1k +%%NO_X86_TARGETS%%bin/qemu-system-ppc +%%NO_X86_TARGETS%%bin/qemu-system-ppc64 +%%NO_X86_TARGETS%%bin/qemu-system-riscv32 +%%NO_X86_TARGETS%%bin/qemu-system-riscv64 +%%NO_X86_TARGETS%%bin/qemu-system-s390x +%%NO_X86_TARGETS%%bin/qemu-system-sh4 +%%NO_X86_TARGETS%%bin/qemu-system-sh4eb +%%NO_X86_TARGETS%%bin/qemu-system-sparc +%%NO_X86_TARGETS%%bin/qemu-system-sparc64 +%%NO_X86_TARGETS%%bin/qemu-system-tricore +%%NO_X86_TARGETS%%bin/qemu-system-unicore32 +bin/qemu-system-x86_64 +%%NO_X86_TARGETS%%bin/qemu-system-xtensa +%%NO_X86_TARGETS%%bin/qemu-system-xtensaeb +bin/qemu-x86_64 +man/man1/qemu.1.gz +man/man1/qemu-img.1.gz +man/man7/qemu-block-drivers.7.gz +man/man7/qemu-cpu-models.7.gz +man/man7/qemu-ga-ref.7.gz +man/man7/qemu-qmp-ref.7.gz +man/man8/qemu-ga.8.gz +man/man8/qemu-nbd.8.gz +@sample etc/qemu-ifup.sample +@sample etc/qemu-ifdown.sample +%%DATADIR%%/QEMU,tcx.bin +%%DATADIR%%/QEMU,cgthree.bin +%%DATADIR%%/bios-256k.bin +%%DATADIR%%/bios.bin +%%DATADIR%%/canyonlands.dtb +%%DATADIR%%/efi-e1000.rom +%%DATADIR%%/efi-e1000e.rom +%%DATADIR%%/efi-eepro100.rom +%%DATADIR%%/efi-ne2k_pci.rom +%%DATADIR%%/efi-pcnet.rom +%%DATADIR%%/efi-rtl8139.rom +%%DATADIR%%/efi-virtio.rom +%%DATADIR%%/efi-vmxnet3.rom +%%DATADIR%%/hppa-firmware.img +%%DATADIR%%/qemu_vga.ndrv +%%DATADIR%%/s390-netboot.img +%%DATADIR%%/u-boot-sam460-20100605.bin +%%DATADIR%%/vgabios.bin +%%DATADIR%%/vgabios-cirrus.bin +%%DATADIR%%/vgabios-qxl.bin +%%DATADIR%%/vgabios-stdvga.bin +%%DATADIR%%/vgabios-virtio.bin +%%DATADIR%%/vgabios-vmware.bin +%%DATADIR%%/palcode-clipper +%%DATADIR%%/ppc_rom.bin +%%DATADIR%%/openbios-ppc +%%DATADIR%%/openbios-sparc32 +%%DATADIR%%/openbios-sparc64 +%%DATADIR%%/pxe-e1000.rom +%%DATADIR%%/pxe-eepro100.rom +%%DATADIR%%/pxe-ne2k_pci.rom +%%DATADIR%%/pxe-rtl8139.rom +%%DATADIR%%/pxe-pcnet.rom +%%DATADIR%%/pxe-virtio.rom +%%DATADIR%%/petalogix-ml605.dtb +%%DATADIR%%/spapr-rtas.bin +%%DATADIR%%/slof.bin +%%DATADIR%%/s390-ccw.img +%%DATADIR%%/linuxboot.bin +%%LINUXBOOT_DMA%%%%DATADIR%%/linuxboot_dma.bin +%%DATADIR%%/multiboot.bin +%%DATADIR%%/sgabios.bin +%%DATADIR%%/skiboot.lid +%%DATADIR%%/trace-events-all +%%DATADIR%%/petalogix-s3adsp1800.dtb +%%DATADIR%%/bamboo.dtb +%%DATADIR%%/kvmvapic.bin +%%DATADIR%%/u-boot.e500 +%%DATADIR%%/keymaps/ar +%%DATADIR%%/keymaps/bepo +%%DATADIR%%/keymaps/cz +%%DATADIR%%/keymaps/da +%%DATADIR%%/keymaps/de +%%DATADIR%%/keymaps/de-ch +%%DATADIR%%/keymaps/en-gb +%%DATADIR%%/keymaps/en-us +%%DATADIR%%/keymaps/es +%%DATADIR%%/keymaps/et +%%DATADIR%%/keymaps/fi +%%DATADIR%%/keymaps/fo +%%DATADIR%%/keymaps/fr +%%DATADIR%%/keymaps/fr-be +%%DATADIR%%/keymaps/fr-ca +%%DATADIR%%/keymaps/fr-ch +%%DATADIR%%/keymaps/hr +%%DATADIR%%/keymaps/hu +%%DATADIR%%/keymaps/is +%%DATADIR%%/keymaps/it +%%DATADIR%%/keymaps/ja +%%DATADIR%%/keymaps/lt +%%DATADIR%%/keymaps/lv +%%DATADIR%%/keymaps/mk +%%DATADIR%%/keymaps/nl +%%DATADIR%%/keymaps/no +%%DATADIR%%/keymaps/pl +%%DATADIR%%/keymaps/pt +%%DATADIR%%/keymaps/pt-br +%%DATADIR%%/keymaps/ru +%%DATADIR%%/keymaps/sl +%%DATADIR%%/keymaps/sv +%%DATADIR%%/keymaps/th +%%DATADIR%%/keymaps/tr +%%DATADIR%%/pvh.bin +%%DATADIR%%/vgabios-bochs-display.bin +%%DATADIR%%/vgabios-ramfb.bin +share/icons/hicolor/128x128/apps/qemu.png +share/icons/hicolor/16x16/apps/qemu.png +share/icons/hicolor/24x24/apps/qemu.png +share/icons/hicolor/256x256/apps/qemu.png +share/icons/hicolor/32x32/apps/qemu.bmp +share/icons/hicolor/32x32/apps/qemu.png +share/icons/hicolor/48x48/apps/qemu.png +share/icons/hicolor/512x512/apps/qemu.png +share/icons/hicolor/64x64/apps/qemu.png +share/icons/hicolor/scalable/apps/qemu.svg +share/applications/qemu.desktop +%%GTK3%%share/locale/bg/LC_MESSAGES/qemu.mo +%%GTK3%%share/locale/de_DE/LC_MESSAGES/qemu.mo +%%GTK3%%share/locale/fr_FR/LC_MESSAGES/qemu.mo +%%GTK3%%share/locale/hu/LC_MESSAGES/qemu.mo +%%GTK3%%share/locale/it/LC_MESSAGES/qemu.mo +%%GTK3%%share/locale/tr/LC_MESSAGES/qemu.mo +%%GTK3%%share/locale/zh_CN/LC_MESSAGES/qemu.mo |