aboutsummaryrefslogtreecommitdiffstats
path: root/emulators
diff options
context:
space:
mode:
authorpav <pav@FreeBSD.org>2006-11-01 06:55:34 +0800
committerpav <pav@FreeBSD.org>2006-11-01 06:55:34 +0800
commitc1da3d7d3533dafb95e6782f7ff572528e9f1a55 (patch)
tree31107c6454b266450aa13b3441daab428ee4f731 /emulators
parent828d6ec40e50069f5e3b9aa2f363692fac4b4ef3 (diff)
downloadfreebsd-ports-gnome-c1da3d7d3533dafb95e6782f7ff572528e9f1a55.tar.gz
freebsd-ports-gnome-c1da3d7d3533dafb95e6782f7ff572528e9f1a55.tar.zst
freebsd-ports-gnome-c1da3d7d3533dafb95e6782f7ff572528e9f1a55.zip
- update to 20061031 cvs snapshot (now uses aio and supports acpi and a new
qcow2 image format) - properly respect NOPORTDOCS - make -serial /dev/cuadX work (modified patch from this post: http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00201.html , and hi Michael! :) - add WITHOUT_SDL (hi joshe! :) and WITHOUT_CDROM_DMA knobs (the latter to work around atapicam problems in FreeBSD guests with the now by default enabled ide cdrom dma patch) - use OPTIONS PR: ports/104989 Submitted by: Juergen Lock <nox@jelal.kn-bremen.de> (maintainer)
Diffstat (limited to 'emulators')
-rw-r--r--emulators/qemu-devel/Makefile83
-rw-r--r--emulators/qemu-devel/distinfo6
-rw-r--r--emulators/qemu-devel/files/cdrom-dma-patch10
-rw-r--r--emulators/qemu-devel/files/patch-Makefile11
-rw-r--r--emulators/qemu-devel/files/patch-vl.c-serial17
-rw-r--r--emulators/qemu-devel/files/patch-vl.h12
-rw-r--r--emulators/qemu-devel/pkg-message11
-rw-r--r--emulators/qemu-devel/pkg-plist2
-rw-r--r--emulators/qemu/Makefile83
-rw-r--r--emulators/qemu/distinfo6
-rw-r--r--emulators/qemu/files/cdrom-dma-patch10
-rw-r--r--emulators/qemu/files/patch-Makefile11
-rw-r--r--emulators/qemu/files/patch-vl.c-serial17
-rw-r--r--emulators/qemu/files/patch-vl.h12
-rw-r--r--emulators/qemu/pkg-message11
-rw-r--r--emulators/qemu/pkg-plist2
16 files changed, 206 insertions, 98 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile
index 8b7463b59818..6d2896b44ffb 100644
--- a/emulators/qemu-devel/Makefile
+++ b/emulators/qemu-devel/Makefile
@@ -6,83 +6,75 @@
#
PORTNAME= qemu
-PORTVERSION= 0.8.2
-PORTREVISION= 2
+PORTVERSION= 0.8.2s.20061031
CATEGORIES= emulators
MASTER_SITES= http://www.qemu.org/:release \
+ http://qemu-forum.ipi.fi/qemu-snapshots/:snapshot \
http://people.fruitsalad.org/nox/qemu/:snapshot \
http://www.volny.cz/xnavara/qemu/:snapshot \
- http://qemu.dad-answers.com/download/qemu/:snapshot \
http://people.brandeis.edu/~jcoiner/qemu_idedma/:idedma \
http://people.freebsd.org/~maho/qemu/:misc
-DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:release
-.if defined (WITH_HACKS_CIRRUS) || defined (WITH_HACKS)
-DISTFILES+= patch3_cirrus:misc
-.endif
+DISTNAME= ${PORTNAME}-snapshot-2006-10-31_05
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:snapshot
DIST_SUBDIR= qemu
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= nox@jelal.kn-bremen.de
COMMENT= QEMU CPU Emulator
-BUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html
-.if defined(WITH_SAMBA)
-RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3
-.endif
-.if defined(WITH_KQEMU)
-BUILD_DEPENDS+= kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod
-.endif
-
HAS_CONFIGURE= yes
+USE_BZIP2= yes
USE_GMAKE= yes
USE_GETOPT_LONG= yes
-USE_SDL= sdl
USE_PERL5= yes
+USE_GCC= 3.4
PATCH_STRIP= -p1
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}
MAKE_ENV+= BSD_MAKE="${MAKE}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
MAN1= qemu.1 qemu-img.1
ONLY_FOR_ARCHS= amd64 i386
+
+OPTIONS= KQEMU "Build with (alpha!) accelerator module" Off \
+ HACKS_CIRRUS "Large display speedup (buggy!)" Off \
+ RTL8139_TIMER "allow use of re(4) nic with FreeBSD guests" Off \
+ SAMBA "samba dependency (for -smb)" Off \
+ SDL "SDL/X dependency (graphical output)" On \
+ CDROM_DMA "IDE CDROM DMA" On
+
+.include <bsd.port.pre.mk>
+
WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation
+.if defined(WITHOUT_SDL)
+CONFIGURE_ARGS+= --disable-sdl --disable-gfx-check
+.else
+USE_SDL= sdl
+.endif
+
+.if defined (WITH_HACKS_CIRRUS) || defined (WITH_HACKS)
+DISTFILES+= patch3_cirrus:misc
+.endif
+
+.if defined(WITH_SAMBA)
+RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3
+.endif
+
.if defined(WITH_KQEMU)
+BUILD_DEPENDS+= kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod
CONFIGURE_ARGS+= --enable-kqemu
.else
CONFIGURE_ARGS+= --disable-kqemu
.endif
-.include <bsd.port.pre.mk>
+.if defined(NOPORTDOCS)
+MAKE_ARGS+= NOPORTDOCS=${NOPORTDOCS}
+.else
+BUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html
+.endif
.if ${ARCH} == "amd64"
MAKE_ARGS+= ARCH=x86_64
.endif
-USE_GCC= 3.4
-
-pre-everything::
-.if !defined(WITH_KQEMU)
- @${ECHO_MSG} "Notice: you can build qemu with the (alpha!) kqemu accelerator kernel module"
- @${ECHO_MSG} "by defining WITH_KQEMU."
-.endif
-.if !defined(WITH_HACKS_CIRRUS) && !defined(WITH_HACKS)
- @${ECHO_MSG} "You can build qemu with some hacks (esp. for speedup)"
- @${ECHO_MSG} "by defining WITH_HACKS, or specifically:"
- @${ECHO_MSG} "2. WITH_HACKS_CIRRUS: higher speed on large display (cirrus_vga)"
- @${ECHO_MSG} "by Juergen Pfennig"
- @${ECHO_MSG} "http://lists.gnu.org/archive/html/qemu-devel/2006-01/msg00208.html"
- @${ECHO_MSG} "Note: this second patch is known to cause mouse problems with some(?)"
- @${ECHO_MSG} "versions of XP, and also minor redraw bugs with some Linux guests."
-.endif
-.if !defined(WITH_SAMBA) && !exists(${LOCALBASE}/sbin/smbd)
- @${ECHO_MSG} "Notice: if you need qemu's -smb option (smb-export local dir to guest)"
- @${ECHO_MSG} "then you also need samba, you can have this port install it by defining"
- @${ECHO_MSG} "WITH_SAMBA."
-.endif
-.if !defined(WITH_RTL8139_TIMER)
- @${ECHO_MSG} "Notice: if you want to use qemu's rtl8139c+ nic with a FreeBSD guest"
- @${ECHO_MSG} "(qemu -net nic,model=rtl8139 -net user or tap ... - will use re(4)"
- @${ECHO_MSG} "instead of ed(4) which should use less cpu), then you need to enable"
- @${ECHO_MSG} "the emulated rtl8139 timer by defining WITH_RTL8139_TIMER."
-.endif
post-extract:
@${MKDIR} ${WRKSRC}/kqemu
@@ -101,6 +93,9 @@ post-patch:
.if defined(WITH_RTL8139_TIMER)
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch
.endif
+.if !defined(WITHOUT_CDROM_DMA)
+ @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch
+.endif
@${REINPLACE_CMD} -E \
-e "s,^(CFLAGS=).*,\1${CFLAGS} -fno-strict-aliasing," \
-e "s,^(LDFLAGS=).*,\1${LDFLAGS}," \
diff --git a/emulators/qemu-devel/distinfo b/emulators/qemu-devel/distinfo
index cf37ebf544fb..817e21e74303 100644
--- a/emulators/qemu-devel/distinfo
+++ b/emulators/qemu-devel/distinfo
@@ -1,6 +1,6 @@
-MD5 (qemu/qemu-0.8.2.tar.gz) = 5b3a89eb2f256a8a6f3bb07f7b3f1b07
-SHA256 (qemu/qemu-0.8.2.tar.gz) = 2a20d811296c859d678bdd002222aa7ca7951a641327234f3af144e822d078f3
-SIZE (qemu/qemu-0.8.2.tar.gz) = 1810909
+MD5 (qemu/qemu-snapshot-2006-10-31_05.tar.bz2) = ff3943d14548b6e1b99ad3a052af5df6
+SHA256 (qemu/qemu-snapshot-2006-10-31_05.tar.bz2) = af189f92043e7280589021e2ddabe3758f413ada6db674504b67358f153bf766
+SIZE (qemu/qemu-snapshot-2006-10-31_05.tar.bz2) = 1493895
MD5 (qemu/patch3_cirrus) = ebe7ed9fce804c49e024bc93bfdfc810
SHA256 (qemu/patch3_cirrus) = e862371834b7d895a896fbdb84fd9f70d17b5729a6f6789a48a61504fc941e11
SIZE (qemu/patch3_cirrus) = 8817
diff --git a/emulators/qemu-devel/files/cdrom-dma-patch b/emulators/qemu-devel/files/cdrom-dma-patch
new file mode 100644
index 000000000000..7b6bed2e6adc
--- /dev/null
+++ b/emulators/qemu-devel/files/cdrom-dma-patch
@@ -0,0 +1,10 @@
+Index: hw/ide.c
+@@ -27,7 +27,7 @@
+ //#define DEBUG_IDE
+ //#define DEBUG_IDE_ATAPI
+ //#define DEBUG_AIO
+-#define USE_DMA_CDROM
++// #define USE_DMA_CDROM
+
+ /* Bits of HD_STATUS */
+ #define ERR_STAT 0x01
diff --git a/emulators/qemu-devel/files/patch-Makefile b/emulators/qemu-devel/files/patch-Makefile
new file mode 100644
index 000000000000..1dfcc6d21caf
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-Makefile
@@ -0,0 +1,11 @@
+Index: qemu/Makefile
+@@ -28,7 +28,8 @@
+ ifndef CONFIG_DARWIN
+ ifndef CONFIG_WIN32
+ ifndef CONFIG_SOLARIS
+-LIBS+=-lrt
++# XXX need ifndef CONFIG_BSD
++# LIBS+=-lrt
+ endif
+ endif
+ endif
diff --git a/emulators/qemu-devel/files/patch-vl.c-serial b/emulators/qemu-devel/files/patch-vl.c-serial
new file mode 100644
index 000000000000..76c290e28abb
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-vl.c-serial
@@ -0,0 +1,17 @@
+Index: qemu/vl.c
+@@ -1606,10 +1606,13 @@
+ cfsetospeed(&tty, spd);
+
+ tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
+- |INLCR|IGNCR|ICRNL|IXON);
+- tty.c_oflag |= OPOST;
++ |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
++ tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
+ tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
+ tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
++#ifdef __FreeBSD__
++ cfmakeraw(&tty);
++#endif
+ switch(data_bits) {
+ default:
+ case 8:
diff --git a/emulators/qemu-devel/files/patch-vl.h b/emulators/qemu-devel/files/patch-vl.h
new file mode 100644
index 000000000000..8307eee09785
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-vl.h
@@ -0,0 +1,12 @@
+Index: qemu/vl.h
+@@ -73,6 +73,10 @@
+ #define PRIo64 "I64o"
+ #endif
+
++#ifndef ENOMEDIUM
++#define ENOMEDIUM 4097
++#endif
++
+ #ifdef QEMU_TOOL
+
+ /* we use QEMU_TOOL in the command line tools which do not depend on
diff --git a/emulators/qemu-devel/pkg-message b/emulators/qemu-devel/pkg-message
index d4fdc4e7dfcc..bb5c6281bc04 100644
--- a/emulators/qemu-devel/pkg-message
+++ b/emulators/qemu-devel/pkg-message
@@ -52,8 +52,17 @@ its (linux') uhci module got loaded. workaround: either add devices
before linux loads the module or rmmod and modprobe it afterwards.
- to avoid panics or non-working re(4) nics with FreeBSD guests if you
use qemu -net nic,model=rtl8139 -net user or tap ... enable the emulated
-rtl8139 timer by building the port with WITH_RTL8139_TIMER defined.
+rtl8139 timer by building the port with RTL8139_TIMER enabled.
(the rtl8139c+ that model=rtl8139 emulates needs less cpu than qemu's
default ne2k nic which is driven by ed(4), it has not been made default
only because it may not work with all guests yet.)
+- qemu now uses aio at least for ide dma, so if you get `Bad system call'
+crashes that is because aio is not (kld)loaded.
+- 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.
+- if you build qemu wihout SDL and then get crashes running it try passing
+it -nographic. This should probably be default in that case...
====
diff --git a/emulators/qemu-devel/pkg-plist b/emulators/qemu-devel/pkg-plist
index 403d8987adbe..a9055c122e19 100644
--- a/emulators/qemu-devel/pkg-plist
+++ b/emulators/qemu-devel/pkg-plist
@@ -8,6 +8,7 @@ bin/qemu-system-sparc
bin/qemu-system-x86_64
%%PORTDOCS%%%%DOCSDIR%%/qemu-doc.html
%%PORTDOCS%%%%DOCSDIR%%/qemu-tech.html
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
%%DATADIR%%/bios.bin
%%DATADIR%%/linux_boot.bin
%%DATADIR%%/vgabios.bin
@@ -52,4 +53,3 @@ bin/qemu-system-x86_64
%%DATADIR%%/keymaps/tr
@dirrm %%DATADIR%%/keymaps
@dirrm %%DATADIR%%
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile
index 8b7463b59818..6d2896b44ffb 100644
--- a/emulators/qemu/Makefile
+++ b/emulators/qemu/Makefile
@@ -6,83 +6,75 @@
#
PORTNAME= qemu
-PORTVERSION= 0.8.2
-PORTREVISION= 2
+PORTVERSION= 0.8.2s.20061031
CATEGORIES= emulators
MASTER_SITES= http://www.qemu.org/:release \
+ http://qemu-forum.ipi.fi/qemu-snapshots/:snapshot \
http://people.fruitsalad.org/nox/qemu/:snapshot \
http://www.volny.cz/xnavara/qemu/:snapshot \
- http://qemu.dad-answers.com/download/qemu/:snapshot \
http://people.brandeis.edu/~jcoiner/qemu_idedma/:idedma \
http://people.freebsd.org/~maho/qemu/:misc
-DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:release
-.if defined (WITH_HACKS_CIRRUS) || defined (WITH_HACKS)
-DISTFILES+= patch3_cirrus:misc
-.endif
+DISTNAME= ${PORTNAME}-snapshot-2006-10-31_05
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:snapshot
DIST_SUBDIR= qemu
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= nox@jelal.kn-bremen.de
COMMENT= QEMU CPU Emulator
-BUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html
-.if defined(WITH_SAMBA)
-RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3
-.endif
-.if defined(WITH_KQEMU)
-BUILD_DEPENDS+= kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod
-.endif
-
HAS_CONFIGURE= yes
+USE_BZIP2= yes
USE_GMAKE= yes
USE_GETOPT_LONG= yes
-USE_SDL= sdl
USE_PERL5= yes
+USE_GCC= 3.4
PATCH_STRIP= -p1
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}
MAKE_ENV+= BSD_MAKE="${MAKE}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
MAN1= qemu.1 qemu-img.1
ONLY_FOR_ARCHS= amd64 i386
+
+OPTIONS= KQEMU "Build with (alpha!) accelerator module" Off \
+ HACKS_CIRRUS "Large display speedup (buggy!)" Off \
+ RTL8139_TIMER "allow use of re(4) nic with FreeBSD guests" Off \
+ SAMBA "samba dependency (for -smb)" Off \
+ SDL "SDL/X dependency (graphical output)" On \
+ CDROM_DMA "IDE CDROM DMA" On
+
+.include <bsd.port.pre.mk>
+
WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation
+.if defined(WITHOUT_SDL)
+CONFIGURE_ARGS+= --disable-sdl --disable-gfx-check
+.else
+USE_SDL= sdl
+.endif
+
+.if defined (WITH_HACKS_CIRRUS) || defined (WITH_HACKS)
+DISTFILES+= patch3_cirrus:misc
+.endif
+
+.if defined(WITH_SAMBA)
+RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3
+.endif
+
.if defined(WITH_KQEMU)
+BUILD_DEPENDS+= kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod
CONFIGURE_ARGS+= --enable-kqemu
.else
CONFIGURE_ARGS+= --disable-kqemu
.endif
-.include <bsd.port.pre.mk>
+.if defined(NOPORTDOCS)
+MAKE_ARGS+= NOPORTDOCS=${NOPORTDOCS}
+.else
+BUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html
+.endif
.if ${ARCH} == "amd64"
MAKE_ARGS+= ARCH=x86_64
.endif
-USE_GCC= 3.4
-
-pre-everything::
-.if !defined(WITH_KQEMU)
- @${ECHO_MSG} "Notice: you can build qemu with the (alpha!) kqemu accelerator kernel module"
- @${ECHO_MSG} "by defining WITH_KQEMU."
-.endif
-.if !defined(WITH_HACKS_CIRRUS) && !defined(WITH_HACKS)
- @${ECHO_MSG} "You can build qemu with some hacks (esp. for speedup)"
- @${ECHO_MSG} "by defining WITH_HACKS, or specifically:"
- @${ECHO_MSG} "2. WITH_HACKS_CIRRUS: higher speed on large display (cirrus_vga)"
- @${ECHO_MSG} "by Juergen Pfennig"
- @${ECHO_MSG} "http://lists.gnu.org/archive/html/qemu-devel/2006-01/msg00208.html"
- @${ECHO_MSG} "Note: this second patch is known to cause mouse problems with some(?)"
- @${ECHO_MSG} "versions of XP, and also minor redraw bugs with some Linux guests."
-.endif
-.if !defined(WITH_SAMBA) && !exists(${LOCALBASE}/sbin/smbd)
- @${ECHO_MSG} "Notice: if you need qemu's -smb option (smb-export local dir to guest)"
- @${ECHO_MSG} "then you also need samba, you can have this port install it by defining"
- @${ECHO_MSG} "WITH_SAMBA."
-.endif
-.if !defined(WITH_RTL8139_TIMER)
- @${ECHO_MSG} "Notice: if you want to use qemu's rtl8139c+ nic with a FreeBSD guest"
- @${ECHO_MSG} "(qemu -net nic,model=rtl8139 -net user or tap ... - will use re(4)"
- @${ECHO_MSG} "instead of ed(4) which should use less cpu), then you need to enable"
- @${ECHO_MSG} "the emulated rtl8139 timer by defining WITH_RTL8139_TIMER."
-.endif
post-extract:
@${MKDIR} ${WRKSRC}/kqemu
@@ -101,6 +93,9 @@ post-patch:
.if defined(WITH_RTL8139_TIMER)
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch
.endif
+.if !defined(WITHOUT_CDROM_DMA)
+ @cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch
+.endif
@${REINPLACE_CMD} -E \
-e "s,^(CFLAGS=).*,\1${CFLAGS} -fno-strict-aliasing," \
-e "s,^(LDFLAGS=).*,\1${LDFLAGS}," \
diff --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo
index cf37ebf544fb..817e21e74303 100644
--- a/emulators/qemu/distinfo
+++ b/emulators/qemu/distinfo
@@ -1,6 +1,6 @@
-MD5 (qemu/qemu-0.8.2.tar.gz) = 5b3a89eb2f256a8a6f3bb07f7b3f1b07
-SHA256 (qemu/qemu-0.8.2.tar.gz) = 2a20d811296c859d678bdd002222aa7ca7951a641327234f3af144e822d078f3
-SIZE (qemu/qemu-0.8.2.tar.gz) = 1810909
+MD5 (qemu/qemu-snapshot-2006-10-31_05.tar.bz2) = ff3943d14548b6e1b99ad3a052af5df6
+SHA256 (qemu/qemu-snapshot-2006-10-31_05.tar.bz2) = af189f92043e7280589021e2ddabe3758f413ada6db674504b67358f153bf766
+SIZE (qemu/qemu-snapshot-2006-10-31_05.tar.bz2) = 1493895
MD5 (qemu/patch3_cirrus) = ebe7ed9fce804c49e024bc93bfdfc810
SHA256 (qemu/patch3_cirrus) = e862371834b7d895a896fbdb84fd9f70d17b5729a6f6789a48a61504fc941e11
SIZE (qemu/patch3_cirrus) = 8817
diff --git a/emulators/qemu/files/cdrom-dma-patch b/emulators/qemu/files/cdrom-dma-patch
new file mode 100644
index 000000000000..7b6bed2e6adc
--- /dev/null
+++ b/emulators/qemu/files/cdrom-dma-patch
@@ -0,0 +1,10 @@
+Index: hw/ide.c
+@@ -27,7 +27,7 @@
+ //#define DEBUG_IDE
+ //#define DEBUG_IDE_ATAPI
+ //#define DEBUG_AIO
+-#define USE_DMA_CDROM
++// #define USE_DMA_CDROM
+
+ /* Bits of HD_STATUS */
+ #define ERR_STAT 0x01
diff --git a/emulators/qemu/files/patch-Makefile b/emulators/qemu/files/patch-Makefile
new file mode 100644
index 000000000000..1dfcc6d21caf
--- /dev/null
+++ b/emulators/qemu/files/patch-Makefile
@@ -0,0 +1,11 @@
+Index: qemu/Makefile
+@@ -28,7 +28,8 @@
+ ifndef CONFIG_DARWIN
+ ifndef CONFIG_WIN32
+ ifndef CONFIG_SOLARIS
+-LIBS+=-lrt
++# XXX need ifndef CONFIG_BSD
++# LIBS+=-lrt
+ endif
+ endif
+ endif
diff --git a/emulators/qemu/files/patch-vl.c-serial b/emulators/qemu/files/patch-vl.c-serial
new file mode 100644
index 000000000000..76c290e28abb
--- /dev/null
+++ b/emulators/qemu/files/patch-vl.c-serial
@@ -0,0 +1,17 @@
+Index: qemu/vl.c
+@@ -1606,10 +1606,13 @@
+ cfsetospeed(&tty, spd);
+
+ tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
+- |INLCR|IGNCR|ICRNL|IXON);
+- tty.c_oflag |= OPOST;
++ |INLCR|IGNCR|ICRNL|IXON|IMAXBEL);
++ tty.c_oflag &= ~OPOST; /* Don't do any output processing! */
+ tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN|ISIG);
+ tty.c_cflag &= ~(CSIZE|PARENB|PARODD|CRTSCTS|CSTOPB);
++#ifdef __FreeBSD__
++ cfmakeraw(&tty);
++#endif
+ switch(data_bits) {
+ default:
+ case 8:
diff --git a/emulators/qemu/files/patch-vl.h b/emulators/qemu/files/patch-vl.h
new file mode 100644
index 000000000000..8307eee09785
--- /dev/null
+++ b/emulators/qemu/files/patch-vl.h
@@ -0,0 +1,12 @@
+Index: qemu/vl.h
+@@ -73,6 +73,10 @@
+ #define PRIo64 "I64o"
+ #endif
+
++#ifndef ENOMEDIUM
++#define ENOMEDIUM 4097
++#endif
++
+ #ifdef QEMU_TOOL
+
+ /* we use QEMU_TOOL in the command line tools which do not depend on
diff --git a/emulators/qemu/pkg-message b/emulators/qemu/pkg-message
index d4fdc4e7dfcc..bb5c6281bc04 100644
--- a/emulators/qemu/pkg-message
+++ b/emulators/qemu/pkg-message
@@ -52,8 +52,17 @@ its (linux') uhci module got loaded. workaround: either add devices
before linux loads the module or rmmod and modprobe it afterwards.
- to avoid panics or non-working re(4) nics with FreeBSD guests if you
use qemu -net nic,model=rtl8139 -net user or tap ... enable the emulated
-rtl8139 timer by building the port with WITH_RTL8139_TIMER defined.
+rtl8139 timer by building the port with RTL8139_TIMER enabled.
(the rtl8139c+ that model=rtl8139 emulates needs less cpu than qemu's
default ne2k nic which is driven by ed(4), it has not been made default
only because it may not work with all guests yet.)
+- qemu now uses aio at least for ide dma, so if you get `Bad system call'
+crashes that is because aio is not (kld)loaded.
+- 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.
+- if you build qemu wihout SDL and then get crashes running it try passing
+it -nographic. This should probably be default in that case...
====
diff --git a/emulators/qemu/pkg-plist b/emulators/qemu/pkg-plist
index 403d8987adbe..a9055c122e19 100644
--- a/emulators/qemu/pkg-plist
+++ b/emulators/qemu/pkg-plist
@@ -8,6 +8,7 @@ bin/qemu-system-sparc
bin/qemu-system-x86_64
%%PORTDOCS%%%%DOCSDIR%%/qemu-doc.html
%%PORTDOCS%%%%DOCSDIR%%/qemu-tech.html
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
%%DATADIR%%/bios.bin
%%DATADIR%%/linux_boot.bin
%%DATADIR%%/vgabios.bin
@@ -52,4 +53,3 @@ bin/qemu-system-x86_64
%%DATADIR%%/keymaps/tr
@dirrm %%DATADIR%%/keymaps
@dirrm %%DATADIR%%
-%%PORTDOCS%%@dirrm %%DOCSDIR%%