summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjnemeth <jnemeth@pkgsrc.org>2013-05-15 06:58:50 +0000
committerjnemeth <jnemeth@pkgsrc.org>2013-05-15 06:58:50 +0000
commitf839698456ef146e020814d526900d1b20e6195d (patch)
treed0bcaeee59998a4a027eb9561cfff73dd1a09ce3
parent25ef9361e06ed3c446fc75bd71c904c70e1e2483 (diff)
downloadpkgsrc-f839698456ef146e020814d526900d1b20e6195d.tar.gz
Initial import of Xen 4.2: this is the tools part. This is mostly
functional for PV domains. Support for HVM domains and grant tables is still to come. Note that xm/xend is deprecated in this version. You should switch to using xl (which is tested to be working) if you can. ----- 4.2.2 Xen 4.2.2 is a maintenance release in the 4.2 series and contains: We recommend that all users of Xen 4.2.1 upgrade to Xen 4.2.2. This release fixes the following critical vulnerabilities: CVE-2012-5634 / XSA-33: VT-d interrupt remapping source validation flaw CVE-2013-0151 / XSA-34: nested virtualization on 32-bit exposes host crash CVE-2013-0152 / XSA-35: Nested HVM exposes host to being driven out of memory by guest CVE-2013-0153 / XSA-36: interrupt remap entries shared and old ones not cleared on AMD IOMMUs CVE-2013-0154 / XSA-37: Hypervisor crash due to incorrect ASSERT (debug build only) CVE-2013-0215 / XSA-38: oxenstored incorrect handling of certain Xenbus ring states CVE-2012-6075 / XSA-41: qemu (e1000 device driver): Buffer overflow when processing large packets CVE-2013-1917 / XSA-44: Xen PV DoS vulnerability with SYSENTER CVE-2013-1919 / XSA-46: Several access permission issues with IRQs for unprivileged guests CVE-2013-1920 / XSA-47: Potential use of freed memory in event channel operations CVE-2013-1922 / XSA-48: qemu-nbd format-guessing due to missing format specification This release contains many bug fixes and improvements (around 100 since Xen 4.2.1). The highlights are: ACPI APEI/ERST finally working on production systems Bug fixes for other low level system state handling Bug fixes and improvements to the libxl tool stack Bug fixes to nested virtualization ----- 4.2.1 Xen 4.2.1 is a maintenance release in the 4.2 series and contains: We recommend that all users of Xen 4.2.0 upgrade to Xen 4.2.1. The release fixes the following critical vulnerabilities: CVE-2012-4535 / XSA-20: Timer overflow DoS vulnerability CVE-2012-4537 / XSA-22: Memory mapping failure DoS vulnerability CVE-2012-4538 / XSA-23: Unhooking empty PAE entries DoS vulnerability CVE-2012-4539 / XSA-24: Grant table hypercall infinite loop DoS vulnerability CVE-2012-4544, CVE-2012-2625 / XSA-25: Xen domain builder Out-of-memory due to malicious kernel/ramdisk CVE-2012-5510 / XSA-26: Grant table version switch list corruption vulnerability CVE-2012-5511 / XSA-27: Several HVM operations do not validate the range of their inputs CVE-2012-5513 / XSA-29: XENMEM_exchange may overwrite hypervisor memory CVE-2012-5514 / XSA-30: Broken error handling in guest_physmap_mark_populate_on_demand() CVE-2012-5515 / XSA-31: Several memory hypercall operations allow invalid extent order values CVE-2012-5525 / XSA-32: several hypercalls do not validate input GFNs Among many bug fixes and improvements (around 100 since Xen 4.2.0): A fix for a long standing time management issue Bug fixes for S3 (suspend to RAM) handling Bug fixes for other low level system state handling Bug fixes and improvements to the libxl tool stack Bug fixes to nested virtualization ----- 4.2.0 The Xen 4.2 release contains a number of important new features and updates including: The release incorporates many new features and improvements to existing features. There are improvements across the board including to Security, Scalability, Performance and Documentation. XL is now the default toolstack: Significant effort has gone in to the XL tool toolstack in this release and it is now feature complete and robust enough that we have made it the default. This toolstack can now replace xend in the majority of deployments, see XL vs Xend Feature Comparison. As well as improving XL the underlying libxl library has been significantly improved and supports the majority of the most common toolstack features. In addition the API has been declared stable which should make it even easier for external toolstack such as libvirt and XCP's xapi to make full use of this functionality in the future. Large Systems: Following on from the improvements made in 4.1 Xen now supports even larger systems, with up to 4095 host CPUs and up to 512 guest CPUs. In addition toolstack feature like the ability to automatically create a CPUPOOL per NUMA node and more intelligent placement of guest VCPUs on NUMA nodes have further improved the Xen experience on large systems. Other new features, such as multiple PCI segment support have also made a positive impact on such systems. Improved security: The XSM/Flask subsystem has seen several enhancements, including improved support for disaggregated systems and a rewritten example policy which is clearer and simpler to modify to suit local requirements. Documentation: The Xen documentation has been much improved, both the in-tree documentation and the wiki. This is in no small part down to the success of the Xen Document Days so thanks to all who have taken part.
-rw-r--r--sysutils/xentools42/DESCR5
-rw-r--r--sysutils/xentools42/MESSAGE11
-rw-r--r--sysutils/xentools42/MESSAGE.NetBSD17
-rw-r--r--sysutils/xentools42/Makefile227
-rw-r--r--sysutils/xentools42/PLIST752
-rw-r--r--sysutils/xentools42/TODO7
-rw-r--r--sysutils/xentools42/distinfo59
-rw-r--r--sysutils/xentools42/files/blk_netbsd.c38
-rw-r--r--sysutils/xentools42/files/blktapctrl_netbsd.c16
-rw-r--r--sysutils/xentools42/files/xen-watchdog.sh17
-rw-r--r--sysutils/xentools42/files/xencommons.sh102
-rw-r--r--sysutils/xentools42/files/xend.sh102
-rw-r--r--sysutils/xentools42/files/xendomains.sh129
-rw-r--r--sysutils/xentools42/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h16
-rw-r--r--sysutils/xentools42/patches/patch-.._.._ipxe_src_core_settings.c34
-rw-r--r--sysutils/xentools42/patches/patch-.._.._ipxe_src_net_tls.c69
-rw-r--r--sysutils/xentools42/patches/patch-.._Config.mk22
-rw-r--r--sysutils/xentools42/patches/patch-.._config_NetBSD.mk23
-rw-r--r--sysutils/xentools42/patches/patch-.._config_StdGNU.mk23
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xend-config.sxp.pod.547
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xl.cfg.pod.529
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xl.conf.pod.521
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xl.pod.135
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xlcpupool.cfg.pod.528
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xm.pod.131
-rw-r--r--sysutils/xentools42/patches/patch-.._docs_man_xmdomain.cfg.pod.536
-rw-r--r--sysutils/xentools42/patches/patch-Makefile52
-rw-r--r--sysutils/xentools42/patches/patch-blktap_drivers_Makefile16
-rw-r--r--sysutils/xentools42/patches/patch-configure103
-rw-r--r--sysutils/xentools42/patches/patch-examples_Makefile11
-rw-r--r--sysutils/xentools42/patches/patch-examples_xend-config.sxp13
-rw-r--r--sysutils/xentools42/patches/patch-firmware_etherboot_Makefile26
-rw-r--r--sysutils/xentools42/patches/patch-firmware_etherboot_patches_boot__prompt__option.patch13
-rw-r--r--sysutils/xentools42/patches/patch-firmware_etherboot_patches_series9
-rw-r--r--sysutils/xentools42/patches/patch-firmware_hvmloader_Makefile13
-rw-r--r--sysutils/xentools42/patches/patch-hotplug_NetBSD_Makefile40
-rw-r--r--sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-bridge16
-rw-r--r--sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-ip15
-rw-r--r--sysutils/xentools42/patches/patch-hotplug_common_Makefile24
-rw-r--r--sysutils/xentools42/patches/patch-include_xen-sys_NetBSD_gntdev.h110
-rw-r--r--sysutils/xentools42/patches/patch-libfsimage_common_Makefile13
-rw-r--r--sysutils/xentools42/patches/patch-libxc_xc__netbsd.c251
-rw-r--r--sysutils/xentools42/patches/patch-libxl_libxl__create.c40
-rw-r--r--sysutils/xentools42/patches/patch-libxl_libxl__internal.h16
-rw-r--r--sysutils/xentools42/patches/patch-ocaml_common.make13
-rw-r--r--sysutils/xentools42/patches/patch-ocaml_xenstored_define.ml20
-rw-r--r--sysutils/xentools42/patches/patch-ocaml_xenstored_utils.ml13
-rw-r--r--sysutils/xentools42/patches/patch-python_xen_xend_XendNode.py56
-rw-r--r--sysutils/xentools42/patches/patch-python_xen_xend_osdep.py18
-rw-r--r--sysutils/xentools42/patches/patch-python_xen_xm_create.py13
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_Makefile85
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_block-raw-posix.c62
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_configure32
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_e1000.c34
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_ide.c27
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.c13
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.h18
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_piix4acpi.c17
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-graphics.c13
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.c15
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.h12
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_i386-dm_hookstarget.mak12
-rw-r--r--sysutils/xentools42/patches/patch-qemu-xen-traditional_xen-hooks.mak34
-rw-r--r--sysutils/xentools42/patches/patch-xentrace_Makefile12
-rw-r--r--sysutils/xentools42/version.mk6
65 files changed, 3202 insertions, 0 deletions
diff --git a/sysutils/xentools42/DESCR b/sysutils/xentools42/DESCR
new file mode 100644
index 00000000000..4bafa4b127f
--- /dev/null
+++ b/sysutils/xentools42/DESCR
@@ -0,0 +1,5 @@
+The Xen virtual machine monitor allows running several virtual machines
+on a single physical machine. The xentools42 package contains the
+tools to create, destroy and control the virtual machines.
+
+This package contains the tools for Xen 4.2.x
diff --git a/sysutils/xentools42/MESSAGE b/sysutils/xentools42/MESSAGE
new file mode 100644
index 00000000000..a210386133f
--- /dev/null
+++ b/sysutils/xentools42/MESSAGE
@@ -0,0 +1,11 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+Please note that the xm command is deprecated in this version of
+Xen and is likely to go away in the near future. It still functions,
+but you should consider switching to the xl command, which is now
+functional on NetBSD. The xend rcd script provides support for xm
+command and should only be activated if you plan on using the xm
+command.
+
+===========================================================================
diff --git a/sysutils/xentools42/MESSAGE.NetBSD b/sysutils/xentools42/MESSAGE.NetBSD
new file mode 100644
index 00000000000..41714ea05b5
--- /dev/null
+++ b/sysutils/xentools42/MESSAGE.NetBSD
@@ -0,0 +1,17 @@
+===========================================================================
+$NetBSD: MESSAGE.NetBSD,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+Please ensure that the Xen-specific devices needed by xend(8) exist:
+
+ cd /dev && sh MAKEDEV xen
+
+There are example configuration files for setting up a guest domain in:
+
+ ${EGDIR}/
+
+Please also refer to the the "NetBSD/xen How-To" for more information on
+creating a Xen setup:
+
+ http://www.NetBSD.org/ports/xen/howto.html
+
+===========================================================================
diff --git a/sysutils/xentools42/Makefile b/sysutils/xentools42/Makefile
new file mode 100644
index 00000000000..510b0bbbaa0
--- /dev/null
+++ b/sysutils/xentools42/Makefile
@@ -0,0 +1,227 @@
+# $NetBSD: Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+#
+# VERSION is set in version.mk as it is shared with other packages
+.include "version.mk"
+
+DISTNAME= xen-${VERSION}
+PKGNAME= xentools42-${VERSION}
+CATEGORIES= sysutils
+MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/
+
+DISTFILES= ${DISTNAME}.tar.gz
+DISTFILES+= ipxe-git-v${VERSION_IPXE}.tar.gz
+SITES.ipxe-git-v${VERSION_IPXE}.tar.gz += http://xenbits.xensource.com/xen-extfiles/
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://xen.org/
+COMMENT= Userland Tools for Xen 4.2.x
+
+LICENSE= gnu-gpl-v2
+
+# XXX add version check: Xen requires dev86 >= 0.16.14
+BUILD_DEPENDS+= dev86-[0-9]*:../../devel/dev86 # needed to build firmware
+.if !exists(/usr/bin/iasl)
+BUILD_DEPENDS+= acpica-utils-[0-9]*:../../sysutils/acpica-utils
+.endif
+
+PKG_SYSCONFSUBDIR= xen
+
+ONLY_FOR_PLATFORM= Linux-2.6*-i386 Linux-2.6*-x86_64
+ONLY_FOR_PLATFORM+= NetBSD-[5-9].*-x86_64 NetBSD-[5-9].*-i386
+
+CONFLICTS+= libxen-[0-9]*
+CONFLICTS+= xentools20-[0-9]*
+CONFLICTS+= xentools3-[0-9]*
+CONFLICTS+= xenstoretools-[0-9]*
+
+XENTOP= ${WRKDIR}/xen-${VERSION}
+WRKSRC= ${XENTOP}/tools
+CHECK_PORTABILITY_SKIP= examples/*
+
+EGDIR= ${PREFIX}/share/examples/xen
+MESSAGE_SUBST+= EGDIR=${EGDIR}
+
+USE_TOOLS+= pod2man gmake pkg-config makeinfo perl
+
+GNU_CONFIGURE= YES
+#CONFIGURE_ARGS+= --enable-xenapi
+CONFIGURE_ARGS+= --disable-seabios
+
+MAKE_ENV+= PREFIX=${prefix:Q} WRKSRC=${WRKSRC}
+MAKE_ENV+= EGDIR=${EGDIR}
+MAKE_ENV+= BASH_COMPLETION_DIR=${EGDIR}
+MAKE_ENV+= MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
+MAKE_ENV+= VARBASE=${VARBASE}
+MAKE_ENV+= XEN_CONFIG_DIR=${PKG_SYSCONFDIR}
+MAKE_ENV+= V=YES
+
+#MAKE_ENV+= INSTALL_DIR=${BSD_INSTALL_DATA_DIR}
+#MAKE_ENV+= INSTALL_DATA=${BSD_INSTALL_DATA}
+#MAKE_ENV+= INSTALL_PROG=${BSD_INSTALL_PROGRAM}
+
+PY_PATCHPLIST= yes
+#PYTHON_PATCH_SCRIPTS+= misc/xm
+#PYTHON_PATCH_SCRIPTS+= misc/netfix
+#PYTHON_PATCH_SCRIPTS+= misc/xen-bugtool
+#PYTHON_PATCH_SCRIPTS+= misc/xencons
+#PYTHON_PATCH_SCRIPTS+= misc/xend
+#PYTHON_PATCH_SCRIPTS+= misc/xensymoops
+#PYTHON_PATCH_SCRIPTS+= misc/xen-python-path
+#PYTHON_PATCH_SCRIPTS+= pygrub/src/pygrub
+#PYTHON_PATCH_SCRIPTS+= python/xen/util/*.py
+#PYTHON_PATCH_SCRIPTS+= python/xen/xend/*.py
+#PYTHON_PATCH_SCRIPTS+= python/xen/xm/*.py
+#PYTHON_PATCH_SCRIPTS+= python/xen/util/*.py
+#PYTHON_PATCH_SCRIPTS+= python/*.py
+#PYTHON_PATCH_SCRIPTS+= security/python/xensec_gen/cgi-bin/policy.cgi
+#PYTHON_PATCH_SCRIPTS+= security/python/xensec_gen/*.py
+#PYTHON_PATCH_SCRIPTS+= security/python/*.py
+#PYTHON_PATCH_SCRIPTS+= security/*.py
+#PYTHON_PATCH_SCRIPTS+= xenmon/*.py
+#PYTHON_PATCH_SCRIPTS+= xentrace/xentrace_format
+
+REPLACE_PYTHON+= misc/sbdf2devicepath misc/sxp-pretty misc/xen-bugtool
+REPLACE_PYTHON+= misc/xen-python-path misc/xen-ringwatch misc/xencons
+REPLACE_PYTHON+= misc/xend misc/xenpvnetboot misc/xensymoops misc/xm
+REPLACE_PYTHON+= misc/xsview
+REPLACE_PYTHON+= python/xen/remus/*.py
+REPLACE_PYTHON+= python/xen/util/*.py
+REPLACE_PYTHON+= python/xen/xend/*.py
+REPLACE_PYTHON+= python/xen/xm/*.py
+REPLACE_PYTHON+= xenmon/xenmon.py
+
+SUBST_CLASSES+= pathsvar
+SUBST_STAGE.pathsvar= pre-configure
+SUBST_FILES.pathsvar= Makefile \
+ examples/xend-config.sxp \
+ hotplug/Linux/init.d/sysconfig.xendomains \
+ python/xen/xend/XendOptions.py \
+ python/xen/xend/server/relocate.py \
+ python/xen/xend/tests/xend-config.sxp \
+ xenstore/xs_lib.c
+SUBST_SED.pathsvar= -e "s|/var/lib|${VARBASE}/run|g"
+
+SUBST_CLASSES+= conf
+SUBST_STAGE.conf= pre-configure
+SUBST_FILES.conf+= python/xen/xm/create.py
+SUBST_FILES.conf+= ocaml/xenstored/define.ml
+SUBST_SED.conf= -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g"
+
+.include "../../mk/bsd.prefs.mk"
+
+#XXX XEND_SCRIPTS= block vif-bridge vif-ip qemu-ifup hotplugpath.sh
+XEND_SCRIPTS= block vif-bridge vif-ip hotplugpath.sh
+
+.if ${OPSYS} == "NetBSD"
+SUBST_CLASSES+= proc
+SUBST_STAGE.proc= pre-configure
+SUBST_FILES.proc= python/xen/xend/XendVnet.py
+SUBST_FILES.proc+= ocaml/xenstored/define.ml
+SUBST_SED.proc= -e "s|/proc|/kern|g"
+PROCPATH= /kern
+.else
+PROCPATH= /proc
+.endif
+
+SUBST_CLASSES+= procdev
+SUBST_STAGE.procdev= pre-configure
+SUBST_FILES.procdev= ocaml/xenstored/define.ml
+.if ${OPSYS} == "NetBSD"
+SUBST_SED.procdev= -e "s|@PROCDEV@|/dev|g"
+.else
+SUBST_SED.procdev= -e "s|@PROCDEV@|/proc/xen|g"
+.endif
+
+.if ${OPSYS} == "NetBSD"
+MESSAGE_SRC= ${.CURDIR}/MESSAGE ${.CURDIR}/MESSAGE.NetBSD
+.endif
+
+RCD_SCRIPTS= xen-watchdog xencommons xend xendomains
+FILES_SUBST+= RCD_INTERPRETER=${PYTHONBIN:Q}
+FILES_SUBST+= PROCPATH=${PROCPATH:Q}
+FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
+FILES_SUBST+= PREFIX=${PREFIX}
+
+BLKTAP_FILES= blk_netbsd.c blktapctrl_netbsd.c
+
+CONF_FILES+= ${EGDIR}/formats ${PKG_SYSCONFDIR}/formats
+CONF_FILES+= ${EGDIR}/xend-config.sxp ${PKG_SYSCONFDIR}/xend-config.sxp
+CONF_FILES+= ${EGDIR}/xl.conf ${PKG_SYSCONFDIR}/xl.conf
+CONF_FILES+= ${EGDIR}/xm-config.xml ${PKG_SYSCONFDIR}/xm-config.xml
+
+OWN_DIRS= ${PKG_SYSCONFDIR}/scripts ${VARBASE}/log/xen
+OWN_DIRS+= ${VARBASE}/lib/xen
+
+.for s in ${XEND_SCRIPTS}
+CONF_FILES_PERMS+= ${EGDIR}/scripts/${s} ${PKG_SYSCONFDIR}/scripts/${s} \
+ ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 0755
+.endfor
+
+pre-build:
+ rm -f ${WRKSRC}/check/check_x11_devel
+.for s in ${BLKTAP_FILES}
+ ${CP} ${FILESDIR}/${s} ${WRKSRC}/blktap/drivers/
+.endfor
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xl.pod.1 |\
+ pod2man >${WRKDIR}/xl.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xm.pod.1 |\
+ pod2man >${WRKDIR}/xm.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xend-config.sxp.pod.5 |\
+ pod2man >${WRKDIR}/xend-config.sxp.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xl.cfg.pod.5 |\
+ pod2man >${WRKDIR}/xl.cfg.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xl.conf.pod.5 |\
+ pod2man >${WRKDIR}/xl.conf.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xlcpupool.cfg.pod.5 |\
+ pod2man >${WRKDIR}/xlcpupool.cfg.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${XENTOP}/docs/man/xmdomain.cfg.pod.5 |\
+ pod2man >${WRKDIR}/xmdomain.cfg.5
+
+INSTALLATION_DIRS= ${EGDIR} ${PKGMANDIR}/man5
+
+BUILD_DEFS+= VARBASE
+
+post-install:
+ ${INSTALL_DATA} ${WRKDIR}/xl.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_DATA} ${WRKDIR}/xm.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_DATA} ${WRKDIR}/xl.cfg.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+ ${INSTALL_DATA} ${WRKDIR}/xl.conf.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+ ${INSTALL_DATA} ${WRKDIR}/xlcpupool.cfg.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+ ${INSTALL_DATA} ${WRKDIR}/xend-config.sxp.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+ ${INSTALL_DATA} ${WRKDIR}/xmdomain.cfg.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+
+.if ${OPSYS} == "NetBSD"
+CPPFLAGS+= -Dshm_open=open -Dshm_unlink=unlink
+.endif
+
+.include "../../mk/compiler.mk"
+.if !empty(PKGSRC_COMPILER:Mclang)
+EXTRA_HOSTCFLAGS+= -Wno-error=ignored-attributes
+EXTRA_CFLAGS+= -Wno-error=ignored-attributes -no-integrated-as \
+ -Wno-error=tautological-compare -Wno-error=null-dereference \
+ -Wno-error=empty-body -Wno-error=self-assign \
+ -Wno-error=sometimes-uninitialized
+.endif
+
+MAKE_ENV+= EXTRA_HOSTCFLAGS=${EXTRA_HOSTCFLAGS:Q} EXTRA_CFLAGS=${EXTRA_CFLAGS:M*:Q}
+
+.include "../../lang/python/application.mk"
+.include "../../lang/python/extension.mk"
+.include "../../textproc/py-xml/buildlink3.mk"
+.include "../../devel/py-curses/buildlink3.mk"
+.include "../../devel/ncurses/buildlink3.mk"
+#.include "../../devel/SDL/buildlink3.mk"
+.include "../../lang/ocaml/buildlink3.mk"
+.include "../../devel/ocaml-findlib/buildlink3.mk"
+.include "../../sysutils/pciutils/buildlink3.mk"
+.include "../../devel/glib2/buildlink3.mk"
+.include "../../devel/yajl/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/xentools42/PLIST b/sysutils/xentools42/PLIST
new file mode 100644
index 00000000000..0a81530add5
--- /dev/null
+++ b/sysutils/xentools42/PLIST
@@ -0,0 +1,752 @@
+@comment $NetBSD: PLIST,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+bin/libxl-save-helper
+bin/lsevtchn
+bin/pygrub
+@comment bin/qemu-img-xen
+bin/readnotes
+bin/remus
+bin/xc_restore
+bin/xc_save
+bin/xen-detect
+bin/xencons
+bin/xenconsole
+bin/xenctx
+bin/xenpvnetboot
+bin/xenstore
+bin/xenstore-chmod
+bin/xenstore-control
+bin/xenstore-exists
+bin/xenstore-list
+bin/xenstore-ls
+bin/xenstore-read
+bin/xenstore-rm
+bin/xenstore-watch
+bin/xenstore-write
+bin/xentrace
+bin/xentrace_format
+bin/xentrace_setsize
+etc/xen/oxenstored.conf
+include/_libxl_list.h
+include/_libxl_types.h
+include/_libxl_types_json.h
+include/blktaplib.h
+include/fsimage.h
+include/fsimage_grub.h
+include/fsimage_plugin.h
+include/libxl.h
+include/libxl_event.h
+include/libxl_json.h
+include/libxl_utils.h
+include/libxl_uuid.h
+include/xen/COPYING
+include/xen/arch-arm.h
+include/xen/arch-ia64.h
+include/xen/arch-ia64/debug_op.h
+include/xen/arch-ia64/hvm/memmap.h
+include/xen/arch-ia64/hvm/save.h
+include/xen/arch-ia64/sioemu.h
+include/xen/arch-x86/cpuid.h
+include/xen/arch-x86/hvm/save.h
+include/xen/arch-x86/xen-mca.h
+include/xen/arch-x86/xen-x86_32.h
+include/xen/arch-x86/xen-x86_64.h
+include/xen/arch-x86/xen.h
+include/xen/arch-x86_32.h
+include/xen/arch-x86_64.h
+include/xen/callback.h
+include/xen/dom0_ops.h
+include/xen/domctl.h
+include/xen/elfnote.h
+include/xen/event_channel.h
+include/xen/features.h
+include/xen/foreign/ia64.h
+include/xen/foreign/x86_32.h
+include/xen/foreign/x86_64.h
+include/xen/grant_table.h
+include/xen/hvm/e820.h
+include/xen/hvm/hvm_info_table.h
+include/xen/hvm/hvm_op.h
+include/xen/hvm/ioreq.h
+include/xen/hvm/params.h
+include/xen/hvm/save.h
+include/xen/io/blkif.h
+include/xen/io/console.h
+include/xen/io/fbif.h
+include/xen/io/fsif.h
+include/xen/io/kbdif.h
+include/xen/io/libxenvchan.h
+include/xen/io/netif.h
+include/xen/io/pciif.h
+include/xen/io/protocols.h
+include/xen/io/ring.h
+include/xen/io/tpmif.h
+include/xen/io/usbif.h
+include/xen/io/vscsiif.h
+include/xen/io/xenbus.h
+include/xen/io/xs_wire.h
+include/xen/kexec.h
+include/xen/mem_event.h
+include/xen/memory.h
+include/xen/nmi.h
+include/xen/physdev.h
+include/xen/platform.h
+include/xen/sched.h
+include/xen/sys/evtchn.h
+include/xen/sys/gntdev.h
+include/xen/sys/privcmd.h
+include/xen/sysctl.h
+include/xen/tmem.h
+include/xen/trace.h
+include/xen/vcpu.h
+include/xen/version.h
+include/xen/xen-compat.h
+include/xen/xen.h
+include/xen/xencomm.h
+include/xen/xenoprof.h
+include/xen/xsm/flask_op.h
+include/xenctrl.h
+include/xenctrlosdep.h
+include/xenguest.h
+include/xenstat.h
+include/xenstore-compat/xs.h
+include/xenstore-compat/xs_lib.h
+include/xenstore.h
+include/xenstore_lib.h
+include/xentoollog.h
+include/xs.h
+include/xs_lib.h
+lib/fs/ext2fs/fsimage.so
+lib/fs/fat/fsimage.so
+lib/fs/iso9660/fsimage.so
+lib/fs/reiserfs/fsimage.so
+lib/fs/ufs/fsimage.so
+lib/fs/xfs/fsimage.so
+lib/fs/zfs/fsimage.so
+lib/libblktap.a
+lib/libblktap.so
+lib/libblktap.so.3.0
+lib/libblktap.so.3.0.0
+lib/libfsimage.so
+lib/libfsimage.so.1.0
+lib/libfsimage.so.1.0.0
+lib/libxenctrl.a
+lib/libxenctrl.so
+lib/libxenctrl.so.4.2
+lib/libxenctrl.so.4.2.0
+lib/libxenguest.a
+lib/libxenguest.so
+lib/libxenguest.so.4.2
+lib/libxenguest.so.4.2.0
+lib/libxenlight.a
+lib/libxenlight.so
+lib/libxenlight.so.2.0
+lib/libxenlight.so.2.0.0
+lib/libxenstat.a
+lib/libxenstat.so
+lib/libxenstat.so.0
+lib/libxenstat.so.0.0
+lib/libxenstore.a
+lib/libxenstore.so
+lib/libxenstore.so.3.0
+lib/libxenstore.so.3.0.2
+lib/libxlutil.a
+lib/libxlutil.so
+lib/libxlutil.so.1.0
+lib/libxlutil.so.1.0.1
+lib/ocaml/site-lib/xenbus/META
+lib/ocaml/site-lib/xenbus/dllxenbus_stubs.so
+lib/ocaml/site-lib/xenbus/libxenbus_stubs.a
+lib/ocaml/site-lib/xenbus/xenbus.a
+lib/ocaml/site-lib/xenbus/xenbus.cma
+lib/ocaml/site-lib/xenbus/xenbus.cmi
+lib/ocaml/site-lib/xenbus/xenbus.cmo
+lib/ocaml/site-lib/xenbus/xenbus.cmx
+lib/ocaml/site-lib/xenbus/xenbus.cmxa
+lib/ocaml/site-lib/xenctrl/META
+lib/ocaml/site-lib/xenctrl/dllxenctrl_stubs.so
+lib/ocaml/site-lib/xenctrl/libxenctrl_stubs.a
+lib/ocaml/site-lib/xenctrl/xenctrl.a
+lib/ocaml/site-lib/xenctrl/xenctrl.cma
+lib/ocaml/site-lib/xenctrl/xenctrl.cmi
+lib/ocaml/site-lib/xenctrl/xenctrl.cmx
+lib/ocaml/site-lib/xenctrl/xenctrl.cmxa
+lib/ocaml/site-lib/xeneventchn/META
+lib/ocaml/site-lib/xeneventchn/dllxeneventchn_stubs.so
+lib/ocaml/site-lib/xeneventchn/libxeneventchn_stubs.a
+lib/ocaml/site-lib/xeneventchn/xeneventchn.a
+lib/ocaml/site-lib/xeneventchn/xeneventchn.cma
+lib/ocaml/site-lib/xeneventchn/xeneventchn.cmi
+lib/ocaml/site-lib/xeneventchn/xeneventchn.cmx
+lib/ocaml/site-lib/xeneventchn/xeneventchn.cmxa
+lib/ocaml/site-lib/xenlight/META
+lib/ocaml/site-lib/xenlight/dllxenlight_stubs.so
+lib/ocaml/site-lib/xenlight/libxenlight_stubs.a
+lib/ocaml/site-lib/xenlight/xenlight.a
+lib/ocaml/site-lib/xenlight/xenlight.cma
+lib/ocaml/site-lib/xenlight/xenlight.cmi
+lib/ocaml/site-lib/xenlight/xenlight.cmx
+lib/ocaml/site-lib/xenlight/xenlight.cmxa
+lib/ocaml/site-lib/xenmmap/META
+lib/ocaml/site-lib/xenmmap/dllxenmmap_stubs.so
+lib/ocaml/site-lib/xenmmap/libxenmmap_stubs.a
+lib/ocaml/site-lib/xenmmap/xenmmap.a
+lib/ocaml/site-lib/xenmmap/xenmmap.cma
+lib/ocaml/site-lib/xenmmap/xenmmap.cmi
+lib/ocaml/site-lib/xenmmap/xenmmap.cmx
+lib/ocaml/site-lib/xenmmap/xenmmap.cmxa
+lib/ocaml/site-lib/xenstore/META
+lib/ocaml/site-lib/xenstore/xenstore.a
+lib/ocaml/site-lib/xenstore/xenstore.cma
+lib/ocaml/site-lib/xenstore/xenstore.cmi
+lib/ocaml/site-lib/xenstore/xenstore.cmo
+lib/ocaml/site-lib/xenstore/xenstore.cmx
+lib/ocaml/site-lib/xenstore/xenstore.cmxa
+${PYSITELIB}/fsimage.so
+${PYSITELIB}/grub/ExtLinuxConf.py
+${PYSITELIB}/grub/ExtLinuxConf.pyc
+${PYSITELIB}/grub/GrubConf.py
+${PYSITELIB}/grub/GrubConf.pyc
+${PYSITELIB}/grub/LiloConf.py
+${PYSITELIB}/grub/LiloConf.pyc
+${PYSITELIB}/grub/__init__.py
+${PYSITELIB}/grub/__init__.pyc
+${PYSITELIB}/xen/__init__.py
+${PYSITELIB}/xen/__init__.pyc
+${PYSITELIB}/xen/lowlevel/__init__.py
+${PYSITELIB}/xen/lowlevel/__init__.pyc
+${PYSITELIB}/xen/lowlevel/flask.so
+${PYSITELIB}/xen/lowlevel/ptsname.so
+${PYSITELIB}/xen/lowlevel/xc.so
+${PYSITELIB}/xen/lowlevel/xs.so
+${PYSITELIB}/xen/remus/__init__.py
+${PYSITELIB}/xen/remus/__init__.pyc
+${PYSITELIB}/xen/remus/blkdev.py
+${PYSITELIB}/xen/remus/blkdev.pyc
+${PYSITELIB}/xen/remus/device.py
+${PYSITELIB}/xen/remus/device.pyc
+${PYSITELIB}/xen/remus/image.py
+${PYSITELIB}/xen/remus/image.pyc
+${PYSITELIB}/xen/remus/netlink.py
+${PYSITELIB}/xen/remus/netlink.pyc
+${PYSITELIB}/xen/remus/profile.py
+${PYSITELIB}/xen/remus/profile.pyc
+${PYSITELIB}/xen/remus/qdisc.py
+${PYSITELIB}/xen/remus/qdisc.pyc
+${PYSITELIB}/xen/remus/save.py
+${PYSITELIB}/xen/remus/save.pyc
+${PYSITELIB}/xen/remus/tapdisk.py
+${PYSITELIB}/xen/remus/tapdisk.pyc
+${PYSITELIB}/xen/remus/util.py
+${PYSITELIB}/xen/remus/util.pyc
+${PYSITELIB}/xen/remus/vbd.py
+${PYSITELIB}/xen/remus/vbd.pyc
+${PYSITELIB}/xen/remus/vdi.py
+${PYSITELIB}/xen/remus/vdi.pyc
+${PYSITELIB}/xen/remus/vif.py
+${PYSITELIB}/xen/remus/vif.pyc
+${PYSITELIB}/xen/remus/vm.py
+${PYSITELIB}/xen/remus/vm.pyc
+${PYSITELIB}/xen/sv/CreateDomain.py
+${PYSITELIB}/xen/sv/CreateDomain.pyc
+${PYSITELIB}/xen/sv/DomInfo.py
+${PYSITELIB}/xen/sv/DomInfo.pyc
+${PYSITELIB}/xen/sv/GenTabbed.py
+${PYSITELIB}/xen/sv/GenTabbed.pyc
+${PYSITELIB}/xen/sv/HTMLBase.py
+${PYSITELIB}/xen/sv/HTMLBase.pyc
+${PYSITELIB}/xen/sv/Main.py
+${PYSITELIB}/xen/sv/Main.pyc
+${PYSITELIB}/xen/sv/NodeInfo.py
+${PYSITELIB}/xen/sv/NodeInfo.pyc
+${PYSITELIB}/xen/sv/RestoreDomain.py
+${PYSITELIB}/xen/sv/RestoreDomain.pyc
+${PYSITELIB}/xen/sv/Wizard.py
+${PYSITELIB}/xen/sv/Wizard.pyc
+${PYSITELIB}/xen/sv/__init__.py
+${PYSITELIB}/xen/sv/__init__.pyc
+${PYSITELIB}/xen/sv/util.py
+${PYSITELIB}/xen/sv/util.pyc
+${PYSITELIB}/xen/util/Brctl.py
+${PYSITELIB}/xen/util/Brctl.pyc
+${PYSITELIB}/xen/util/SSHTransport.py
+${PYSITELIB}/xen/util/SSHTransport.pyc
+${PYSITELIB}/xen/util/__init__.py
+${PYSITELIB}/xen/util/__init__.pyc
+${PYSITELIB}/xen/util/acmpolicy.py
+${PYSITELIB}/xen/util/acmpolicy.pyc
+${PYSITELIB}/xen/util/asserts.py
+${PYSITELIB}/xen/util/asserts.pyc
+${PYSITELIB}/xen/util/auxbin.py
+${PYSITELIB}/xen/util/auxbin.pyc
+${PYSITELIB}/xen/util/blkif.py
+${PYSITELIB}/xen/util/blkif.pyc
+${PYSITELIB}/xen/util/bootloader.py
+${PYSITELIB}/xen/util/bootloader.pyc
+${PYSITELIB}/xen/util/bugtool.py
+${PYSITELIB}/xen/util/bugtool.pyc
+${PYSITELIB}/xen/util/diagnose.py
+${PYSITELIB}/xen/util/diagnose.pyc
+${PYSITELIB}/xen/util/dictio.py
+${PYSITELIB}/xen/util/dictio.pyc
+${PYSITELIB}/xen/util/fileuri.py
+${PYSITELIB}/xen/util/fileuri.pyc
+${PYSITELIB}/xen/util/ip.py
+${PYSITELIB}/xen/util/ip.pyc
+${PYSITELIB}/xen/util/mac.py
+${PYSITELIB}/xen/util/mac.pyc
+${PYSITELIB}/xen/util/mkdir.py
+${PYSITELIB}/xen/util/mkdir.pyc
+${PYSITELIB}/xen/util/oshelp.py
+${PYSITELIB}/xen/util/oshelp.pyc
+${PYSITELIB}/xen/util/path.py
+${PYSITELIB}/xen/util/path.pyc
+${PYSITELIB}/xen/util/pci.py
+${PYSITELIB}/xen/util/pci.pyc
+${PYSITELIB}/xen/util/rwlock.py
+${PYSITELIB}/xen/util/rwlock.pyc
+${PYSITELIB}/xen/util/sxputils.py
+${PYSITELIB}/xen/util/sxputils.pyc
+${PYSITELIB}/xen/util/utils.py
+${PYSITELIB}/xen/util/utils.pyc
+${PYSITELIB}/xen/util/vscsi_util.py
+${PYSITELIB}/xen/util/vscsi_util.pyc
+${PYSITELIB}/xen/util/vusb_util.py
+${PYSITELIB}/xen/util/vusb_util.pyc
+${PYSITELIB}/xen/util/xmlrpcclient.py
+${PYSITELIB}/xen/util/xmlrpcclient.pyc
+${PYSITELIB}/xen/util/xmlrpclib2.py
+${PYSITELIB}/xen/util/xmlrpclib2.pyc
+${PYSITELIB}/xen/util/xpopen.py
+${PYSITELIB}/xen/util/xpopen.pyc
+${PYSITELIB}/xen/util/xsconstants.py
+${PYSITELIB}/xen/util/xsconstants.pyc
+${PYSITELIB}/xen/util/xsm/__init__.py
+${PYSITELIB}/xen/util/xsm/__init__.pyc
+${PYSITELIB}/xen/util/xsm/acm/__init__.py
+${PYSITELIB}/xen/util/xsm/acm/__init__.pyc
+${PYSITELIB}/xen/util/xsm/acm/acm.py
+${PYSITELIB}/xen/util/xsm/acm/acm.pyc
+${PYSITELIB}/xen/util/xsm/dummy/__init__.py
+${PYSITELIB}/xen/util/xsm/dummy/__init__.pyc
+${PYSITELIB}/xen/util/xsm/dummy/dummy.py
+${PYSITELIB}/xen/util/xsm/dummy/dummy.pyc
+${PYSITELIB}/xen/util/xsm/flask/__init__.py
+${PYSITELIB}/xen/util/xsm/flask/__init__.pyc
+${PYSITELIB}/xen/util/xsm/flask/flask.py
+${PYSITELIB}/xen/util/xsm/flask/flask.pyc
+${PYSITELIB}/xen/util/xsm/xsm.py
+${PYSITELIB}/xen/util/xsm/xsm.pyc
+${PYSITELIB}/xen/util/xsm/xsm_core.py
+${PYSITELIB}/xen/util/xsm/xsm_core.pyc
+${PYSITELIB}/xen/util/xspolicy.py
+${PYSITELIB}/xen/util/xspolicy.pyc
+${PYSITELIB}/xen/web/SrvBase.py
+${PYSITELIB}/xen/web/SrvBase.pyc
+${PYSITELIB}/xen/web/SrvDir.py
+${PYSITELIB}/xen/web/SrvDir.pyc
+${PYSITELIB}/xen/web/__init__.py
+${PYSITELIB}/xen/web/__init__.pyc
+${PYSITELIB}/xen/web/connection.py
+${PYSITELIB}/xen/web/connection.pyc
+${PYSITELIB}/xen/web/http.py
+${PYSITELIB}/xen/web/http.pyc
+${PYSITELIB}/xen/web/httpserver.py
+${PYSITELIB}/xen/web/httpserver.pyc
+${PYSITELIB}/xen/web/protocol.py
+${PYSITELIB}/xen/web/protocol.pyc
+${PYSITELIB}/xen/web/resource.py
+${PYSITELIB}/xen/web/resource.pyc
+${PYSITELIB}/xen/web/static.py
+${PYSITELIB}/xen/web/static.pyc
+${PYSITELIB}/xen/web/tcp.py
+${PYSITELIB}/xen/web/tcp.pyc
+${PYSITELIB}/xen/web/unix.py
+${PYSITELIB}/xen/web/unix.pyc
+${PYSITELIB}/xen/xend/Args.py
+${PYSITELIB}/xen/xend/Args.pyc
+${PYSITELIB}/xen/xend/MemoryPool.py
+${PYSITELIB}/xen/xend/MemoryPool.pyc
+${PYSITELIB}/xen/xend/PrettyPrint.py
+${PYSITELIB}/xen/xend/PrettyPrint.pyc
+${PYSITELIB}/xen/xend/Vifctl.py
+${PYSITELIB}/xen/xend/Vifctl.pyc
+${PYSITELIB}/xen/xend/XendAPI.py
+${PYSITELIB}/xen/xend/XendAPI.pyc
+${PYSITELIB}/xen/xend/XendAPIConstants.py
+${PYSITELIB}/xen/xend/XendAPIConstants.pyc
+${PYSITELIB}/xen/xend/XendAPIStore.py
+${PYSITELIB}/xen/xend/XendAPIStore.pyc
+${PYSITELIB}/xen/xend/XendAPIVersion.py
+${PYSITELIB}/xen/xend/XendAPIVersion.pyc
+${PYSITELIB}/xen/xend/XendAuthSessions.py
+${PYSITELIB}/xen/xend/XendAuthSessions.pyc
+${PYSITELIB}/xen/xend/XendBase.py
+${PYSITELIB}/xen/xend/XendBase.pyc
+${PYSITELIB}/xen/xend/XendBootloader.py
+${PYSITELIB}/xen/xend/XendBootloader.pyc
+${PYSITELIB}/xen/xend/XendCPUPool.py
+${PYSITELIB}/xen/xend/XendCPUPool.pyc
+${PYSITELIB}/xen/xend/XendCheckpoint.py
+${PYSITELIB}/xen/xend/XendCheckpoint.pyc
+${PYSITELIB}/xen/xend/XendClient.py
+${PYSITELIB}/xen/xend/XendClient.pyc
+${PYSITELIB}/xen/xend/XendConfig.py
+${PYSITELIB}/xen/xend/XendConfig.pyc
+${PYSITELIB}/xen/xend/XendConstants.py
+${PYSITELIB}/xen/xend/XendConstants.pyc
+${PYSITELIB}/xen/xend/XendDPCI.py
+${PYSITELIB}/xen/xend/XendDPCI.pyc
+${PYSITELIB}/xen/xend/XendDSCSI.py
+${PYSITELIB}/xen/xend/XendDSCSI.pyc
+${PYSITELIB}/xen/xend/XendDevices.py
+${PYSITELIB}/xen/xend/XendDevices.pyc
+${PYSITELIB}/xen/xend/XendDmesg.py
+${PYSITELIB}/xen/xend/XendDmesg.pyc
+${PYSITELIB}/xen/xend/XendDomain.py
+${PYSITELIB}/xen/xend/XendDomain.pyc
+${PYSITELIB}/xen/xend/XendDomainInfo.py
+${PYSITELIB}/xen/xend/XendDomainInfo.pyc
+${PYSITELIB}/xen/xend/XendError.py
+${PYSITELIB}/xen/xend/XendError.pyc
+${PYSITELIB}/xen/xend/XendLocalStorageRepo.py
+${PYSITELIB}/xen/xend/XendLocalStorageRepo.pyc
+${PYSITELIB}/xen/xend/XendLogging.py
+${PYSITELIB}/xen/xend/XendLogging.pyc
+${PYSITELIB}/xen/xend/XendMonitor.py
+${PYSITELIB}/xen/xend/XendMonitor.pyc
+${PYSITELIB}/xen/xend/XendNetwork.py
+${PYSITELIB}/xen/xend/XendNetwork.pyc
+${PYSITELIB}/xen/xend/XendNode.py
+${PYSITELIB}/xen/xend/XendNode.pyc
+${PYSITELIB}/xen/xend/XendOptions.py
+${PYSITELIB}/xen/xend/XendOptions.pyc
+${PYSITELIB}/xen/xend/XendPBD.py
+${PYSITELIB}/xen/xend/XendPBD.pyc
+${PYSITELIB}/xen/xend/XendPIF.py
+${PYSITELIB}/xen/xend/XendPIF.pyc
+${PYSITELIB}/xen/xend/XendPIFMetrics.py
+${PYSITELIB}/xen/xend/XendPIFMetrics.pyc
+${PYSITELIB}/xen/xend/XendPPCI.py
+${PYSITELIB}/xen/xend/XendPPCI.pyc
+${PYSITELIB}/xen/xend/XendPSCSI.py
+${PYSITELIB}/xen/xend/XendPSCSI.pyc
+${PYSITELIB}/xen/xend/XendProtocol.py
+${PYSITELIB}/xen/xend/XendProtocol.pyc
+${PYSITELIB}/xen/xend/XendQCoWStorageRepo.py
+${PYSITELIB}/xen/xend/XendQCoWStorageRepo.pyc
+${PYSITELIB}/xen/xend/XendSXPDev.py
+${PYSITELIB}/xen/xend/XendSXPDev.pyc
+${PYSITELIB}/xen/xend/XendStateStore.py
+${PYSITELIB}/xen/xend/XendStateStore.pyc
+${PYSITELIB}/xen/xend/XendStorageRepository.py
+${PYSITELIB}/xen/xend/XendStorageRepository.pyc
+${PYSITELIB}/xen/xend/XendTask.py
+${PYSITELIB}/xen/xend/XendTask.pyc
+${PYSITELIB}/xen/xend/XendTaskManager.py
+${PYSITELIB}/xen/xend/XendTaskManager.pyc
+${PYSITELIB}/xen/xend/XendVDI.py
+${PYSITELIB}/xen/xend/XendVDI.pyc
+${PYSITELIB}/xen/xend/XendVMMetrics.py
+${PYSITELIB}/xen/xend/XendVMMetrics.pyc
+${PYSITELIB}/xen/xend/XendVnet.py
+${PYSITELIB}/xen/xend/XendVnet.pyc
+${PYSITELIB}/xen/xend/XendXSPolicy.py
+${PYSITELIB}/xen/xend/XendXSPolicy.pyc
+${PYSITELIB}/xen/xend/XendXSPolicyAdmin.py
+${PYSITELIB}/xen/xend/XendXSPolicyAdmin.pyc
+${PYSITELIB}/xen/xend/__init__.py
+${PYSITELIB}/xen/xend/__init__.pyc
+${PYSITELIB}/xen/xend/arch.py
+${PYSITELIB}/xen/xend/arch.pyc
+${PYSITELIB}/xen/xend/balloon.py
+${PYSITELIB}/xen/xend/balloon.pyc
+${PYSITELIB}/xen/xend/encode.py
+${PYSITELIB}/xen/xend/encode.pyc
+${PYSITELIB}/xen/xend/image.py
+${PYSITELIB}/xen/xend/image.pyc
+${PYSITELIB}/xen/xend/osdep.py
+${PYSITELIB}/xen/xend/osdep.pyc
+${PYSITELIB}/xen/xend/server/BlktapController.py
+${PYSITELIB}/xen/xend/server/BlktapController.pyc
+${PYSITELIB}/xen/xend/server/ConsoleController.py
+${PYSITELIB}/xen/xend/server/ConsoleController.pyc
+${PYSITELIB}/xen/xend/server/DevConstants.py
+${PYSITELIB}/xen/xend/server/DevConstants.pyc
+${PYSITELIB}/xen/xend/server/DevController.py
+${PYSITELIB}/xen/xend/server/DevController.pyc
+${PYSITELIB}/xen/xend/server/SSLXMLRPCServer.py
+${PYSITELIB}/xen/xend/server/SSLXMLRPCServer.pyc
+${PYSITELIB}/xen/xend/server/SrvDaemon.py
+${PYSITELIB}/xen/xend/server/SrvDaemon.pyc
+${PYSITELIB}/xen/xend/server/SrvDmesg.py
+${PYSITELIB}/xen/xend/server/SrvDmesg.pyc
+${PYSITELIB}/xen/xend/server/SrvDomain.py
+${PYSITELIB}/xen/xend/server/SrvDomain.pyc
+${PYSITELIB}/xen/xend/server/SrvDomainDir.py
+${PYSITELIB}/xen/xend/server/SrvDomainDir.pyc
+${PYSITELIB}/xen/xend/server/SrvNode.py
+${PYSITELIB}/xen/xend/server/SrvNode.pyc
+${PYSITELIB}/xen/xend/server/SrvRoot.py
+${PYSITELIB}/xen/xend/server/SrvRoot.pyc
+${PYSITELIB}/xen/xend/server/SrvServer.py
+${PYSITELIB}/xen/xend/server/SrvServer.pyc
+${PYSITELIB}/xen/xend/server/SrvVnetDir.py
+${PYSITELIB}/xen/xend/server/SrvVnetDir.pyc
+${PYSITELIB}/xen/xend/server/SrvXendLog.py
+${PYSITELIB}/xen/xend/server/SrvXendLog.pyc
+${PYSITELIB}/xen/xend/server/XMLRPCServer.py
+${PYSITELIB}/xen/xend/server/XMLRPCServer.pyc
+${PYSITELIB}/xen/xend/server/__init__.py
+${PYSITELIB}/xen/xend/server/__init__.pyc
+${PYSITELIB}/xen/xend/server/blkif.py
+${PYSITELIB}/xen/xend/server/blkif.pyc
+${PYSITELIB}/xen/xend/server/iopif.py
+${PYSITELIB}/xen/xend/server/iopif.pyc
+${PYSITELIB}/xen/xend/server/irqif.py
+${PYSITELIB}/xen/xend/server/irqif.pyc
+${PYSITELIB}/xen/xend/server/netif.py
+${PYSITELIB}/xen/xend/server/netif.pyc
+${PYSITELIB}/xen/xend/server/netif2.py
+${PYSITELIB}/xen/xend/server/netif2.pyc
+${PYSITELIB}/xen/xend/server/params.py
+${PYSITELIB}/xen/xend/server/params.pyc
+${PYSITELIB}/xen/xend/server/pciif.py
+${PYSITELIB}/xen/xend/server/pciif.pyc
+${PYSITELIB}/xen/xend/server/pciquirk.py
+${PYSITELIB}/xen/xend/server/pciquirk.pyc
+${PYSITELIB}/xen/xend/server/relocate.py
+${PYSITELIB}/xen/xend/server/relocate.pyc
+${PYSITELIB}/xen/xend/server/tests/__init__.py
+${PYSITELIB}/xen/xend/server/tests/__init__.pyc
+${PYSITELIB}/xen/xend/server/tests/test_controllers.py
+${PYSITELIB}/xen/xend/server/tests/test_controllers.pyc
+${PYSITELIB}/xen/xend/server/tpmif.py
+${PYSITELIB}/xen/xend/server/tpmif.pyc
+${PYSITELIB}/xen/xend/server/udevevent.py
+${PYSITELIB}/xen/xend/server/udevevent.pyc
+${PYSITELIB}/xen/xend/server/vfbif.py
+${PYSITELIB}/xen/xend/server/vfbif.pyc
+${PYSITELIB}/xen/xend/server/vscsiif.py
+${PYSITELIB}/xen/xend/server/vscsiif.pyc
+${PYSITELIB}/xen/xend/server/vusbif.py
+${PYSITELIB}/xen/xend/server/vusbif.pyc
+${PYSITELIB}/xen/xend/sxp.py
+${PYSITELIB}/xen/xend/sxp.pyc
+${PYSITELIB}/xen/xend/tests/__init__.py
+${PYSITELIB}/xen/xend/tests/__init__.pyc
+${PYSITELIB}/xen/xend/tests/test_XendConfig.py
+${PYSITELIB}/xen/xend/tests/test_XendConfig.pyc
+${PYSITELIB}/xen/xend/tests/test_sxp.py
+${PYSITELIB}/xen/xend/tests/test_sxp.pyc
+${PYSITELIB}/xen/xend/tests/test_uuid.py
+${PYSITELIB}/xen/xend/tests/test_uuid.pyc
+${PYSITELIB}/xen/xend/uuid.py
+${PYSITELIB}/xen/xend/uuid.pyc
+${PYSITELIB}/xen/xend/xenstore/__init__.py
+${PYSITELIB}/xen/xend/xenstore/__init__.pyc
+${PYSITELIB}/xen/xend/xenstore/tests/__init__.py
+${PYSITELIB}/xen/xend/xenstore/tests/__init__.pyc
+${PYSITELIB}/xen/xend/xenstore/tests/stress_xs.py
+${PYSITELIB}/xen/xend/xenstore/tests/stress_xs.pyc
+${PYSITELIB}/xen/xend/xenstore/xstransact.py
+${PYSITELIB}/xen/xend/xenstore/xstransact.pyc
+${PYSITELIB}/xen/xend/xenstore/xsutil.py
+${PYSITELIB}/xen/xend/xenstore/xsutil.pyc
+${PYSITELIB}/xen/xend/xenstore/xswatch.py
+${PYSITELIB}/xen/xend/xenstore/xswatch.pyc
+${PYSITELIB}/xen/xm/XenAPI.py
+${PYSITELIB}/xen/xm/XenAPI.pyc
+${PYSITELIB}/xen/xm/__init__.py
+${PYSITELIB}/xen/xm/__init__.pyc
+${PYSITELIB}/xen/xm/addlabel.py
+${PYSITELIB}/xen/xm/addlabel.pyc
+${PYSITELIB}/xen/xm/console.py
+${PYSITELIB}/xen/xm/console.pyc
+${PYSITELIB}/xen/xm/cpupool-create.py
+${PYSITELIB}/xen/xm/cpupool-create.pyc
+${PYSITELIB}/xen/xm/cpupool-new.py
+${PYSITELIB}/xen/xm/cpupool-new.pyc
+${PYSITELIB}/xen/xm/cpupool.py
+${PYSITELIB}/xen/xm/cpupool.pyc
+${PYSITELIB}/xen/xm/create.py
+${PYSITELIB}/xen/xm/create.pyc
+${PYSITELIB}/xen/xm/dry-run.py
+${PYSITELIB}/xen/xm/dry-run.pyc
+${PYSITELIB}/xen/xm/dumppolicy.py
+${PYSITELIB}/xen/xm/dumppolicy.pyc
+${PYSITELIB}/xen/xm/getenforce.py
+${PYSITELIB}/xen/xm/getenforce.pyc
+${PYSITELIB}/xen/xm/getlabel.py
+${PYSITELIB}/xen/xm/getlabel.pyc
+${PYSITELIB}/xen/xm/getpolicy.py
+${PYSITELIB}/xen/xm/getpolicy.pyc
+${PYSITELIB}/xen/xm/help.py
+${PYSITELIB}/xen/xm/help.pyc
+${PYSITELIB}/xen/xm/labels.py
+${PYSITELIB}/xen/xm/labels.pyc
+${PYSITELIB}/xen/xm/main.py
+${PYSITELIB}/xen/xm/main.pyc
+${PYSITELIB}/xen/xm/migrate.py
+${PYSITELIB}/xen/xm/migrate.pyc
+${PYSITELIB}/xen/xm/new.py
+${PYSITELIB}/xen/xm/new.pyc
+${PYSITELIB}/xen/xm/opts.py
+${PYSITELIB}/xen/xm/opts.pyc
+${PYSITELIB}/xen/xm/resetpolicy.py
+${PYSITELIB}/xen/xm/resetpolicy.pyc
+${PYSITELIB}/xen/xm/resources.py
+${PYSITELIB}/xen/xm/resources.pyc
+${PYSITELIB}/xen/xm/rmlabel.py
+${PYSITELIB}/xen/xm/rmlabel.pyc
+${PYSITELIB}/xen/xm/setenforce.py
+${PYSITELIB}/xen/xm/setenforce.pyc
+${PYSITELIB}/xen/xm/setpolicy.py
+${PYSITELIB}/xen/xm/setpolicy.pyc
+${PYSITELIB}/xen/xm/shutdown.py
+${PYSITELIB}/xen/xm/shutdown.pyc
+${PYSITELIB}/xen/xm/tests/__init__.py
+${PYSITELIB}/xen/xm/tests/__init__.pyc
+${PYSITELIB}/xen/xm/tests/test_create.py
+${PYSITELIB}/xen/xm/tests/test_create.pyc
+${PYSITELIB}/xen/xm/xenapi_create.py
+${PYSITELIB}/xen/xm/xenapi_create.pyc
+${PYSITELIB}/xen/xsview/__init__.py
+${PYSITELIB}/xen/xsview/__init__.pyc
+${PYSITELIB}/xen/xsview/main.py
+${PYSITELIB}/xen/xsview/main.pyc
+${PYSITELIB}/xen/xsview/xsviewer.py
+${PYSITELIB}/xen/xsview/xsviewer.pyc
+@comment lib/xen/boot/hvmloader
+@comment libexec/qemu-dm
+libexec/xenpaging
+man/man1/xentop.1
+man/man1/xentrace_format.1
+man/man1/xl.1
+man/man1/xm.1
+man/man5/xend-config.sxp.5
+man/man5/xl.cfg.5
+man/man5/xl.conf.5
+man/man5/xlcpupool.cfg.5
+man/man5/xmdomain.cfg.5
+man/man8/xentrace.8
+sbin/blktapctrl
+sbin/flask-get-bool
+sbin/flask-getenforce
+sbin/flask-label-pci
+sbin/flask-loadpolicy
+sbin/flask-set-bool
+sbin/flask-setenforce
+sbin/gdbsx
+sbin/gtracestat
+sbin/gtraceview
+sbin/img2qcow
+sbin/kdd
+sbin/oxenstored
+sbin/qcow-create
+sbin/qcow2raw
+sbin/tapdisk
+sbin/xen-bugtool
+sbin/xen-hptool
+sbin/xen-hvmcrash
+sbin/xen-hvmctx
+sbin/xen-lowmemd
+sbin/xen-python-path
+sbin/xen-ringwatch
+sbin/xen-tmem-list-parse
+sbin/xenbackendd
+sbin/xenbaked
+sbin/xenconsoled
+sbin/xend
+sbin/xenlockprof
+sbin/xenmon.py
+sbin/xenperf
+sbin/xenpm
+sbin/xenpmd
+sbin/xenstored
+sbin/xentop
+sbin/xentrace_setmask
+sbin/xenwatchdogd
+sbin/xl
+sbin/xm
+sbin/xsview
+share/doc/xen/README.blktap
+share/doc/xen/README.xenmon
+share/examples/rc.d/xen-watchdog
+share/examples/rc.d/xencommons
+share/examples/rc.d/xend
+share/examples/rc.d/xendomains
+share/examples/xen/README
+share/examples/xen/README.incompatibilities
+share/examples/xen/cpupool
+share/examples/xen/formats
+share/examples/xen/scripts/block
+share/examples/xen/scripts/hotplugpath.sh
+@comment share/examples/xen/scripts/qemu-ifup
+share/examples/xen/scripts/vif-bridge
+share/examples/xen/scripts/vif-ip
+share/examples/xen/xend-config.sxp
+share/examples/xen/xend-pci-permissive.sxp
+share/examples/xen/xend-pci-quirks.sxp
+share/examples/xen/xl.conf
+share/examples/xen/xl.sh
+share/examples/xen/xlexample.hvm
+share/examples/xen/xlexample.pvlinux
+share/examples/xen/xm-config.xml
+share/examples/xen/xmexample.hvm
+share/examples/xen/xmexample.hvm-stubdom
+share/examples/xen/xmexample.nbd
+share/examples/xen/xmexample.pv-grub
+share/examples/xen/xmexample.vti
+share/examples/xen/xmexample1
+share/examples/xen/xmexample2
+share/examples/xen/xmexample3
+share/xen/create.dtd
+@comment share/xen/qemu/bamboo.dtb
+@comment share/xen/qemu/bios.bin
+@comment share/xen/qemu/keymaps/ar
+@comment share/xen/qemu/keymaps/common
+@comment share/xen/qemu/keymaps/da
+@comment share/xen/qemu/keymaps/de
+@comment share/xen/qemu/keymaps/de-ch
+@comment share/xen/qemu/keymaps/en-gb
+@comment share/xen/qemu/keymaps/en-us
+@comment share/xen/qemu/keymaps/es
+@comment share/xen/qemu/keymaps/et
+@comment share/xen/qemu/keymaps/fi
+@comment share/xen/qemu/keymaps/fo
+@comment share/xen/qemu/keymaps/fr
+@comment share/xen/qemu/keymaps/fr-be
+@comment share/xen/qemu/keymaps/fr-ca
+@comment share/xen/qemu/keymaps/fr-ch
+@comment share/xen/qemu/keymaps/hr
+@comment share/xen/qemu/keymaps/hu
+@comment share/xen/qemu/keymaps/is
+@comment share/xen/qemu/keymaps/it
+@comment share/xen/qemu/keymaps/ja
+@comment share/xen/qemu/keymaps/lt
+@comment share/xen/qemu/keymaps/lv
+@comment share/xen/qemu/keymaps/mk
+@comment share/xen/qemu/keymaps/modifiers
+@comment share/xen/qemu/keymaps/nl
+@comment share/xen/qemu/keymaps/nl-be
+@comment share/xen/qemu/keymaps/no
+@comment share/xen/qemu/keymaps/pl
+@comment share/xen/qemu/keymaps/pt
+@comment share/xen/qemu/keymaps/pt-br
+@comment share/xen/qemu/keymaps/ru
+@comment share/xen/qemu/keymaps/sl
+@comment share/xen/qemu/keymaps/sv
+@comment share/xen/qemu/keymaps/th
+@comment share/xen/qemu/keymaps/tr
+@comment share/xen/qemu/openbios-ppc
+@comment share/xen/qemu/openbios-sparc32
+@comment share/xen/qemu/openbios-sparc64
+@comment share/xen/qemu/ppc_rom.bin
+@comment share/xen/qemu/pxe-e1000.bin
+@comment share/xen/qemu/pxe-ne2k_pci.bin
+@comment share/xen/qemu/pxe-pcnet.bin
+@comment share/xen/qemu/pxe-rtl8139.bin
+@comment share/xen/qemu/vgabios-cirrus.bin
+@comment share/xen/qemu/vgabios.bin
+@comment share/xen/qemu/video.x
+@pkgdir share/examples/xen/auto
diff --git a/sysutils/xentools42/TODO b/sysutils/xentools42/TODO
new file mode 100644
index 00000000000..63fa18b5829
--- /dev/null
+++ b/sysutils/xentools42/TODO
@@ -0,0 +1,7 @@
+- remove all #XXX
+- get qemu going
+- fix grant table stuff
+- get xenapi functioning
+- figure out why xl hangs in kernel if daemons aren't running
+- find out why xl can't create domains if xenbackendd has ever been run
+- find and add support for any new features
diff --git a/sysutils/xentools42/distinfo b/sysutils/xentools42/distinfo
new file mode 100644
index 00000000000..325858b2089
--- /dev/null
+++ b/sysutils/xentools42/distinfo
@@ -0,0 +1,59 @@
+$NetBSD: distinfo,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+SHA1 (ipxe-git-v1.0.0.tar.gz) = da052c8de5f3485fe0253c19cf52ed6d72528485
+RMD160 (ipxe-git-v1.0.0.tar.gz) = dcd9b6eaafa1ce05c1ebf2a15f2f73ad7a8c5547
+Size (ipxe-git-v1.0.0.tar.gz) = 1996881 bytes
+SHA1 (xen-4.2.2.tar.gz) = b48cc7f375e9a5d65ff2d680f1b512dbea5a3b7c
+RMD160 (xen-4.2.2.tar.gz) = 925cb2abdd080254a5457d1b304f811036261ab6
+Size (xen-4.2.2.tar.gz) = 15602746 bytes
+SHA1 (patch-.._.._ipxe_src_arch_i386_include_librm.h) = 4549ac641b112321b4731a918d85219c3fce6808
+SHA1 (patch-.._.._ipxe_src_core_settings.c) = 240ff973757403b983f12b2cbed826584c4a8aba
+SHA1 (patch-.._.._ipxe_src_net_tls.c) = c0cfbc2ab2b92c659c146601c4f80d58c951ca62
+SHA1 (patch-.._Config.mk) = ec5ba76be10e43cb1b2d37686e35d5fb81d8de80
+SHA1 (patch-.._config_NetBSD.mk) = 90893326dcce4e3e2ef273f22ec5ddf5af0f7cd8
+SHA1 (patch-.._config_StdGNU.mk) = 3f93999038bd9d25277803cd1d969dc5733b593f
+SHA1 (patch-.._docs_man_xend-config.sxp.pod.5) = 36afc7b063f83adfe5b927ed0be586b102684020
+SHA1 (patch-.._docs_man_xl.cfg.pod.5) = b9d19131ffb8a917a92c9878b86ea3dbc16dc0c8
+SHA1 (patch-.._docs_man_xl.conf.pod.5) = 4009ff6aefb0a770ed42d096117dc97f8f55997f
+SHA1 (patch-.._docs_man_xl.pod.1) = bd6272abed11c60c7c5ae88ae54377a3bfb921ed
+SHA1 (patch-.._docs_man_xlcpupool.cfg.pod.5) = a693a79a1f1c16548f62f7da1fa58fa28030990f
+SHA1 (patch-.._docs_man_xm.pod.1) = 975b7570da4bf9fd9cb79539fbd36b8dfbcbd571
+SHA1 (patch-.._docs_man_xmdomain.cfg.pod.5) = 5563a72e203e789a86f4166c71ddb3fcff5215c6
+SHA1 (patch-Makefile) = 8476e65d5bdf257cdf09d98b90820c82cb0ff719
+SHA1 (patch-blktap_drivers_Makefile) = 0906a5ec3a7450fc987b01289e2560e60966d00d
+SHA1 (patch-configure) = 7bf4183efb76bded94a9519bf2737fb1240ab0e7
+SHA1 (patch-examples_Makefile) = 8e89fab7817785b32d79ec0cad3a2645c6981f01
+SHA1 (patch-examples_xend-config.sxp) = 5eb15470bff85d30b6d26d8fe094f59fc8e34175
+SHA1 (patch-firmware_etherboot_Makefile) = 1cb31183853c6069dafe47db8430e0577b21408e
+SHA1 (patch-firmware_etherboot_patches_boot__prompt__option.patch) = 7d14b60557b1e81de370b21544cd49643fa15f08
+SHA1 (patch-firmware_etherboot_patches_series) = cb653834fe14ff0b23fdfa525a20d3bcfe6e3819
+SHA1 (patch-firmware_hvmloader_Makefile) = 7d907fa33fa1f121b3d54116d905855529a020fd
+SHA1 (patch-hotplug_NetBSD_Makefile) = ab91c41ef6bbdd7f7f3d992b9f81e43056a765e2
+SHA1 (patch-hotplug_NetBSD_vif-bridge) = 663d0117612730960fd610b863d863d3abeea460
+SHA1 (patch-hotplug_NetBSD_vif-ip) = c8fa179f58f1e550ab64901afd4fca53c3d11ceb
+SHA1 (patch-hotplug_common_Makefile) = 288b1fe2565c1d4ded551bf159c068504ecab470
+SHA1 (patch-include_xen-sys_NetBSD_gntdev.h) = 25c99a428fda6dee709888ddbcfdcfef5f654564
+SHA1 (patch-libfsimage_common_Makefile) = c3cc5335a1d6b066307c5f03fe72f513a9eb2bdb
+SHA1 (patch-libxc_xc__netbsd.c) = c94a2f7b38bfc1479401acf1bb124251bb4e3fcf
+SHA1 (patch-libxl_libxl__create.c) = a212b3760f1bb796c6f126e5c795154f4e8030e2
+SHA1 (patch-libxl_libxl__internal.h) = f8ff92400f7ba7858cc1963b11c1e8ee23d4e51f
+SHA1 (patch-ocaml_common.make) = c59d32301198d65691ab23529dd791de5ac40199
+SHA1 (patch-ocaml_xenstored_define.ml) = 044144295c2818a71c14dffc9c58f8592b222b0c
+SHA1 (patch-ocaml_xenstored_utils.ml) = cc792a696743fa348b274b1c23783ea1a0d7da47
+SHA1 (patch-python_xen_xend_XendNode.py) = 2c65e4b4b85e91e92dfb3aa402ebc44694bdff06
+SHA1 (patch-python_xen_xend_osdep.py) = 8da6bba38bd7677ea829ca35058f7d2d1d7acad4
+SHA1 (patch-python_xen_xm_create.py) = 7b25b3b3a8d58effae395d776f2a4b94d79acfcb
+SHA1 (patch-qemu-xen-traditional_Makefile) = 0fcd7d5342269e87f14ff76be05d8757151438bc
+SHA1 (patch-qemu-xen-traditional_block-raw-posix.c) = 6376edcc57313c2ffe9bb3d88043d160d1f644ec
+SHA1 (patch-qemu-xen-traditional_configure) = 8b14e6932441d0666092ef4f63d0acd99db0df51
+SHA1 (patch-qemu-xen-traditional_hw_e1000.c) = a8faf95491867c19471690ae98df93ff1d73114a
+SHA1 (patch-qemu-xen-traditional_hw_ide.c) = d562c36627e861658e7a1d52514e59368871cbdb
+SHA1 (patch-qemu-xen-traditional_hw_pass-through.c) = d1f3a1842c595e2d261b997bac02bb71de41eaac
+SHA1 (patch-qemu-xen-traditional_hw_pass-through.h) = 765cfbb30bdcf9c212bd7f9aa00d19d723da496e
+SHA1 (patch-qemu-xen-traditional_hw_piix4acpi.c) = bd89d2da04e2b816a097d4eb6d18936e5fe6bceb
+SHA1 (patch-qemu-xen-traditional_hw_pt-graphics.c) = 5484b9ec7d673502d73b0e4802969940eacad218
+SHA1 (patch-qemu-xen-traditional_hw_pt-msi.c) = 7281d62de494fbbb6508818c9f8c5cfc212c77d8
+SHA1 (patch-qemu-xen-traditional_hw_pt-msi.h) = a33b6ed927db0204c25a9f6ff1bb8870c765f8ad
+SHA1 (patch-qemu-xen-traditional_i386-dm_hookstarget.mak) = 7d526e8a9a0b0daf7215c54a036f7a3306291589
+SHA1 (patch-qemu-xen-traditional_xen-hooks.mak) = 7acec9c981d18e1b659efc1d8e7c5c3b90d45411
+SHA1 (patch-xentrace_Makefile) = 9b53ba4a809dad7a1de34c8fa0dbe493d7256ada
diff --git a/sysutils/xentools42/files/blk_netbsd.c b/sysutils/xentools42/files/blk_netbsd.c
new file mode 100644
index 00000000000..7ba8d407db3
--- /dev/null
+++ b/sysutils/xentools42/files/blk_netbsd.c
@@ -0,0 +1,38 @@
+#include <inttypes.h>
+#include <sys/ioctl.h>
+#include <sys/disklabel.h>
+#include "tapdisk.h"
+#include "blk.h"
+
+int blk_getimagesize(int fd, uint64_t *size)
+{
+ int rc;
+ struct disklabel dl;
+
+ *size = 0;
+ rc = ioctl(fd, DIOCGDINFO, &dl);
+ if (rc) {
+ DPRINTF("ERR: DIOCGDINFO failed, couldn't stat image");
+ return -EINVAL;
+ }
+
+ *size = dl.d_secsize * dl.d_secpercyl;
+
+ return 0;
+}
+
+int blk_getsectorsize(int fd, uint64_t *sector_size)
+{
+ int rc;
+ struct disklabel dl;
+
+ *sector_size = DEV_BSIZE;
+ rc = ioctl(fd, DIOCGDINFO, &dl);
+ if (rc) {
+ DPRINTF("ERR: DIOCGDINFO failed, couldn't stat image");
+ return 0; /* fallback to DEV_BSIZE */
+ }
+
+ *sector_size = dl.d_secsize;
+ return 0;
+}
diff --git a/sysutils/xentools42/files/blktapctrl_netbsd.c b/sysutils/xentools42/files/blktapctrl_netbsd.c
new file mode 100644
index 00000000000..02a1e9f3018
--- /dev/null
+++ b/sysutils/xentools42/files/blktapctrl_netbsd.c
@@ -0,0 +1,16 @@
+
+#include "blktaplib.h"
+#include "blktapctrl.h"
+
+
+int blktap_interface_open(void)
+{
+ /* not yet implemented */
+ return -1;
+}
+
+int blktap_interface_create(int ctlfd, int *major, int *minor, blkif_t *blkif)
+{
+ /* not yet implemented */
+ return -1;
+}
diff --git a/sysutils/xentools42/files/xen-watchdog.sh b/sysutils/xentools42/files/xen-watchdog.sh
new file mode 100644
index 00000000000..4d2a96b24ce
--- /dev/null
+++ b/sysutils/xentools42/files/xen-watchdog.sh
@@ -0,0 +1,17 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: xen-watchdog
+# REQUIRE: DAEMON
+#
+# description: Run domain watchdog daemon
+#
+
+. /etc/rc.subr
+
+name="xenwatchdog"
+rcvar=$name
+command="@PREFIX@/sbin/xenwatchdogd"
+start_cmd="echo Starting ${name}. && PATH=${PATH}:@PREFIX@/sbin ${command} 30 15"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/xentools42/files/xencommons.sh b/sysutils/xentools42/files/xencommons.sh
new file mode 100644
index 00000000000..711ec84329d
--- /dev/null
+++ b/sysutils/xentools42/files/xencommons.sh
@@ -0,0 +1,102 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: xencommons
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="xencommons"
+rcvar=$name
+start_precmd="xen_precmd"
+start_cmd="xen_startcmd"
+stop_cmd="xen_stop"
+status_cmd="xen_status"
+extra_commands="status"
+required_files="/kern/xen/privcmd"
+
+XENSTORED_PIDFILE="/var/run/xenstored.pid"
+XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
+
+BINDIR=@PREFIX@/bin
+SBINDIR=@PREFIX@/sbin
+
+xen_precmd()
+{
+ mkdir -p /var/run/xenstored || exit 1
+}
+
+xen_startcmd()
+{
+ printf "Starting xenservices: xenstored, xenconsoled.\n"
+ XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
+ if [ -n "${XENSTORED_TRACE}" ]; then
+ XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log"
+ fi
+
+ ${SBINDIR}/xenstored ${XENSTORED_ARGS}
+ sleep 5
+
+ printf "Setting domain 0 name...\n"
+ ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
+
+ XENCONSOLED_ARGS=""
+ if [ -n "${XENCONSOLED_TRACE}" ]; then
+ XENCONSOLED_ARGS="${XENCONSOLED_ARGS} --log=${XENCONSOLED_TRACE}"
+ fi
+
+ ${SBINDIR}/xenconsoled ${XENCONSOLED_ARGS}
+}
+
+xen_stop()
+{
+ pids=""
+ printf "Stopping xencommons"
+
+ rc_pid=$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconsoled)
+ pids="$pids $rc_pid"
+ rc_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored)
+ pids="$pids $rc_pid"
+
+ kill -${sig_stop:-TERM} $pids
+ wait_for_pids $pids
+
+ printf ".\n"
+}
+
+xen_status()
+{
+ xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored)
+ if test -n ${xenstored_pid}; then
+ pids="$pids $xenstored_pid"
+ fi
+
+ xenconsoled_pid=$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconsoled)
+ if test -n ${xenconsoled_pid}; then
+ pids="$pids $xenconsoled_pid"
+ fi
+
+ if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
+ then
+ echo "xencommons are running as pids $pids."
+ return 0
+ fi
+ if test -a -z "$xenconsoled_pid" -a -z "$xenstored_pid";
+ then
+ echo "xencommons are not running."
+ return 0
+ fi
+
+ if test -n "$xenstored_pid"; then
+ echo "xenstored is running as pid $xenstored_pid."
+ else
+ echo "xenstored is not running."
+ fi
+ if test -n "$xenconsoled_pid"; then
+ echo "xenconsoled is running as pid $xenconsoled_pid."
+ else
+ echo "xenconsoled is not running."
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/xentools42/files/xend.sh b/sysutils/xentools42/files/xend.sh
new file mode 100644
index 00000000000..76cddcf12ed
--- /dev/null
+++ b/sysutils/xentools42/files/xend.sh
@@ -0,0 +1,102 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: xend
+# REQUIRE: xencommons
+
+. /etc/rc.subr
+
+name="xend"
+rcvar=$name
+command_interpreter="@RCD_INTERPRETER@"
+start_precmd="xen_precmd"
+start_cmd="xen_startcmd"
+stop_cmd="xen_stop"
+status_cmd="xen_status"
+extra_commands="status"
+required_files="/kern/xen/privcmd"
+
+XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
+XEND_PIDFILE="/var/run/xend.pid"
+
+SBINDIR=@PREFIX@/sbin
+
+xen_precmd()
+{
+ mkdir -p /var/run/xend || exit 1
+ mkdir -p /var/run/xend/boot || exit 1
+}
+
+xen_startcmd()
+{
+ printf "Starting xendservices: xenbackendd, xend.\n"
+ XENBACKENDD_ARGS=""
+ if [ -n "${XENBACKENDD_DEBUG}" ]; then
+ XENBACKENDD_ARGS="${XENBACKENDD_ARGS} -d"
+ fi
+
+ ${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS}
+
+ XEND_ARGS=""
+ if [ -n "${XEND_DEBUG}" ]; then
+ XEND_ARGS="${XEND_ARGS} trace_start"
+ else
+ XEND_ARGS="${XEND_ARGS} start"
+ fi
+
+ ${SBINDIR}/xend ${XEND_ARGS}
+}
+
+xen_stop()
+{
+ pids=""
+ printf "Stopping xendservices"
+
+ ${SBINDIR}/xend stop
+
+ rc_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
+ pids="$pids $rc_pid"
+
+ kill -${sig_stop:-TERM} $pids
+ wait_for_pids $pids
+
+ printf ".\n"
+}
+
+xen_status()
+{
+ xenbackendd_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
+ if test -n ${xenbackend_pid}; then
+ pids="$pids $xenbackend_pid"
+ fi
+
+ xend_pid=$(check_pidfile ${XEND_PIDFILE} ${SBINDIR}/xend)
+ if test -n ${xend_pid}; then
+ pids="$pids $xenbackend_pid"
+ fi
+
+ if test -n "$xend_pid" -a -n "$xenbackendd_pid";
+ then
+ echo "xends are running as pids $pids."
+ return 0
+ fi
+ if test -z "$xend_pid" -a -z "$xenbackendd_pid";
+ then
+ echo "xends are not running."
+ return 0
+ fi
+
+ if test -n "$xenbackend_pid"; then
+ echo "xenbackendd is running as pid $xenbackend_pid."
+ else
+ echo "xenbackendd is not running."
+ fi
+
+ if test -n "$xend_pid"; then
+ echo "xend is running as pid $xend_pid."
+ else
+ echo "xend is not running."
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/sysutils/xentools42/files/xendomains.sh b/sysutils/xentools42/files/xendomains.sh
new file mode 100644
index 00000000000..5af00c4ee9d
--- /dev/null
+++ b/sysutils/xentools42/files/xendomains.sh
@@ -0,0 +1,129 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: xendomains
+# REQUIRE: xend
+# KEYWORD: shutdown
+#
+# xendomains This required variable is a whitespace-separated
+# list of domains, e.g., xendomains="dom1 dom2 dom3".
+#
+# xendomains_config This optional variable is a format string that
+# represents the path to the configuration file for
+# each domain. "%s" is substituted with the name of
+# the domain. The default is "@PKG_SYSCONFDIR@/%s".
+#
+# xendomains_prehook This optional variable is a format string that
+# represents the command to run, if it exists, before
+# starting each domain. "%s" is substituted with the
+# name of the domain. The default is
+# "@PKG_SYSCONFDIR@/%s-pre".
+#
+# xendomains_posthook This optional variable is a format string that
+# represents the command to run, if it exists, after
+# stopping each domain. "%s" is substituted with the
+# name of the domain. The default is
+# "@PKG_SYSCONFDIR@/%s-post".
+#
+
+. /etc/rc.subr
+
+name="xendomains"
+ctl_command="@PREFIX@/sbin/xl"
+start_cmd="xendomains_start"
+stop_cmd="xendomains_stop"
+list_cmd="xendomains_list"
+extra_commands="list"
+required_files="/kern/xen/privcmd"
+
+xendomains_start()
+{
+ [ -n "$xendomains" ] || return
+
+ echo "Starting xen domains."
+ for domain in $xendomains; do
+ case "$domain" in
+ "") continue ;;
+ esac
+
+ # Start off by running the pre-hook script if it's present.
+ if [ -n "${xendomains_prehook}" ]; then
+ cmdline=`printf "${xendomains_prehook}" $domain`
+ cmd="${cmdline%% *}"
+ if [ -x "$cmd" ]; then
+ if ! $cmdline; then
+ echo "Pre-hook \`\`$cmdline'' failed... skipping $domain."
+ continue
+ fi
+ fi
+ fi
+
+ # Ask xend to create the domain.
+ if [ -n "${xendomains_config}" ]; then
+ file=`printf "${xendomains_config}" $domain`
+ if [ -f "$file" ]; then
+ ${ctl_command} create "$file"
+ fi
+ fi
+ done
+}
+
+xendomains_list() {
+ # Output a whitespace-separated list of live guest domains.
+ ${ctl_command} list | awk '
+ (FNR <= 2) { next }
+ ($5 !~ /s/) { s = s " " $1 }
+ END { sub(" *", "", s); print s }'
+}
+
+xendomains_stop()
+{
+ # Determine an appropriate timeout waiting for all domains to
+ # stop -- always wait at least 60s, and add 5s per active domain.
+ #
+ numdomains=$(xendomains_list | awk '{ print NF }')
+ [ $numdomains -gt 0 ] || return
+ timeout=$((60 + numdomains * 5))
+
+ # Ask xend to stop every domain, and poll xend every 10s up to the
+ # timeout period to check if all the domains are stopped. We
+ # consider a domain in the "s" (shutdown) state to be stopped.
+ #
+ echo "Stopping xen domains."
+ for domain in $(xendomains_list); do
+ ${ctl_command} shutdown $domain
+ done
+ while [ $timeout -gt 0 ]; do
+ livedomains=$(xendomains_list)
+ [ -n "$livedomains" ] || break
+ timeout=$((timeout - 10))
+ sleep 10
+ done
+ livedomains=$(xendomains_list)
+ if [ -n "$livedomains" ]; then
+ echo "Failed to stop: $livedomains"
+ else
+ echo "All domains stopped."
+ fi
+
+ # Finish off by running the post-hook script if it's present.
+ for domain in $xendomains; do
+ case "$domain" in
+ "") continue ;;
+ esac
+ if [ -n "${xendomains_posthook}" ]; then
+ cmdline=`printf "${xendomains_posthook}" $domain`
+ cmd="${cmdline%% *}"
+ if [ -x "$cmd" ]; then
+ $cmdline || echo "Post-hook \`\`$cmdline'' failed."
+ fi
+ fi
+ done
+}
+
+load_rc_config $name
+
+: ${xendomains_config="@PKG_SYSCONFDIR@/%s"}
+: ${xendomains_prehook="@PKG_SYSCONFDIR@/%s-pre"}
+: ${xendomains_posthook="@PKG_SYSCONFDIR@/%s-post"}
+
+run_rc_command "$1"
diff --git a/sysutils/xentools42/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h b/sysutils/xentools42/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h
new file mode 100644
index 00000000000..d84f6683e09
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._.._ipxe_src_arch_i386_include_librm.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-.._.._ipxe_src_arch_i386_include_librm.h,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../../ipxe/src/arch/i386/include/librm.h.orig 2010-02-02 16:12:44.000000000 +0000
++++ ../../ipxe/src/arch/i386/include/librm.h
+@@ -122,8 +122,9 @@ extern char *text16;
+ _data16_ ## variable __asm__ ( #variable )
+
+ #define __bss16_array( variable, array ) \
+- __attribute__ (( section ( ".bss16" ) )) \
+- _data16_ ## variable array __asm__ ( #variable )
++ _data16_ ## variable array \
++ __asm__ ( #variable ) \
++ __attribute__ (( section ( ".bss16" ) ))
+
+ #define __text16( variable ) \
+ __attribute__ (( section ( ".text16.data" ) )) \
diff --git a/sysutils/xentools42/patches/patch-.._.._ipxe_src_core_settings.c b/sysutils/xentools42/patches/patch-.._.._ipxe_src_core_settings.c
new file mode 100644
index 00000000000..5cb329e0520
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._.._ipxe_src_core_settings.c
@@ -0,0 +1,34 @@
+$NetBSD: patch-.._.._ipxe_src_core_settings.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../../ipxe/src/core/settings.c.orig 2013-03-25 18:48:57.000000000 +0000
++++ ../../ipxe/src/core/settings.c
+@@ -263,10 +263,12 @@ static struct settings * find_child_sett
+ */
+ static struct settings * autovivify_child_settings ( struct settings *parent,
+ const char *name ) {
++ size_t nlen = strlen ( name ) + 1 /* NUL */;
+ struct {
+ struct generic_settings generic;
+- char name[ strlen ( name ) + 1 /* NUL */ ];
++ char name[];
+ } *new_child;
++ size_t tlen = sizeof(*new_child) + nlen;
+ struct settings *settings;
+
+ /* Return existing settings, if existent */
+@@ -274,13 +276,13 @@ static struct settings * autovivify_chil
+ return settings;
+
+ /* Create new generic settings block */
+- new_child = zalloc ( sizeof ( *new_child ) );
++ new_child = zalloc ( tlen );
+ if ( ! new_child ) {
+ DBGC ( parent, "Settings %p could not create child %s\n",
+ parent, name );
+ return NULL;
+ }
+- memcpy ( new_child->name, name, sizeof ( new_child->name ) );
++ memcpy ( new_child->name, name, nlen );
+ generic_settings_init ( &new_child->generic, NULL, new_child->name );
+ settings = &new_child->generic.settings;
+ register_settings ( settings, parent );
diff --git a/sysutils/xentools42/patches/patch-.._.._ipxe_src_net_tls.c b/sysutils/xentools42/patches/patch-.._.._ipxe_src_net_tls.c
new file mode 100644
index 00000000000..040aa75b5d0
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._.._ipxe_src_net_tls.c
@@ -0,0 +1,69 @@
+$NetBSD: patch-.._.._ipxe_src_net_tls.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../../ipxe/src/net/tls.c.orig 2013-03-25 18:53:57.000000000 +0000
++++ ../../ipxe/src/net/tls.c
+@@ -650,18 +650,22 @@ static int tls_send_client_key_exchange
+ RSA_CTX *rsa_ctx;
+ RSA_pub_key_new ( &rsa_ctx, tls->rsa.modulus, tls->rsa.modulus_len,
+ tls->rsa.exponent, tls->rsa.exponent_len );
++ size_t elen = rsa_ctx->num_octets;
+ struct {
+ uint32_t type_length;
+ uint16_t encrypted_pre_master_secret_len;
+- uint8_t encrypted_pre_master_secret[rsa_ctx->num_octets];
+- } __attribute__ (( packed )) key_xchg;
+-
+- memset ( &key_xchg, 0, sizeof ( key_xchg ) );
+- key_xchg.type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) |
+- htonl ( sizeof ( key_xchg ) -
+- sizeof ( key_xchg.type_length ) ) );
+- key_xchg.encrypted_pre_master_secret_len
+- = htons ( sizeof ( key_xchg.encrypted_pre_master_secret ) );
++ uint8_t encrypted_pre_master_secret[];
++ } __attribute__ (( packed )) *key_xchg;
++ size_t klen = sizeof(*key_xchg) + elen;
++
++ key_xchg = alloca(klen);
++
++ memset ( key_xchg, 0, klen );
++ key_xchg->type_length = ( cpu_to_le32 ( TLS_CLIENT_KEY_EXCHANGE ) |
++ htonl ( klen -
++ sizeof ( key_xchg->type_length ) ) );
++ key_xchg->encrypted_pre_master_secret_len
++ = htons ( elen );
+
+ /* FIXME: Hack alert */
+ DBGC ( tls, "RSA encrypting plaintext, modulus, exponent:\n" );
+@@ -671,14 +675,13 @@ static int tls_send_client_key_exchange
+ DBGC_HD ( tls, tls->rsa.exponent, tls->rsa.exponent_len );
+ RSA_encrypt ( rsa_ctx, ( const uint8_t * ) &tls->pre_master_secret,
+ sizeof ( tls->pre_master_secret ),
+- key_xchg.encrypted_pre_master_secret, 0 );
++ key_xchg->encrypted_pre_master_secret, 0 );
+ DBGC ( tls, "RSA encrypt done. Ciphertext:\n" );
+- DBGC_HD ( tls, &key_xchg.encrypted_pre_master_secret,
+- sizeof ( key_xchg.encrypted_pre_master_secret ) );
++ DBGC_HD ( tls, &key_xchg->encrypted_pre_master_secret, elen );
+ RSA_free ( rsa_ctx );
+
+
+- return tls_send_handshake ( tls, &key_xchg, sizeof ( key_xchg ) );
++ return tls_send_handshake ( tls, key_xchg, klen );
+ }
+
+ /**
+@@ -802,12 +805,12 @@ static int tls_new_server_hello ( struct
+ uint8_t session_id_len;
+ char next[0];
+ } __attribute__ (( packed )) *hello_a = data;
++ size_t slen = hello_a->session_id_len;
+ struct {
+- uint8_t session_id[hello_a->session_id_len];
+ uint16_t cipher_suite;
+ uint8_t compression_method;
+ char next[0];
+- } __attribute__ (( packed )) *hello_b = ( void * ) &hello_a->next;
++ } __attribute__ (( packed )) *hello_b = ( void * ) ((uint8_t *)&hello_a->next + slen);
+ void *end = hello_b->next;
+ int rc;
+
diff --git a/sysutils/xentools42/patches/patch-.._Config.mk b/sysutils/xentools42/patches/patch-.._Config.mk
new file mode 100644
index 00000000000..7ba76bcc54c
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._Config.mk
@@ -0,0 +1,22 @@
+$NetBSD: patch-.._Config.mk,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../Config.mk.orig 2012-12-17 15:04:11.000000000 +0000
++++ ../Config.mk
+@@ -25,7 +25,7 @@ SHELL ?= /bin/sh
+ # Tools to run on system hosting the build
+ HOSTCC = gcc
+ HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
+-HOSTCFLAGS += -fno-strict-aliasing
++HOSTCFLAGS += -fno-strict-aliasing ${EXTRA_HOSTCFLAGS}
+
+ DISTDIR ?= $(XEN_ROOT)/dist
+ DESTDIR ?= /
+@@ -163,6 +163,8 @@ CFLAGS += -Wall -Wstrict-prototypes
+ # and is a bit too fierce about unused return values
+ CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value
+
++CFLAGS += ${EXTRA_CFLAGS}
++
+ $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
+ $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
+ $(call cc-option-add,CFLAGS,CC,-Wno-unused-but-set-variable)
diff --git a/sysutils/xentools42/patches/patch-.._config_NetBSD.mk b/sysutils/xentools42/patches/patch-.._config_NetBSD.mk
new file mode 100644
index 00000000000..a936136d500
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._config_NetBSD.mk
@@ -0,0 +1,23 @@
+$NetBSD: patch-.._config_NetBSD.mk,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../config/NetBSD.mk.orig 2011-03-25 11:42:47.000000000 +0100
++++ ../config/NetBSD.mk 2011-04-15 11:36:19.000000000 +0200
+@@ -7,12 +7,13 @@
+ LIBEXEC = $(PREFIX)/libexec
+ PRIVATE_BINDIR = $(BINDIR)
+
++MANDIR = $(PREFIX)/man
++MAN1DIR = $(MANDIR)/man1
++MAN8DIR = $(MANDIR)/man8
++
+ DLOPEN_LIBS =
+
+-ifeq ($(PREFIX),/usr)
+-XEN_LOCK_DIR = /var/lib
+-else
+-XEN_LOCK_DIR = $(PREFIX)/var/lib
+-endif
++XEN_LOCK_DIR = $(VARBASE)/run
++XEN_EXAMPLES_DIR=$(PREFIX)/share/examples/xen
+
+ WGET = ftp
diff --git a/sysutils/xentools42/patches/patch-.._config_StdGNU.mk b/sysutils/xentools42/patches/patch-.._config_StdGNU.mk
new file mode 100644
index 00000000000..b5d847bffcd
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._config_StdGNU.mk
@@ -0,0 +1,23 @@
+$NetBSD: patch-.._config_StdGNU.mk,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+Allow XEN_CONFIG_DIR to be overriden in the environment
+
+--- ../config/StdGNU.mk.orig 2013-04-23 16:42:55.000000000 +0000
++++ ../config/StdGNU.mk
+@@ -51,13 +51,13 @@ XEN_PAGING_DIR = /var/lib/xen/xenpaging
+ else
+ CONFIG_DIR = $(PREFIX)/etc
+ XEN_LOCK_DIR = $(PREFIX)/var/lock
+-XEN_RUN_DIR = $(PREFIX)/var/run/xen
+-XEN_PAGING_DIR = $(PREFIX)/var/lib/xen/xenpaging
++XEN_RUN_DIR = $(VARBASE)/run/xen
++XEN_PAGING_DIR = $(VARBASE)/lib/xen/xenpaging
+ endif
+
+ SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
+
+-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
++XEN_CONFIG_DIR ?= $(CONFIG_DIR)/xen
+ XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
+
+ SOCKET_LIBS =
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xend-config.sxp.pod.5 b/sysutils/xentools42/patches/patch-.._docs_man_xend-config.sxp.pod.5
new file mode 100644
index 00000000000..9c01088f856
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xend-config.sxp.pod.5
@@ -0,0 +1,47 @@
+$NetBSD: patch-.._docs_man_xend-config.sxp.pod.5,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xend-config.sxp.pod.5.orig 2010-04-07 16:12:04.000000000 +0000
++++ ../docs/man/xend-config.sxp.pod.5
+@@ -4,7 +4,7 @@ xend-config.sxp - Xen daemon configurati
+
+ =head1 SYNOPSIS
+
+-/etc/xen/xend-config.sxp
++@XENDCONFDIR@/xend-config.sxp
+
+ =head1 DESCRIPTION
+
+@@ -12,7 +12,7 @@ The xend(1) program requires xend-config
+ parameters which determine the behavior of the daemon at runtime.
+
+ The parameters are specified in S-expression format. See the example
+-configuration file in I</etc/xen/xend-config.sxp> for details.
++configuration file in I<@XENDCONFDIR@/xend-config.sxp> for details.
+
+ =head1 OPTIONS
+
+@@ -82,13 +82,13 @@ Defaults to I<1024>.
+
+ =item I<network-script>
+
+-The name of the script in I</etc/xen/scripts> that will be run to
++The name of the script in I<@XENDCONFDIR@/scripts> that will be run to
+ setup the networking environment. This can be any name, but in
+ general is either I<network-bridge> or I<network-route>.
+
+ =item I<vif-script>
+
+-The name of the script in I</etc/xen/scripts> that will be run to
++The name of the script in I<@XENDCONFDIR@/scripts> that will be run to
+ setup a virtual interface when it is created or destroyed. This needs
+ to (in general) work in unison with the I<network-script>.
+
+@@ -113,7 +113,7 @@ domains should be saved when a crash occ
+
+ The name of an application or script that can handle external device
+ migration, such as for example virtual TPM migration. An example
+-script is I</etc/xen/scripts/external-device-migrate>.
++script is I<@XENDCONFDIR@/scripts/external-device-migrate>.
+
+ =item I<device-create-timeout>
+
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xl.cfg.pod.5 b/sysutils/xentools42/patches/patch-.._docs_man_xl.cfg.pod.5
new file mode 100644
index 00000000000..6abf49a6c9d
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xl.cfg.pod.5
@@ -0,0 +1,29 @@
+$NetBSD: patch-.._docs_man_xl.cfg.pod.5,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xl.cfg.pod.5.orig 2013-04-23 16:42:55.000000000 +0000
++++ ../docs/man/xl.cfg.pod.5
+@@ -4,13 +4,13 @@ xl.cfg - XL Domain Configuration File Sy
+
+ =head1 SYNOPSIS
+
+- /etc/xen/xldomain
++ @XENDCONFDIR@/xldomain
+
+ =head1 DESCRIPTION
+
+ To create a VM (a domain in Xen terminology, sometimes called a guest)
+ with xl requires the provision of a domain config file. Typically
+-these live in `/etc/xen/DOMAIN.cfg` where DOMAIN is the name of the
++these live in `@XENDCONFDIR@/DOMAIN.cfg` where DOMAIN is the name of the
+ domain.
+
+ =head1 SYNTAX
+@@ -1142,7 +1142,7 @@ See L<qemu(1)> for more information.
+
+ =head1 FILES
+
+-F</etc/xen/NAME.cfg>
++F<@XENDCONFDIR@/NAME.cfg>
+ F</var/xen/dump/NAME>
+ F<docs/misc/tscmode.txt>
+
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xl.conf.pod.5 b/sysutils/xentools42/patches/patch-.._docs_man_xl.conf.pod.5
new file mode 100644
index 00000000000..83ceb3c6fd2
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xl.conf.pod.5
@@ -0,0 +1,21 @@
+$NetBSD: patch-.._docs_man_xl.conf.pod.5,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xl.conf.pod.5.orig 2013-04-23 16:42:55.000000000 +0000
++++ ../docs/man/xl.conf.pod.5
+@@ -1,6 +1,6 @@
+ =head1 NAME
+
+-/etc/xen/xl.conf - XL Global/Host Configuration
++@XENDCONFDIR@/xl.conf - XL Global/Host Configuration
+
+ =head1 DESCRIPTION
+
+@@ -74,7 +74,7 @@ Default: C</var/lock/xl>
+
+ Configures the default hotplug script used by virtual network devices.
+
+-Default: C</etc/xen/scripts/vif-bridge>
++Default: C<@XENDCONFDIR@/scripts/vif-bridge>
+
+ =item B<defaultbridge="NAME">
+
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xl.pod.1 b/sysutils/xentools42/patches/patch-.._docs_man_xl.pod.1
new file mode 100644
index 00000000000..86d1144358f
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xl.pod.1
@@ -0,0 +1,35 @@
+$NetBSD: patch-.._docs_man_xl.pod.1,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xl.pod.1.orig 2013-04-23 16:42:55.000000000 +0000
++++ ../docs/man/xl.pod.1
+@@ -34,10 +34,10 @@ each of those subcommands.
+
+ =over 4
+
+-=item start the script B</etc/init.d/xencommons> at boot time
++=item start the script B</etc/rc.d/xencommons> at boot time
+
+ Most B<xl> operations rely upon B<xenstored> and B<xenconsoled>: make
+-sure you start the script B</etc/init.d/xencommons> at boot time to
++sure you start the script B</etc/rc.d/xencommons> at boot time to
+ initialize all the daemons needed by B<xl>.
+
+ =item setup a B<xenbr0> bridge in dom0
+@@ -51,7 +51,7 @@ setup the bridge.
+
+ If you specify the amount of memory dom0 has, passing B<dom0_mem> to
+ Xen, it is highly recommended to disable B<autoballoon>. Edit
+-B</etc/xen/xl.conf> and set it to 0.
++B<@XENDCONFDIR@/xl.conf> and set it to 0.
+
+ =item run xl as B<root>
+
+@@ -157,7 +157,7 @@ B<EXAMPLES>
+
+ xl create DebianLenny
+
+-This creates a domain with the file /etc/xen/DebianLenny, and returns as
++This creates a domain with the file @XENDCONFDIR@/DebianLenny, and returns as
+ soon as it is run.
+
+ =back
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xlcpupool.cfg.pod.5 b/sysutils/xentools42/patches/patch-.._docs_man_xlcpupool.cfg.pod.5
new file mode 100644
index 00000000000..2b3e206c62f
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xlcpupool.cfg.pod.5
@@ -0,0 +1,28 @@
+$NetBSD: patch-.._docs_man_xlcpupool.cfg.pod.5,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xlcpupool.cfg.pod.5.orig 2013-04-23 16:42:55.000000000 +0000
++++ ../docs/man/xlcpupool.cfg.pod.5
+@@ -4,12 +4,12 @@ xlcpupool.cfg - XL Cpupool Configuration
+
+ =head1 SYNOPSIS
+
+- /etc/xen/xlcpupool
++ @XENDCONFDIR@/xlcpupool
+
+ =head1 DESCRIPTION
+
+ To create a Cpupool with xl requires the provision of a cpupool config
+-file. Typically these live in `/etc/xen/CPUPOOL.cfg` where CPUPOOL is
++file. Typically these live in `@XENDCONFDIR@/CPUPOOL.cfg` where CPUPOOL is
+ the name of the cpupool.
+
+ =head1 SYNTAX
+@@ -101,7 +101,7 @@ found will be allocated in the new cpupo
+
+ =head1 FILES
+
+-F</etc/xen/CPUPOOL.cfg>
++F<@XENDCONFDIR@/CPUPOOL.cfg>
+
+ =head1 BUGS
+
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xm.pod.1 b/sysutils/xentools42/patches/patch-.._docs_man_xm.pod.1
new file mode 100644
index 00000000000..da47f3c1bd1
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xm.pod.1
@@ -0,0 +1,31 @@
+$NetBSD: patch-.._docs_man_xm.pod.1,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xm.pod.1.orig 2009-01-05 11:26:58.000000000 +0000
++++ ../docs/man/xm.pod.1
+@@ -75,7 +75,7 @@ in the config file. See L<xmdomain.cfg>
+ format, and possible options used in either the configfile or for I<vars>.
+
+ I<configfile> can either be an absolute path to a file, or a relative
+-path to a file located in /etc/xen.
++path to a file located in @XENDCONFDIR@.
+
+ Create will return B<as soon> as the domain is started. This B<does
+ not> mean the guest OS in the domain has actually booted, or is
+@@ -156,7 +156,7 @@ B<EXAMPLES>
+
+ xm create Fedora4
+
+-This creates a domain with the file /etc/xen/Fedora4, and returns as
++This creates a domain with the file @XENDCONFDIR@/Fedora4, and returns as
+ soon as it is run.
+
+ =item I<without config file>
+@@ -388,7 +388,7 @@ file format, and possible options used i
+ I<vars>.
+
+ I<configfile> can either be an absolute path to a file, or a relative
+-path to a file located in /etc/xen.
++path to a file located in @XENDCONFDIR@.
+
+ The new subcommand will return without starting the domain. The
+ domain needs to be started using the B<xm start> command.
diff --git a/sysutils/xentools42/patches/patch-.._docs_man_xmdomain.cfg.pod.5 b/sysutils/xentools42/patches/patch-.._docs_man_xmdomain.cfg.pod.5
new file mode 100644
index 00000000000..102b094f39f
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-.._docs_man_xmdomain.cfg.pod.5
@@ -0,0 +1,36 @@
+$NetBSD: patch-.._docs_man_xmdomain.cfg.pod.5,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ../docs/man/xmdomain.cfg.pod.5.orig 2008-08-01 16:38:07.000000000 +0200
++++ ../docs/man/xmdomain.cfg.pod.5
+@@ -4,9 +4,9 @@ xmdomain.cfg - xm domain config file for
+
+ =head1 SYNOPSIS
+
+- /etc/xen/myxendomain
+- /etc/xen/myxendomain2
+- /etc/xen/auto/myxenautostarted
++ @XENDCONFDIR@/myxendomain
++ @XENDCONFDIR@/myxendomain2
++ @XENDCONFDIR@/auto/myxenautostarted
+
+ =head1 DESCRIPTION
+
+@@ -14,14 +14,14 @@ The B<xm>(1) program uses python executa
+ domains to create from scratch. Each of these config files needs to
+ contain a number of required options, and may specify many more.
+
+-Domain configuration files live in /etc/xen by default, if you store
++Domain configuration files live in @XENDCONFDIR@ by default, if you store
+ config files anywhere else the full path to the config file must be
+ specified in the I<xm create> command.
+
+-/etc/xen/auto is a special case. Domain config files in that
++@XENDCONFDIR@/auto is a special case. Domain config files in that
+ directory will be started automatically at system boot if the
+-xendomain init script is enabled. The contents of /etc/xen/auto
+-should be symlinks to files in /etc/xen to allow I<xm create> to be
++xendomain init script is enabled. The contents of @XENDCONFDIR@/auto
++should be symlinks to files in @XENDCONFDIR@ to allow I<xm create> to be
+ used without full paths.
+
+ Options are specified by I<name = value> statements in the
diff --git a/sysutils/xentools42/patches/patch-Makefile b/sysutils/xentools42/patches/patch-Makefile
new file mode 100644
index 00000000000..6653d4e691b
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-Makefile
@@ -0,0 +1,52 @@
+$NetBSD: patch-Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- Makefile.orig 2012-12-17 15:00:09.000000000 +0000
++++ Makefile
+@@ -15,28 +15,29 @@ SUBDIRS-y += examples
+ SUBDIRS-y += hotplug
+ SUBDIRS-y += xentrace
+ SUBDIRS-$(CONFIG_XCUTILS) += xcutils
+-SUBDIRS-$(CONFIG_X86) += firmware
++#XXX SUBDIRS-$(CONFIG_X86) += firmware
+ SUBDIRS-y += console
+ SUBDIRS-y += xenmon
+-SUBDIRS-$(VTPM_TOOLS) += vtpm_manager
+-SUBDIRS-$(VTPM_TOOLS) += vtpm
++#XXX SUBDIRS-$(VTPM_TOOLS) += vtpm_manager
++#XXX SUBDIRS-$(VTPM_TOOLS) += vtpm
+ SUBDIRS-y += xenstat
+ SUBDIRS-$(CONFIG_Linux) += $(SUBDIRS-libaio)
+ SUBDIRS-$(CONFIG_Linux) += memshr
+ SUBDIRS-$(CONFIG_Linux) += blktap
+ SUBDIRS-$(CONFIG_Linux) += blktap2
+ SUBDIRS-$(CONFIG_NetBSD) += $(SUBDIRS-libaio)
+-SUBDIRS-$(CONFIG_NetBSD) += blktap2
++SUBDIRS-$(CONFIG_NetBSD) += blktap
++#SUBDIRS-$(CONFIG_NetBSD) += blktap2
+ SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
+ SUBDIRS-y += libfsimage
+ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
+ SUBDIRS-$(CONFIG_Linux) += libvchan
+
+-# do not recurse in to a dir we are about to delete
+-ifneq "$(MAKECMDGOALS)" "distclean"
+-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
+-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
+-endif
++#XXX # do not recurse in to a dir we are about to delete
++#XXX ifneq "$(MAKECMDGOALS)" "distclean"
++#XXX SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
++#XXX SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
++#XXX endif
+
+ SUBDIRS-y += xenpmd
+ SUBDIRS-y += libxl
+@@ -44,7 +45,7 @@ SUBDIRS-y += remus
+ SUBDIRS-$(CONFIG_X86) += xenpaging
+ SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
+ SUBDIRS-$(CONFIG_X86) += debugger/kdd
+-SUBDIRS-$(CONFIG_TESTS) += tests
++#XXX SUBDIRS-$(CONFIG_TESTS) += tests
+
+ # These don't cross-compile
+ ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
diff --git a/sysutils/xentools42/patches/patch-blktap_drivers_Makefile b/sysutils/xentools42/patches/patch-blktap_drivers_Makefile
new file mode 100644
index 00000000000..1f195a74fce
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-blktap_drivers_Makefile
@@ -0,0 +1,16 @@
+$NetBSD: patch-blktap_drivers_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- blktap/drivers/Makefile.orig 2008-08-01 16:38:07.000000000 +0200
++++ blktap/drivers/Makefile
+@@ -37,9 +37,11 @@ BLK-OBJS-y += block-qcow2.o
+ BLK-OBJS-y += aes.o
+ BLK-OBJS-y += tapaio.o
+ BLK-OBJS-$(CONFIG_Linux) += blk_linux.o
++BLK-OBJS-$(CONFIG_NetBSD) += blk_netbsd.o
+
+ BLKTAB-OBJS-y := blktapctrl.o
+ BLKTAB-OBJS-$(CONFIG_Linux) += blktapctrl_linux.o
++BLKTAB-OBJS-$(CONFIG_NetBSD) += blktapctrl_netbsd.o
+
+ all: $(IBIN) qcow-util
+
diff --git a/sysutils/xentools42/patches/patch-configure b/sysutils/xentools42/patches/patch-configure
new file mode 100644
index 00000000000..629583218ab
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-configure
@@ -0,0 +1,103 @@
+$NetBSD: patch-configure,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- configure.orig 2012-12-17 15:00:12.000000000 +0000
++++ configure
+@@ -3719,7 +3719,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${PERL}" == x"no"
++if test x"${PERL}" = x"no"
+ then
+ as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
+ fi
+@@ -3766,7 +3766,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${CURL}" == x"no"
++if test x"${CURL}" = x"no"
+ then
+ as_fn_error $? "Unable to find curl-config, please install curl-config" "$LINENO" 5
+ fi
+@@ -3811,7 +3811,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${XML}" == x"no"
++if test x"${XML}" = x"no"
+ then
+ as_fn_error $? "Unable to find xml2-config, please install xml2-config" "$LINENO" 5
+ fi
+@@ -4869,7 +4869,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${BASH}" == x"no"
++if test x"${BASH}" = x"no"
+ then
+ as_fn_error $? "Unable to find bash, please install bash" "$LINENO" 5
+ fi
+@@ -4924,7 +4924,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${PYTHONPATH}" == x"no"
++if test x"${PYTHONPATH}" = x"no"
+ then
+ as_fn_error $? "Unable to find $PYTHON, please install $PYTHON" "$LINENO" 5
+ fi
+@@ -5385,7 +5385,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"$pyconfig" == x"no"; then :
++if test x"$pyconfig" = x"no"; then :
+
+ CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+ print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+@@ -5511,7 +5511,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${XGETTEXT}" == x"no"
++if test x"${XGETTEXT}" = x"no"
+ then
+ as_fn_error $? "Unable to find xgettext, please install xgettext" "$LINENO" 5
+ fi
+@@ -5558,7 +5558,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${AS86}" == x"no"
++if test x"${AS86}" = x"no"
+ then
+ as_fn_error $? "Unable to find as86, please install as86" "$LINENO" 5
+ fi
+@@ -5603,7 +5603,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${LD86}" == x"no"
++if test x"${LD86}" = x"no"
+ then
+ as_fn_error $? "Unable to find ld86, please install ld86" "$LINENO" 5
+ fi
+@@ -5648,7 +5648,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${BCC}" == x"no"
++if test x"${BCC}" = x"no"
+ then
+ as_fn_error $? "Unable to find bcc, please install bcc" "$LINENO" 5
+ fi
+@@ -5693,7 +5693,7 @@ $as_echo "no" >&6; }
+ fi
+
+
+-if test x"${IASL}" == x"no"
++if test x"${IASL}" = x"no"
+ then
+ as_fn_error $? "Unable to find iasl, please install iasl" "$LINENO" 5
+ fi
diff --git a/sysutils/xentools42/patches/patch-examples_Makefile b/sysutils/xentools42/patches/patch-examples_Makefile
new file mode 100644
index 00000000000..55c9ee578bd
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-examples_Makefile
@@ -0,0 +1,11 @@
+$NetBSD: patch-examples_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- examples/Makefile.orig 2011-10-20 19:05:41.000000000 +0200
++++ examples/Makefile 2011-10-26 13:55:46.000000000 +0200
+@@ -1,5 +1,6 @@
+ XEN_ROOT = $(CURDIR)/../..
+ include $(XEN_ROOT)/tools/Rules.mk
++XEN_CONFIG_DIR=${EGDIR}
+
+ # Init scripts.
+ XEND_INITD = init.d/xend
diff --git a/sysutils/xentools42/patches/patch-examples_xend-config.sxp b/sysutils/xentools42/patches/patch-examples_xend-config.sxp
new file mode 100644
index 00000000000..2f68bab7335
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-examples_xend-config.sxp
@@ -0,0 +1,13 @@
+$NetBSD: patch-examples_xend-config.sxp,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- examples/xend-config.sxp.orig 2010-04-07 16:12:04.000000000 +0000
++++ examples/xend-config.sxp
+@@ -190,7 +190,7 @@
+
+ # Whether to enable auto-ballooning of dom0 to allow domUs to be created.
+ # If enable-dom0-ballooning = no, dom0 will never balloon out.
+-(enable-dom0-ballooning yes)
++(enable-dom0-ballooning no)
+
+ # 32-bit paravirtual domains can only consume physical
+ # memory below 168GB. On systems with memory beyond that address,
diff --git a/sysutils/xentools42/patches/patch-firmware_etherboot_Makefile b/sysutils/xentools42/patches/patch-firmware_etherboot_Makefile
new file mode 100644
index 00000000000..e31c859ed05
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-firmware_etherboot_Makefile
@@ -0,0 +1,26 @@
+$NetBSD: patch-firmware_etherboot_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- firmware/etherboot/Makefile.orig 2012-12-17 15:00:24.000000000 +0000
++++ firmware/etherboot/Makefile
+@@ -27,18 +27,10 @@ all: $(ROMS)
+ %.rom: $D/src/arch/i386/Makefile
+ $(MAKE) -C $D/src bin/$(*F).rom
+
+-$T:
+- if ! wget -O _$T $(IPXE_TARBALL_URL); then \
+- $(GIT) clone $(IPXE_GIT_URL) $D.git; \
+- (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \
+- $(IPXE_GIT_TAG) | gzip >../_$T); \
+- rm -rf $D.git; \
+- fi
+- mv _$T $T
++$D:
++ ln -sf $(WRKSRC)/../../ipxe $D
+
+-$D/src/arch/i386/Makefile: $T Config
+- rm -rf $D
+- gzip -dc $T | tar xf -
++$D/src/arch/i386/Makefile: $D Config
+ for i in $$(cat patches/series) ; do \
+ patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \
+ done
diff --git a/sysutils/xentools42/patches/patch-firmware_etherboot_patches_boot__prompt__option.patch b/sysutils/xentools42/patches/patch-firmware_etherboot_patches_boot__prompt__option.patch
new file mode 100644
index 00000000000..26e69672ccb
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-firmware_etherboot_patches_boot__prompt__option.patch
@@ -0,0 +1,13 @@
+$NetBSD: patch-firmware_etherboot_patches_boot__prompt__option.patch,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- firmware/etherboot/patches/boot_prompt_option.patch.orig 2012-12-17 15:00:24.000000000 +0000
++++ firmware/etherboot/patches/boot_prompt_option.patch
+@@ -13,7 +13,7 @@ index 0f92415..cce7505 100644
+ @@ -418,6 +419,7 @@ no_pmm:
+ pushw %cs
+ call exec
+- 2:
++ out:
+ +#endif
+ /* Restore registers */
+ popw %gs
diff --git a/sysutils/xentools42/patches/patch-firmware_etherboot_patches_series b/sysutils/xentools42/patches/patch-firmware_etherboot_patches_series
new file mode 100644
index 00000000000..ba7c4fcc2b0
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-firmware_etherboot_patches_series
@@ -0,0 +1,9 @@
+$NetBSD: patch-firmware_etherboot_patches_series,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- firmware/etherboot/patches/series.orig 2012-12-17 15:00:24.000000000 +0000
++++ firmware/etherboot/patches/series
+@@ -1,4 +1,3 @@
+ boot_prompt_option.patch
+ build_fix_1.patch
+ build_fix_2.patch
+-build_fix_3.patch
diff --git a/sysutils/xentools42/patches/patch-firmware_hvmloader_Makefile b/sysutils/xentools42/patches/patch-firmware_hvmloader_Makefile
new file mode 100644
index 00000000000..35fdaecf1cb
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-firmware_hvmloader_Makefile
@@ -0,0 +1,13 @@
+$NetBSD: patch-firmware_hvmloader_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- firmware/hvmloader/Makefile.orig 2012-12-17 15:00:24.000000000 +0000
++++ firmware/hvmloader/Makefile
+@@ -26,7 +26,7 @@ SUBDIRS := acpi
+ # The HVM loader is started in 32-bit mode at the address below:
+ LOADADDR = 0x100000
+
+-CFLAGS += $(CFLAGS_xeninclude)
++CFLAGS += $(CFLAGS_xeninclude) $(EXTRA_CFLAGS)
+
+ OBJS = hvmloader.o mp_tables.o util.o smbios.o
+ OBJS += smp.o cacheattr.o xenbus.o
diff --git a/sysutils/xentools42/patches/patch-hotplug_NetBSD_Makefile b/sysutils/xentools42/patches/patch-hotplug_NetBSD_Makefile
new file mode 100644
index 00000000000..d1cba067439
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-hotplug_NetBSD_Makefile
@@ -0,0 +1,40 @@
+$NetBSD: patch-hotplug_NetBSD_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- hotplug/NetBSD/Makefile.orig 2011-03-25 11:42:50.000000000 +0100
++++ hotplug/NetBSD/Makefile 2011-04-15 11:38:32.000000000 +0200
+@@ -8,7 +8,7 @@
+ XEN_SCRIPTS += vif-ip
+
+ XEN_SCRIPT_DATA =
+-XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog
++#XEN_RCD_PROG = rc.d/xencommons rc.d/xend rc.d/xendomains rc.d/xen-watchdog
+
+ .PHONY: all
+ all:
+@@ -21,10 +21,11 @@
+
+ .PHONY: install-scripts
+ install-scripts:
+- $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
++ $(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)
++ $(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)/scripts
+ set -e; for i in $(XEN_SCRIPTS); \
+ do \
+- $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
++ $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_EXAMPLES_DIR)/scripts; \
+ done
+ set -e; for i in $(XEN_SCRIPT_DATA); \
+ do \
+@@ -33,12 +34,6 @@
+
+ .PHONY: install-rcd
+ install-rcd:
+- $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/rc.d
+- set -e; for i in $(XEN_RCD_PROG); \
+- do \
+- $(INSTALL_PROG) $$i $(DESTDIR)$(CONFIG_DIR)/rc.d; \
+- done
+- $(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(CONFIG_DIR)/rc.d/xen-hotplugpath.sh
+
+ .PHONY: clean
+ clean:
diff --git a/sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-bridge b/sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-bridge
new file mode 100644
index 00000000000..4d99ee516d8
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-bridge
@@ -0,0 +1,16 @@
+$NetBSD: patch-hotplug_NetBSD_vif-bridge,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- hotplug/NetBSD/vif-bridge.orig 2012-12-17 15:00:35.000000000 +0000
++++ hotplug/NetBSD/vif-bridge
+@@ -23,7 +23,10 @@ case $xstatus in
+ xbridge=$(xenstore-read "$xpath/bridge")
+ xfid=$(xenstore-read "$xpath/frontend-id")
+ xhandle=$(xenstore-read "$xpath/handle")
+- iface=$(xenstore-read "$xpath/vifname")
++ iface=$(xenstore-read "$xpath/vifname") || true
++ if [ x${iface} = "x" ] ; then
++ iface=xvif$xfid.$xhandle
++ fi
+ ifconfig $iface up
+ brconfig $xbridge add $iface
+ xenstore-write $xpath/hotplug-status connected
diff --git a/sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-ip b/sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-ip
new file mode 100644
index 00000000000..36d0ec558f8
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-hotplug_NetBSD_vif-ip
@@ -0,0 +1,15 @@
+$NetBSD: patch-hotplug_NetBSD_vif-ip,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- hotplug/NetBSD/vif-ip.orig 2012-12-17 15:00:35.000000000 +0000
++++ hotplug/NetBSD/vif-ip
+@@ -24,6 +24,10 @@ case $xstatus in
+ xfid=$(xenstore-read "$xpath/frontend-id")
+ xhandle=$(xenstore-read "$xpath/handle")
+ iface=$(xenstore-read "$xpath/vifname")
++ iface=$(xenstore-read "$xpath/vifname") || true
++ if [ x${iface} = "x" ] ; then
++ iface=xvif$xfid.$xhandle
++ fi
+ ifconfig $iface $xip up
+ xenstore-write $xpath/hotplug-status connected
+ exit 0
diff --git a/sysutils/xentools42/patches/patch-hotplug_common_Makefile b/sysutils/xentools42/patches/patch-hotplug_common_Makefile
new file mode 100644
index 00000000000..bf27b926abd
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-hotplug_common_Makefile
@@ -0,0 +1,24 @@
+$NetBSD: patch-hotplug_common_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- hotplug/common/Makefile.orig 2013-04-23 16:42:55.000000000 +0000
++++ hotplug/common/Makefile
+@@ -23,15 +23,15 @@ install: all install-scripts
+
+ .PHONY: install-scripts
+ install-scripts: build
+- [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
+- $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
++ [ -d $(DESTDIR)${EGDIR}/scripts ] || \
++ $(INSTALL_DIR) $(DESTDIR)${EGDIR}/scripts
+ set -e; for i in $(XEN_SCRIPTS); \
+ do \
+- $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
++ $(INSTALL_PROG) $$i $(DESTDIR)${EGDIR}/scripts; \
+ done
+ set -e; for i in $(XEN_SCRIPT_DATA); \
+ do \
+- $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
++ $(INSTALL_DATA) $$i $(DESTDIR)${EGDIR}/scripts; \
+ done
+
+ .PHONY: clean
diff --git a/sysutils/xentools42/patches/patch-include_xen-sys_NetBSD_gntdev.h b/sysutils/xentools42/patches/patch-include_xen-sys_NetBSD_gntdev.h
new file mode 100644
index 00000000000..1d3ac0c0899
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-include_xen-sys_NetBSD_gntdev.h
@@ -0,0 +1,110 @@
+$NetBSD: patch-include_xen-sys_NetBSD_gntdev.h,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- include/xen-sys/NetBSD/gntdev.h.orig 2011-03-29 17:10:31.000000000 +0000
++++ include/xen-sys/NetBSD/gntdev.h
+@@ -0,0 +1,105 @@
++/******************************************************************************
++ * gntdev.h
++ *
++ * Interface to /dev/xen/gntdev.
++ *
++ * Copyright (c) 2007, D G Murray
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License version 2
++ * as published by the Free Software Foundation; or, when distributed
++ * separately from the Linux kernel or incorporated into other
++ * software packages, subject to the following license:
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this source file (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy, modify,
++ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
++ * and to permit persons to whom the Software is furnished to do so, subject to
++ * the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in
++ * all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
++ * IN THE SOFTWARE.
++ */
++
++#ifndef __NetBSD_PUBLIC_GNTDEV_H__
++#define __NetBSD_PUBLIC_GNTDEV_H__
++
++struct ioctl_gntdev_grant_ref {
++ /* The domain ID of the grant to be mapped. */
++ uint32_t domid;
++ /* The grant reference of the grant to be mapped. */
++ uint32_t ref;
++};
++
++/*
++ * Inserts the grant references into the mapping table of an instance
++ * of gntdev. N.B. This does not perform the mapping, which is deferred
++ * until mmap() is called with @index as the offset.
++ */
++#define IOCTL_GNTDEV_MAP_GRANT_REF \
++ _IOWR('G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
++struct ioctl_gntdev_map_grant_ref {
++ /* IN parameters */
++ /* The number of grants to be mapped. */
++ uint32_t count;
++ uint32_t pad;
++ /* OUT parameters */
++ /* The offset to be used on a subsequent call to mmap(). */
++ uint64_t index;
++ /* Variable IN parameter. */
++ /* Array of grant references, of size @count. */
++ struct ioctl_gntdev_grant_ref refs[1];
++};
++
++/*
++ * Removes the grant references from the mapping table of an instance of
++ * of gntdev. N.B. munmap() must be called on the relevant virtual address(es)
++ * before this ioctl is called, or an error will result.
++ */
++#define IOCTL_GNTDEV_UNMAP_GRANT_REF \
++ _IOW('G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))
++struct ioctl_gntdev_unmap_grant_ref {
++ /* IN parameters */
++ /* The offset was returned by the corresponding map operation. */
++ uint64_t index;
++ /* The number of pages to be unmapped. */
++ uint32_t count;
++ uint32_t pad;
++};
++
++/*
++ * Returns the offset in the driver's address space that corresponds
++ * to @vaddr. This can be used to perform a munmap(), followed by an
++ * UNMAP_GRANT_REF ioctl, where no state about the offset is retained by
++ * the caller. The number of pages that were allocated at the same time as
++ * @vaddr is returned in @count.
++ *
++ * N.B. Where more than one page has been mapped into a contiguous range, the
++ * supplied @vaddr must correspond to the start of the range; otherwise
++ * an error will result. It is only possible to munmap() the entire
++ * contiguously-allocated range at once, and not any subrange thereof.
++ */
++#define IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \
++ _IOWR('G', 2, sizeof(struct ioctl_gntdev_get_offset_for_vaddr))
++struct ioctl_gntdev_get_offset_for_vaddr {
++ /* IN parameters */
++ /* The virtual address of the first mapped page in a range. */
++ uint64_t vaddr;
++ /* OUT parameters */
++ /* The offset that was used in the initial mmap() operation. */
++ uint64_t offset;
++ /* The number of pages mapped in the VM area that begins at @vaddr. */
++ uint32_t count;
++ uint32_t pad;
++};
++
++#endif /* __NetBSD_PUBLIC_GNTDEV_H__ */
diff --git a/sysutils/xentools42/patches/patch-libfsimage_common_Makefile b/sysutils/xentools42/patches/patch-libfsimage_common_Makefile
new file mode 100644
index 00000000000..61f7d1989e3
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-libfsimage_common_Makefile
@@ -0,0 +1,13 @@
+$NetBSD: patch-libfsimage_common_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- libfsimage/common/Makefile.orig 2010-05-11 21:27:58.000000000 +0000
++++ libfsimage/common/Makefile
+@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
+ MAJOR = 1.0
+ MINOR = 0
+
++CFLAGS += -DFSIMAGE_FSDIR=\"$(LIBDIR)/fs\"
++
+ LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,mapfile-SunOS
+ LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
+ LDFLAGS = $(LDFLAGS-y)
diff --git a/sysutils/xentools42/patches/patch-libxc_xc__netbsd.c b/sysutils/xentools42/patches/patch-libxc_xc__netbsd.c
new file mode 100644
index 00000000000..191bb71e2a0
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-libxc_xc__netbsd.c
@@ -0,0 +1,251 @@
+$NetBSD: patch-libxc_xc__netbsd.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- libxc/xc_netbsd.c.orig 2012-12-17 15:00:48.000000000 +0000
++++ libxc/xc_netbsd.c
+@@ -18,13 +18,19 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+-#include "xc_private.h"
+-
+-#include <xen/sys/evtchn.h>
+-#include <unistd.h>
++#include <sys/mman.h>
++#include <sys/types.h>
+ #include <fcntl.h>
+ #include <malloc.h>
+-#include <sys/mman.h>
++#include <unistd.h>
++
++#include <xen/memory.h>
++#include <xen/sys/evtchn.h>
++#include <xen/sys/gntdev.h>
++/* #include <xen/sys/gntalloc.h> */
++#include "xc_private.h"
++#include "xenctrl.h"
++#include "xenctrlosdep.h"
+
+ static xc_osdep_handle netbsd_privcmd_open(xc_interface *xch)
+ {
+@@ -390,6 +396,210 @@ void *xc_memalign(xc_interface *xch, siz
+ return valloc(size);
+ }
+
++#if 0
++#define DEVXEN "/dev/xen/"
++
++static xc_osdep_handle
++netbsd_gnttab_open(xc_gnttab *xcg)
++{
++ int fd;
++
++ fd = open(DEVXEN "gntdev", O_RDWR);
++ if (fd == -1)
++ return XC_OSDEP_OPEN_ERROR;
++
++ return (xc_osdep_handle)fd;
++}
++
++static int
++netbsd_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h)
++{
++ int fd = (int)h;
++ return close(fd);
++}
++
++static int netbsd_gnttab_set_max_grants(xc_gnttab *xch, xc_osdep_handle h,
++ uint32_t count)
++{
++ int fd = (int)h, rc;
++ struct ioctl_gntdev_set_max_grants max_grants = { .count = count };
++
++ rc = ioctl(fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &max_grants);
++ if (rc) {
++ /*
++ * Newer (e.g. pv-ops) kernels don't implement this IOCTL,
++ * so ignore the resulting specific failure.
++ */
++ if (errno == ENOTTY)
++ rc = 0;
++ else
++ PERROR("netbsd_gnttab_set_max_grants: ioctl SET_MAX_GRANTS failed");
++ }
++ return rc;
++}
++
++static void *netbsd_gnttab_grant_map(xc_gnttab *xch, xc_osdep_handle h,
++ uint32_t count, int flags, int prot,
++ uint32_t *domids, uint32_t *refs,
++ uint32_t notify_offset,
++ evtchn_port_t notify_port)
++{
++ int fd = (int)h;
++ struct ioctl_gntdev_map_grant_ref *map;
++ unsigned int map_size = ROUNDUP((sizeof(*map) + (count - 1) *
++ sizeof(struct ioctl_gntdev_map_grant_ref)),
++ XC_PAGE_SHIFT);
++ void *addr = NULL;
++ int domids_stride = 1;
++ int i;
++
++ if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
++ domids_stride = 0;
++
++ if ( map_size <= XC_PAGE_SIZE )
++ map = alloca(sizeof(*map) +
++ (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
++ else
++ {
++ map = mmap(NULL, map_size, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANON | MAP_POPULATE, -1, 0);
++ if ( map == MAP_FAILED )
++ {
++ PERROR("netbsd_gnttab_grant_map: mmap of map failed");
++ return NULL;
++ }
++ }
++
++ for ( i = 0; i < count; i++ )
++ {
++ map->refs[i].domid = domids[i * domids_stride];
++ map->refs[i].ref = refs[i];
++ }
++
++ map->count = count;
++
++ if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) {
++ PERROR("netbsd_gnttab_grant_map: ioctl MAP_GRANT_REF failed");
++ goto out;
++ }
++
++ retry:
++ addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd,
++ map->index);
++
++ if (addr == MAP_FAILED && errno == EAGAIN)
++ {
++ /*
++ * The grant hypercall can return EAGAIN if the granted page is
++ * swapped out. Since the paging daemon may be in the same domain, the
++ * hypercall cannot block without causing a deadlock.
++ *
++ * Because there are no notificaitons when the page is swapped in, wait
++ * a bit before retrying, and hope that the page will arrive eventually.
++ */
++ usleep(1000);
++ goto retry;
++ }
++
++ if (addr != MAP_FAILED)
++ {
++ int rv = 0;
++ struct ioctl_gntdev_unmap_notify notify;
++ notify.index = map->index;
++ notify.action = 0;
++ if (notify_offset < XC_PAGE_SIZE * count) {
++ notify.index += notify_offset;
++ notify.action |= UNMAP_NOTIFY_CLEAR_BYTE;
++ }
++ if (notify_port != -1) {
++ notify.event_channel_port = notify_port;
++ notify.action |= UNMAP_NOTIFY_SEND_EVENT;
++ }
++ if (notify.action)
++ rv = ioctl(fd, IOCTL_GNTDEV_SET_UNMAP_NOTIFY, &notify);
++ if (rv) {
++ PERROR("netbsd_gnttab_grant_map: ioctl SET_UNMAP_NOTIFY failed");
++ munmap(addr, count * XC_PAGE_SIZE);
++ addr = MAP_FAILED;
++ }
++ }
++
++ if (addr == MAP_FAILED)
++ {
++ int saved_errno = errno;
++ struct ioctl_gntdev_unmap_grant_ref unmap_grant;
++
++ /* Unmap the driver slots used to store the grant information. */
++ PERROR("xc_gnttab_map_grant_refs: mmap failed");
++ unmap_grant.index = map->index;
++ unmap_grant.count = count;
++ ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
++ errno = saved_errno;
++ addr = NULL;
++ }
++
++ out:
++ if ( map_size > XC_PAGE_SIZE )
++ munmap(map, map_size);
++
++ return addr;
++}
++
++static int
++netbsd_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
++ void *start_address, uint32_t count)
++{
++ int fd = (int)h;
++ struct ioctl_gntdev_get_offset_for_vaddr get_offset;
++ struct ioctl_gntdev_unmap_grant_ref unmap_grant;
++ int rc;
++
++ if ( start_address == NULL )
++ {
++ errno = EINVAL;
++ return -1;
++ }
++
++ /* First, it is necessary to get the offset which was initially used to
++ * mmap() the pages.
++ */
++ get_offset.vaddr = (unsigned long)start_address;
++ rc = ioctl(fd, IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR, &get_offset);
++ if ( rc )
++ return rc;
++
++ if ( get_offset.count != count )
++ {
++ errno = EINVAL;
++ return -1;
++ }
++
++ /* Next, unmap the memory. */
++ rc = munmap(start_address, count * getpagesize());
++ if ( rc )
++ return rc;
++
++ /* Finally, unmap the driver slots used to store the grant information. */
++ unmap_grant.index = get_offset.offset;
++ unmap_grant.count = count;
++ rc = ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
++ if ( rc )
++ return rc;
++ return 0;
++}
++
++static struct xc_osdep_ops netbsd_gnttab_ops = {
++ .open = &netbsd_gnttab_open,
++ .close = &netbsd_gnttab_close,
++
++ .u.gnttab = {
++ .set_max_grants = netbsd_gnttab_set_max_grants,
++ .grant_map = &netbsd_gnttab_grant_map,
++ .munmap = &netbsd_gnttab_munmap,
++ },
++};
++#endif
++
+ static struct xc_osdep_ops *netbsd_osdep_init(xc_interface *xch, enum xc_osdep_type type)
+ {
+ switch ( type )
+@@ -398,6 +608,10 @@ static struct xc_osdep_ops *netbsd_osdep
+ return &netbsd_privcmd_ops;
+ case XC_OSDEP_EVTCHN:
+ return &netbsd_evtchn_ops;
++#if 0
++ case XC_OSDEP_GNTTAB:
++ return &netbsd_gnttab_ops;
++#endif
+ default:
+ return NULL;
+ }
diff --git a/sysutils/xentools42/patches/patch-libxl_libxl__create.c b/sysutils/xentools42/patches/patch-libxl_libxl__create.c
new file mode 100644
index 00000000000..3cbebfbb3f8
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-libxl_libxl__create.c
@@ -0,0 +1,40 @@
+$NetBSD: patch-libxl_libxl__create.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- libxl/libxl_create.c.orig 2012-12-17 15:01:09.000000000 +0000
++++ libxl/libxl_create.c
+@@ -338,7 +338,7 @@ int libxl__domain_build(libxl__gc *gc,
+ vments[2] = "image/ostype";
+ vments[3] = "hvm";
+ vments[4] = "start_time";
+- vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[5] = libxl__sprintf(gc, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
+
+ localents = libxl__calloc(gc, 7, sizeof(char *));
+ localents[0] = "platform/acpi";
+@@ -361,7 +361,7 @@ int libxl__domain_build(libxl__gc *gc,
+ vments[i++] = "image/kernel";
+ vments[i++] = (char *) state->pv_kernel.path;
+ vments[i++] = "start_time";
+- vments[i++] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[i++] = libxl__sprintf(gc, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
+ if (state->pv_ramdisk.path) {
+ vments[i++] = "image/ramdisk";
+ vments[i++] = (char *) state->pv_ramdisk.path;
+@@ -832,7 +832,7 @@ void libxl__xc_domain_restore_done(libxl
+ vments[2] = "image/ostype";
+ vments[3] = "hvm";
+ vments[4] = "start_time";
+- vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[5] = libxl__sprintf(gc, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
+ break;
+ case LIBXL_DOMAIN_TYPE_PV:
+ vments = libxl__calloc(gc, 11, sizeof(char *));
+@@ -842,7 +842,7 @@ void libxl__xc_domain_restore_done(libxl
+ vments[i++] = "image/kernel";
+ vments[i++] = (char *) state->pv_kernel.path;
+ vments[i++] = "start_time";
+- vments[i++] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[i++] = libxl__sprintf(gc, "%jd.%02d", (intmax_t)start_time.tv_sec, (int)start_time.tv_usec/10000);
+ if (state->pv_ramdisk.path) {
+ vments[i++] = "image/ramdisk";
+ vments[i++] = (char *) state->pv_ramdisk.path;
diff --git a/sysutils/xentools42/patches/patch-libxl_libxl__internal.h b/sysutils/xentools42/patches/patch-libxl_libxl__internal.h
new file mode 100644
index 00000000000..5a528a03827
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-libxl_libxl__internal.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-libxl_libxl__internal.h,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- libxl/libxl_internal.h.orig 2012-12-17 15:01:09.000000000 +0000
++++ libxl/libxl_internal.h
+@@ -374,7 +374,11 @@ typedef struct {
+ #define PCI_FUNC(devfn) ((devfn) & 0x07)
+ #define AUTO_PHP_SLOT 0x100
+ #define SYSFS_PCI_DEV "/sys/bus/pci/devices"
++#ifdef __NetBSD__
++#define SYSFS_PCIBACK_DRIVER "/kern/xen/pci"
++#else
+ #define SYSFS_PCIBACK_DRIVER "/sys/bus/pci/drivers/pciback"
++#endif
+ #define XENSTORE_PID_FILE "/var/run/xenstored.pid"
+
+ #define PROC_PCI_NUM_RESOURCES 7
diff --git a/sysutils/xentools42/patches/patch-ocaml_common.make b/sysutils/xentools42/patches/patch-ocaml_common.make
new file mode 100644
index 00000000000..26a50f7b40f
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-ocaml_common.make
@@ -0,0 +1,13 @@
+$NetBSD: patch-ocaml_common.make,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ocaml/common.make.orig 2013-03-13 09:31:47.000000000 +0000
++++ ocaml/common.make
+@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
+ CC ?= gcc
+ OCAMLOPT ?= ocamlopt
+ OCAMLC ?= ocamlc
+-OCAMLMKLIB ?= ocamlmklib
++OCAMLMKLIB ?= ocamlmklib -elfmode
+ OCAMLDEP ?= ocamldep
+ OCAMLLEX ?= ocamllex
+ OCAMLYACC ?= ocamlyacc
diff --git a/sysutils/xentools42/patches/patch-ocaml_xenstored_define.ml b/sysutils/xentools42/patches/patch-ocaml_xenstored_define.ml
new file mode 100644
index 00000000000..9cae4d9b2e0
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-ocaml_xenstored_define.ml
@@ -0,0 +1,20 @@
+$NetBSD: patch-ocaml_xenstored_define.ml,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ocaml/xenstored/define.ml.orig 2012-12-17 15:01:22.000000000 +0000
++++ ocaml/xenstored/define.ml
+@@ -17,13 +17,13 @@
+ let xenstored_major = 1
+ let xenstored_minor = 0
+
+-let xenstored_proc_kva = "/proc/xen/xsd_kva"
++let xenstored_proc_kva = "@PROCDEV@/xsd_kva"
+ let xenstored_proc_port = "/proc/xen/xsd_port"
+
+ let xs_daemon_socket = "/var/run/xenstored/socket"
+ let xs_daemon_socket_ro = "/var/run/xenstored/socket_ro"
+
+-let default_config_dir = "/etc/xen"
++let default_config_dir = "@XENDCONFDIR@"
+
+ let maxwatch = ref (50)
+ let maxtransaction = ref (20)
diff --git a/sysutils/xentools42/patches/patch-ocaml_xenstored_utils.ml b/sysutils/xentools42/patches/patch-ocaml_xenstored_utils.ml
new file mode 100644
index 00000000000..be8d8a58e8b
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-ocaml_xenstored_utils.ml
@@ -0,0 +1,13 @@
+$NetBSD: patch-ocaml_xenstored_utils.ml,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- ocaml/xenstored/utils.ml.orig
++++ ocaml/xenstored/utils.ml
+@@ -87,7 +83,7 @@ let read_file_single_integer filename =
+ let buf = String.make 20 (char_of_int 0) in
+ let sz = Unix.read fd buf 0 20 in
+ Unix.close fd;
+- int_of_string (String.sub buf 0 sz)
++ int_of_string (String.trim (String.sub buf 0 sz))
+
+ let path_complete path connection_path =
+ if String.get path 0 <> '/' then
diff --git a/sysutils/xentools42/patches/patch-python_xen_xend_XendNode.py b/sysutils/xentools42/patches/patch-python_xen_xend_XendNode.py
new file mode 100644
index 00000000000..a6afdf4abcd
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-python_xen_xend_XendNode.py
@@ -0,0 +1,56 @@
+$NetBSD: patch-python_xen_xend_XendNode.py,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- python/xen/xend/XendNode.py.orig 2010-04-07 16:12:05.000000000 +0000
++++ python/xen/xend/XendNode.py
+@@ -276,28 +276,29 @@ class XendNode:
+ except KeyError:
+ pass
+
+- for pci_dev in PciUtil.get_all_pci_devices():
+- ppci_record = {
+- 'domain': pci_dev.domain,
+- 'bus': pci_dev.bus,
+- 'slot': pci_dev.slot,
+- 'func': pci_dev.func,
+- 'vendor_id': pci_dev.vendor,
+- 'vendor_name': pci_dev.vendorname,
+- 'device_id': pci_dev.device,
+- 'device_name': pci_dev.devicename,
+- 'revision_id': pci_dev.revision,
+- 'class_code': pci_dev.classcode,
+- 'class_name': pci_dev.classname,
+- 'subsystem_vendor_id': pci_dev.subvendor,
+- 'subsystem_vendor_name': pci_dev.subvendorname,
+- 'subsystem_id': pci_dev.subdevice,
+- 'subsystem_name': pci_dev.subdevicename,
+- 'driver': pci_dev.driver
+- }
+- # If saved uuid exists, use it. Otherwise create one.
+- ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString())
+- XendPPCI(ppci_uuid, ppci_record)
++ pass
++ #for pci_dev in PciUtil.get_all_pci_devices():
++ # ppci_record = {
++ # 'domain': pci_dev.domain,
++ # 'bus': pci_dev.bus,
++ # 'slot': pci_dev.slot,
++ # 'func': pci_dev.func,
++ # 'vendor_id': pci_dev.vendor,
++ # 'vendor_name': pci_dev.vendorname,
++ # 'device_id': pci_dev.device,
++ # 'device_name': pci_dev.devicename,
++ # 'revision_id': pci_dev.revision,
++ # 'class_code': pci_dev.classcode,
++ # 'class_name': pci_dev.classname,
++ # 'subsystem_vendor_id': pci_dev.subvendor,
++ # 'subsystem_vendor_name': pci_dev.subvendorname,
++ # 'subsystem_id': pci_dev.subdevice,
++ # 'subsystem_name': pci_dev.subdevicename,
++ # 'driver': pci_dev.driver
++ # }
++ # # If saved uuid exists, use it. Otherwise create one.
++ # ppci_uuid = saved_ppci_table.get(pci_dev.name, uuid.createString())
++ # XendPPCI(ppci_uuid, ppci_record)
+
+ def _init_PSCSIs(self):
+ # Initialise PSCSIs and PSCSI_HBAs
diff --git a/sysutils/xentools42/patches/patch-python_xen_xend_osdep.py b/sysutils/xentools42/patches/patch-python_xen_xend_osdep.py
new file mode 100644
index 00000000000..5e8676c25b9
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-python_xen_xend_osdep.py
@@ -0,0 +1,18 @@
+$NetBSD: patch-python_xen_xend_osdep.py,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- python/xen/xend/osdep.py.orig 2011-04-01 12:03:13.000000000 +0200
++++ python/xen/xend/osdep.py 2011-04-01 13:49:45.000000000 +0200
+@@ -94,8 +94,12 @@
+ return None
+ cmd = "/sbin/sysctl " + cmdarg
+ sysctloutput = commands.getoutput(cmd)
++ div = 1
++ if label == 'current' and '=' not in sysctloutput:
++ sysctloutput = commands.getoutput( "/sbin/sysctl hw.physmem64")
++ div = 1024
+ (name, value) = sysctloutput.split('=')
+- return int(value)
++ return int(value) / div
+
+ def _solaris_balloon_stat(label):
+ """Returns the value for the named label, or None if an error occurs."""
diff --git a/sysutils/xentools42/patches/patch-python_xen_xm_create.py b/sysutils/xentools42/patches/patch-python_xen_xm_create.py
new file mode 100644
index 00000000000..c13c1a19456
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-python_xen_xm_create.py
@@ -0,0 +1,13 @@
+$NetBSD: patch-python_xen_xm_create.py,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- python/xen/xm/create.py.orig 2010-04-07 16:12:05.000000000 +0000
++++ python/xen/xm/create.py
+@@ -426,7 +426,7 @@ gopts.var('vtpm', val="instance=INSTANCE
+ preferred instance number. The hotplug script will determine
+ which instance number will actually be assigned to the domain.
+ The associtation between virtual machine and the TPM instance
+- number can be found in /etc/xen/vtpm.db. Use the backend in the
++ number can be found in @XENDCONFDIR@/vtpm.db. Use the backend in the
+ given domain.
+ The type parameter can be used to select a specific driver type
+ that the VM can use. To prevent a fully virtualized domain (HVM)
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_Makefile b/sysutils/xentools42/patches/patch-qemu-xen-traditional_Makefile
new file mode 100644
index 00000000000..855e19e1fc5
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_Makefile
@@ -0,0 +1,85 @@
+$NetBSD: patch-qemu-xen-traditional_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/Makefile.orig 2011-02-11 17:54:51.000000000 +0000
++++ qemu-xen-traditional/Makefile
+@@ -1,7 +1,7 @@
+ # Makefile for QEMU.
+
+-include config-host.mak
+-include $(SRC_PATH)/rules.mak
++-include config-host.mak
++-include $(SRC_PATH)/rules.mak
+
+ .PHONY: all clean cscope distclean dvi html info install install-doc \
+ recurse-all speed tar tarbin test
+@@ -231,30 +231,30 @@ BLOBS=
+ endif
+
+ install-doc: $(DOCS)
+- mkdir -p "$(DESTDIR)$(docdir)"
+- $(INSTALL) -m 644 qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
++ $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
++ $(INSTALL_DATA) qemu-doc.html qemu-tech.html "$(DESTDIR)$(docdir)"
+ ifndef CONFIG_WIN32
+- mkdir -p "$(DESTDIR)$(mandir)/man1"
+- $(INSTALL) -m 644 qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
+- mkdir -p "$(DESTDIR)$(mandir)/man8"
+- $(INSTALL) -m 644 qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
++ $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
++ $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
++ $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
++ $(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
+ endif
+
+ install: all $(if $(BUILD_DOCS),install-doc)
+- mkdir -p "$(DESTDIR)$(bindir)"
++ $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
+ ifneq ($(TOOLS),)
+- $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)"
++ $(INSTALL_PROG) -s $(TOOLS) "$(DESTDIR)$(bindir)"
+ endif
+ ifneq ($(BLOBS),)
+- mkdir -p "$(DESTDIR)$(datadir)"
++ $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
+ set -e; for x in $(BLOBS); do \
+- $(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
++ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \
+ done
+ endif
+ ifndef CONFIG_WIN32
+- mkdir -p "$(DESTDIR)$(datadir)/keymaps"
++ $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps"
+ set -e; for x in $(KEYMAPS); do \
+- $(INSTALL) -m 644 $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
++ $(INSTALL_DATA) $(SRC_PATH)/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \
+ done
+ endif
+ for d in $(TARGET_DIRS); do \
+@@ -275,7 +275,7 @@ cscope:
+
+ # documentation
+ %.html: %.texi
+- texi2html -monolithic -number $<
++ texi2html -monolithic -number-sections $<
+
+ %.info: %.texi
+ makeinfo $< -o $@
+@@ -284,15 +284,15 @@ cscope:
+ texi2dvi $<
+
+ qemu.1: qemu-doc.texi
+- $(SRC_PATH)/texi2pod.pl $< qemu.pod
++ perl $(SRC_PATH)/texi2pod.pl $< qemu.pod
+ pod2man --section=1 --center=" " --release=" " qemu.pod > $@
+
+ qemu-img.1: qemu-img.texi
+- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
++ perl $(SRC_PATH)/texi2pod.pl $< qemu-img.pod
+ pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@
+
+ qemu-nbd.8: qemu-nbd.texi
+- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
++ perl $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod
+ pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@
+
+ info: qemu-doc.info qemu-tech.info
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_block-raw-posix.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_block-raw-posix.c
new file mode 100644
index 00000000000..bbe2aa6571b
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_block-raw-posix.c
@@ -0,0 +1,62 @@
+$NetBSD: patch-qemu-xen-traditional_block-raw-posix.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+- if given a block device, use the character device instead.
+
+--- qemu-xen-traditional/block-raw-posix.c.orig 2012-12-11 13:11:04.000000000 +0000
++++ qemu-xen-traditional/block-raw-posix.c
+@@ -65,6 +65,7 @@
+ #include <sys/disklabel.h>
+ #include <sys/dkio.h>
+ #include <sys/disk.h>
++#include <sys/param.h>
+ #endif
+
+ #ifdef __OpenBSD__
+@@ -72,6 +73,13 @@
+ #include <sys/disklabel.h>
+ #include <sys/dkio.h>
+ #endif
++#if defined(__NetBSD__)
++#include <sys/ioctl.h>
++#include <sys/disklabel.h>
++#include <sys/dkio.h>
++#define SLIST_ENTRY(x) int /*XXXX !*/
++#include <sys/disk.h>
++#endif
+
+ //#define DEBUG_FLOPPY
+
+@@ -1008,6 +1016,33 @@ static int hdev_open(BlockDriverState *b
+ {
+ BDRVRawState *s = bs->opaque;
+ int fd, open_flags, ret;
++#ifdef __NetBSD__
++ struct stat sb;
++ static char namebuf[MAXPATHLEN];
++ const char *dp;
++
++ if (lstat(filename, &sb) < 0) {
++ fprintf(stderr, "%s: stat failed: %s\n", filename, strerror(errno));
++ return -errno;
++ }
++ if (S_ISLNK(sb.st_mode)) {
++ fprintf(stderr, "%s: symolink links not supported by qemu-dm\n",
++ filename);
++ return -EINVAL;
++ }
++ if (S_ISBLK(sb.st_mode)) {
++ dp = strrchr(filename, '/');
++ if (dp == NULL) {
++ snprintf(namebuf, MAXPATHLEN, "r%s", filename);
++ } else {
++ snprintf(namebuf, MAXPATHLEN, "%.*s/r%s",
++ (int)(dp - filename), filename, dp + 1);
++ }
++ fprintf(stderr, "%s is a block device", filename);
++ filename = namebuf;
++ fprintf(stderr, ", using %s\n", filename);
++ }
++#endif
+
+ posix_aio_init();
+
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_configure b/sysutils/xentools42/patches/patch-qemu-xen-traditional_configure
new file mode 100644
index 00000000000..f21d205d590
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_configure
@@ -0,0 +1,32 @@
+$NetBSD: patch-qemu-xen-traditional_configure,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/configure.orig 2011-02-11 17:54:51.000000000 +0000
++++ qemu-xen-traditional/configure
+@@ -1089,7 +1089,7 @@ fi
+ # Check if tools are available to build documentation.
+ if [ -x "`which texi2html 2>/dev/null`" ] && \
+ [ -x "`which pod2man 2>/dev/null`" ]; then
+- build_docs="yes"
++# build_docs="yes"
+ fi
+
+ ##########################################
+@@ -1124,7 +1124,7 @@ else
+ if test -z "$prefix" ; then
+ prefix="/usr/local"
+ fi
+- mansuffix="/share/man"
++ mansuffix="/man"
+ datasuffix="/share/qemu"
+ docsuffix="/share/doc/qemu"
+ binsuffix="/bin"
+@@ -1215,6 +1215,9 @@ echo "docdir=\${prefix}$docsuffix" >> $c
+ echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
+ echo "MAKE=$make" >> $config_mak
+ echo "INSTALL=$install" >> $config_mak
++echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
++echo "INSTALL_DATA=$install -d -m0644 -p" >> $config_mak
++echo "INSTALL_PROG=$install -d -m0755 -p" >> $config_mak
+ echo "CC=$cc" >> $config_mak
+ echo "HOST_CC=$host_cc" >> $config_mak
+ echo "AR=$ar" >> $config_mak
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_e1000.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_e1000.c
new file mode 100644
index 00000000000..a6e79aee917
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_e1000.c
@@ -0,0 +1,34 @@
+$NetBSD: patch-qemu-xen-traditional_hw_e1000.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+From sysutils/xentools33/patches/patch-ak.
+
+qemu-0.13.x will include this fix:
+http://git.qemu.org/qemu.git/commit/?id=9651ac55e5de0e1534d898316cc851af6ffc4334
+
+--- qemu-xen-traditional/hw/e1000.c.orig 2009-08-06 12:56:34.000000000 +0000
++++ qemu-xen-traditional/hw/e1000.c
+@@ -244,16 +244,20 @@ set_eecd(E1000State *s, int index, uint3
+
+ s->eecd_state.old_eecd = val & (E1000_EECD_SK | E1000_EECD_CS |
+ E1000_EECD_DI|E1000_EECD_FWE_MASK|E1000_EECD_REQ);
++ if (!(E1000_EECD_CS & val)) // CS inactive; nothing to do
++ return;
++ if (E1000_EECD_CS & (val ^ oldval)) { // CS rise edge; reset state
++ s->eecd_state.val_in = 0;
++ s->eecd_state.bitnum_in = 0;
++ s->eecd_state.bitnum_out = 0;
++ s->eecd_state.reading = 0;
++ }
+ if (!(E1000_EECD_SK & (val ^ oldval))) // no clock edge
+ return;
+ if (!(E1000_EECD_SK & val)) { // falling edge
+ s->eecd_state.bitnum_out++;
+ return;
+ }
+- if (!(val & E1000_EECD_CS)) { // rising, no CS (EEPROM reset)
+- memset(&s->eecd_state, 0, sizeof s->eecd_state);
+- return;
+- }
+ s->eecd_state.val_in <<= 1;
+ if (val & E1000_EECD_DI)
+ s->eecd_state.val_in |= 1;
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_ide.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_ide.c
new file mode 100644
index 00000000000..30e9af3af8a
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_ide.c
@@ -0,0 +1,27 @@
+$NetBSD: patch-qemu-xen-traditional_hw_ide.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/ide.c.orig 2011-02-11 17:54:51.000000000 +0000
++++ qemu-xen-traditional/hw/ide.c
+@@ -761,6 +761,7 @@ static void ide_identify(IDEState *s)
+ put_le16(p + 61, s->nb_sectors >> 16);
+ put_le16(p + 62, 0x07); /* single word dma0-2 supported */
+ put_le16(p + 63, 0x07); /* mdma0-2 supported */
++ put_le16(p + 64, 0x03); /* pio3-4 supported */
+ put_le16(p + 65, 120);
+ put_le16(p + 66, 120);
+ put_le16(p + 67, 120);
+@@ -812,13 +813,12 @@ static void ide_atapi_identify(IDEState
+ put_le16(p + 53, 7); /* words 64-70, 54-58, 88 valid */
+ put_le16(p + 62, 7); /* single word dma0-2 supported */
+ put_le16(p + 63, 7); /* mdma0-2 supported */
+- put_le16(p + 64, 0x3f); /* PIO modes supported */
+ #else
+ put_le16(p + 49, 1 << 9); /* LBA supported, no DMA */
+ put_le16(p + 53, 3); /* words 64-70, 54-58 valid */
+ put_le16(p + 63, 0x103); /* DMA modes XXX: may be incorrect */
+- put_le16(p + 64, 1); /* PIO modes */
+ #endif
++ put_le16(p + 64, 3); /* pio3-4 supported */
+ put_le16(p + 65, 0xb4); /* minimum DMA multiword tx cycle time */
+ put_le16(p + 66, 0xb4); /* recommended DMA multiword tx cycle time */
+ put_le16(p + 67, 0x12c); /* minimum PIO cycle time without flow control */
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.c
new file mode 100644
index 00000000000..44e80e01cb2
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-qemu-xen-traditional_hw_pass-through.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/pass-through.c.orig 2012-05-24 16:05:23.000000000 +0200
++++ qemu-xen-traditional/hw/pass-through.c 2012-05-24 16:06:19.000000000 +0200
+@@ -84,8 +84,6 @@
+ */
+
+ #include "pass-through.h"
+-#include "pci/header.h"
+-#include "pci/pci.h"
+ #include "pt-msi.h"
+ #include "qemu-xen.h"
+ #include "iomulti.h"
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.h b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.h
new file mode 100644
index 00000000000..3cb27101fc7
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pass-through.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-qemu-xen-traditional_hw_pass-through.h,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/pass-through.h.orig 2012-05-24 15:57:12.000000000 +0200
++++ qemu-xen-traditional/hw/pass-through.h 2012-05-24 15:58:46.000000000 +0200
+@@ -20,8 +20,13 @@
+
+ #include "hw.h"
+ #include "pci.h"
++#ifdef __NetBSD__
++#include "pciutils/header.h"
++#include "pciutils/pci.h"
++#else
+ #include "pci/header.h"
+ #include "pci/pci.h"
++#endif
+ #include "exec-all.h"
+ #include "sys-queue.h"
+ #include "qemu-timer.h"
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_piix4acpi.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_piix4acpi.c
new file mode 100644
index 00000000000..bcbc248270c
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_piix4acpi.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-qemu-xen-traditional_hw_piix4acpi.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/piix4acpi.c.orig 2012-05-30 10:21:32.000000000 +0200
++++ qemu-xen-traditional/hw/piix4acpi.c 2012-05-30 10:23:11.000000000 +0200
+@@ -41,8 +41,12 @@
+ #define PIIX4ACPI_LOG(level, fmt, ...) do { if (level <= PIIX4ACPI_LOGLEVEL) qemu_log(fmt, ## __VA_ARGS__); } while (0)
+
+ #ifdef CONFIG_PASSTHROUGH
++#ifdef __NetBSD__
++#include <pciutils/header.h>
++#else
+ #include <pci/header.h>
+ #endif
++#endif
+
+ /* PM1a_CNT bits, as defined in the ACPI specification. */
+ #define SCI_EN (1 << 0)
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-graphics.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-graphics.c
new file mode 100644
index 00000000000..d142be462fb
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-graphics.c
@@ -0,0 +1,13 @@
+$NetBSD: patch-qemu-xen-traditional_hw_pt-graphics.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/pt-graphics.c.orig 2012-05-24 16:16:49.000000000 +0200
++++ qemu-xen-traditional/hw/pt-graphics.c 2012-05-24 16:16:55.000000000 +0200
+@@ -3,8 +3,6 @@
+ */
+
+ #include "pass-through.h"
+-#include "pci/header.h"
+-#include "pci/pci.h"
+
+ #include <unistd.h>
+ #include <sys/ioctl.h>
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.c b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.c
new file mode 100644
index 00000000000..d0c9945ad22
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-qemu-xen-traditional_hw_pt-msi.c,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/pt-msi.c.orig 2012-05-24 13:27:50.000000000 +0200
++++ qemu-xen-traditional/hw/pt-msi.c 2012-05-24 13:28:42.000000000 +0200
+@@ -22,6 +22,10 @@
+ #include "pt-msi.h"
+ #include <sys/mman.h>
+
++#ifdef __NetBSD__
++#define MAP_LOCKED MAP_WIRED
++#endif
++
+ void msi_set_enable(struct pt_dev *dev, int en)
+ {
+ uint16_t val = 0;
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.h b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.h
new file mode 100644
index 00000000000..9e45777f4a1
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_hw_pt-msi.h
@@ -0,0 +1,12 @@
+$NetBSD: patch-qemu-xen-traditional_hw_pt-msi.h,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/hw/pt-msi.h.orig 2012-05-24 16:09:24.000000000 +0200
++++ qemu-xen-traditional/hw/pt-msi.h 2012-05-24 16:15:19.000000000 +0200
+@@ -1,7 +1,6 @@
+ #ifndef _PT_MSI_H
+ #define _PT_MSI_H
+
+-#include "pci/pci.h"
+ #include "pass-through.h"
+
+ #define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_i386-dm_hookstarget.mak b/sysutils/xentools42/patches/patch-qemu-xen-traditional_i386-dm_hookstarget.mak
new file mode 100644
index 00000000000..253d3546202
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_i386-dm_hookstarget.mak
@@ -0,0 +1,12 @@
+$NetBSD: patch-qemu-xen-traditional_i386-dm_hookstarget.mak,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- qemu-xen-traditional/i386-dm/hookstarget.mak.orig 2011-04-15 11:45:21.000000000 +0200
++++ qemu-xen-traditional/i386-dm/hookstarget.mak 2011-04-15 11:46:36.000000000 +0200
+@@ -2,5 +2,5 @@
+
+ install-hook:
+ $(INSTALL_DIR) "$(DESTDIR)/$(bindir)"
+- $(INSTALL_DIR) "$(DESTDIR)/$(configdir)"
+- $(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(configdir)/qemu-ifup"
++ $(INSTALL_DIR) "$(DESTDIR)/$(XEN_EXAMPLES_DIR)/scripts"
++ $(INSTALL_PROG) $(QEMU_ROOT)/i386-dm/qemu-ifup-$(IOEMU_OS) "$(DESTDIR)/$(XEN_EXAMPLES_DIR)/scripts/qemu-ifup"
diff --git a/sysutils/xentools42/patches/patch-qemu-xen-traditional_xen-hooks.mak b/sysutils/xentools42/patches/patch-qemu-xen-traditional_xen-hooks.mak
new file mode 100644
index 00000000000..ea33067c6d5
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-qemu-xen-traditional_xen-hooks.mak
@@ -0,0 +1,34 @@
+$NetBSD: patch-qemu-xen-traditional_xen-hooks.mak,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+enable PCI passthrough when pciutils is present
+
+--- qemu-xen-traditional/xen-hooks.mak.orig 2012-05-24 15:41:11.000000000 +0200
++++ qemu-xen-traditional/xen-hooks.mak 2012-05-24 15:46:21.000000000 +0200
+@@ -55,17 +55,25 @@
+ ifdef CONFIG_STUBDOM
+ CONFIG_PASSTHROUGH=1
+ else
+- ifeq (,$(wildcard /usr/include/pci))
++ ifeq ($(CONFIG_NetBSD), y)
++CONFIG_PASSTHROUGH=1
++ else
++ ifeq (,$(wildcard /usr/include/pci))
+ $(warning === pciutils-dev package not found - missing /usr/include/pci)
+ $(warning === PCI passthrough capability has been disabled)
+- else
++ else
+ CONFIG_PASSTHROUGH=1
++ endif
+ endif
+ endif
+
+ ifdef CONFIG_PASSTHROUGH
+ OBJS+= pass-through.o pt-msi.o pt-graphics.o
++ifeq ($(CONFIG_NetBSD), y)
++LIBS += -lpciutils -lpci
++else
+ LIBS += -lpci
++endif
+ CFLAGS += -DCONFIG_PASSTHROUGH
+ $(info === PCI passthrough capability has been enabled ===)
+ endif
diff --git a/sysutils/xentools42/patches/patch-xentrace_Makefile b/sysutils/xentools42/patches/patch-xentrace_Makefile
new file mode 100644
index 00000000000..14aca3c5b95
--- /dev/null
+++ b/sysutils/xentools42/patches/patch-xentrace_Makefile
@@ -0,0 +1,12 @@
+$NetBSD: patch-xentrace_Makefile,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+--- xentrace/Makefile.orig 2010-04-07 16:12:05.000000000 +0000
++++ xentrace/Makefile
+@@ -43,6 +43,7 @@ install: build
+ [ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(PRIVATE_BINDIR)
+ $(INSTALL_DATA) $(MAN1) $(DESTDIR)$(MAN1DIR)
+ $(INSTALL_DATA) $(MAN8) $(DESTDIR)$(MAN8DIR)
++ $(INSTALL_DATA) formats $(DESTDIR)$(EGDIR)
+
+ .PHONY: clean
+ clean:
diff --git a/sysutils/xentools42/version.mk b/sysutils/xentools42/version.mk
new file mode 100644
index 00000000000..b16d9c58b1d
--- /dev/null
+++ b/sysutils/xentools42/version.mk
@@ -0,0 +1,6 @@
+# $NetBSD: version.mk,v 1.1 2013/05/15 06:58:50 jnemeth Exp $
+
+# Version number is used by xentools41 and xenstoretools
+
+VERSION= 4.2.2
+VERSION_IPXE= 1.0.0