pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/sysutils
Module Name: pkgsrc
Committed By: bouyer
Date: Tue May 26 11:12:11 UTC 2020
Added Files:
pkgsrc/sysutils/xenkernel413: DESCR MESSAGE Makefile PLIST distinfo
pkgsrc/sysutils/xenkernel413/patches: patch-Config.mk
patch-xen_Makefile patch-xen_Rules.mk patch-xen_arch_x86_Rules.mk
patch-xen_arch_x86_boot_build32.mk patch-xen_arch_x86_mm_p2m.c
patch-xen_drivers_passthrough_x86_iommu.c patch-xen_tools_symbols.c
pkgsrc/sysutils/xentools413: DESCR MESSAGE MESSAGE.NetBSD Makefile
PLIST distinfo
pkgsrc/sysutils/xentools413/files: blk_netbsd.c blktapctrl_netbsd.c
locking.sh xen-watchdog.sh xencommons.sh xendomains.sh
pkgsrc/sysutils/xentools413/patches: patch-Config.mk patch-Makefile
patch-docs_man_xl-disk-configuration.5.pod
patch-docs_man_xl.1.pod.in patch-docs_man_xl.cfg.5.pod.in
patch-docs_man_xl.conf.5.pod patch-docs_man_xlcpupool.cfg.5.pod
patch-docs_misc_block-scripts.txt patch-docs_misc_vtd.txt
patch-extras_mini-os_Config.mk
patch-extras_mini-os_arch_x86_arch.mk
patch-extras_mini-os_include_fcntl.h
patch-extras_mini-os_include_time.h patch-extras_mini-os_lib_sys.c
patch-extras_mini-os_lock.c patch-m4_paths.m4 patch-tools_Makefile
patch-tools_Rules.mk patch-tools_configure
patch-tools_console_daemon_utils.c
patch-tools_debugger_gdbsx_xg_xg_main.c
patch-tools_examples_Makefile
patch-tools_firmware_etherboot_Makefile
patch-tools_firmware_hvmloader_Makefile
patch-tools_hotplug_NetBSD_Makefile
patch-tools_hotplug_NetBSD_block
patch-tools_hotplug_NetBSD_vif-bridge
patch-tools_hotplug_NetBSD_vif-ip
patch-tools_hotplug_common_Makefile
patch-tools_include_xen-sys_NetBSD_gntdev.h
patch-tools_libs_call_netbsd.c patch-tools_libs_call_private.h
patch-tools_libs_evtchn_netbsd.c
patch-tools_libs_foreignmemory_Makefile
patch-tools_libs_foreignmemory_netbsd.c
patch-tools_libs_foreignmemory_private.h
patch-tools_libs_gnttab_Makefile patch-tools_libs_gnttab_netbsd.c
patch-tools_libxl_libxl__create.c patch-tools_libxl_libxl_dm.c
patch-tools_libxl_libxl_dom.c patch-tools_libxl_libxl_event.c
patch-tools_libxl_libxl_internal.h patch-tools_libxl_libxl_uuid.c
patch-tools_ocaml_common.make patch-tools_ocaml_xenstored_Makefile
patch-tools_ocaml_xenstored_utils.ml
patch-tools_qemu-xen-traditional_Makefile
patch-tools_qemu-xen-traditional_block-raw-posix.c
patch-tools_qemu-xen-traditional_configure
patch-tools_qemu-xen-traditional_hw_e1000.c
patch-tools_qemu-xen-traditional_hw_ide.c
patch-tools_qemu-xen-traditional_hw_pass-through.c
patch-tools_qemu-xen-traditional_hw_pass-through.h
patch-tools_qemu-xen-traditional_hw_piix4acpi.c
patch-tools_qemu-xen-traditional_hw_pt-graphics.c
patch-tools_qemu-xen-traditional_hw_pt-msi.c
patch-tools_qemu-xen-traditional_hw_pt-msi.h
patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak
patch-tools_qemu-xen-traditional_net.c
patch-tools_qemu-xen-traditional_xen-hooks.mak
patch-tools_qemu-xen_audio_audio.c patch-tools_qemu-xen_configure
patch-tools_qemu-xen_net_tap-bsd.c
patch-tools_qemu-xen_qemu-doc.texi
patch-tools_xenpaging_xenpaging.c patch-tools_xenpmd_xenpmd.c
patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c
patch-tools_xenstore_xc.c patch-tools_xenstore_xs_lib.c
patch-tools_xentrace_xentrace.c patch-tools_xl_Makefile
patch-xen_Rules.mk patch-xen_tools_symbols.c
Log Message:
Add xenkernel413 and xentools413 packages, version 4.13.1.
At this time xentools413 will only build on a very recent -current (as of
an hour ago or do - with /usr/include/xen/xenio.h 1.12 or newer)
Xen is a hypervisor which supports running multiple guest operating
systems on a single machine. Guest OSes (also called "domains")
can be either paravirtualised (i.e. make hypercalls in order to
access hardware), run in HVM (Hardware Virtualisation Mode) where
they will be presented with virtual devices, or a combination where
they use hypercalls to access hardware but manage memory themselves.
At boot, the xen kernel is loaded along with the guest kernel for
the first domain (called domain0). domain0 has privileges to access
the physical hardware (PCI and ISA devices), administrate other
domains and provide virtual devices (disks and network) to other
domains.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xenkernel413/DESCR \
pkgsrc/sysutils/xenkernel413/MESSAGE \
pkgsrc/sysutils/xenkernel413/Makefile pkgsrc/sysutils/xenkernel413/PLIST \
pkgsrc/sysutils/xenkernel413/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xenkernel413/patches/patch-Config.mk \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_Makefile \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_Rules.mk \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_Rules.mk \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_boot_build32.mk \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_mm_p2m.c \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_drivers_passthrough_x86_iommu.c \
pkgsrc/sysutils/xenkernel413/patches/patch-xen_tools_symbols.c
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xentools413/DESCR \
pkgsrc/sysutils/xentools413/MESSAGE \
pkgsrc/sysutils/xentools413/MESSAGE.NetBSD \
pkgsrc/sysutils/xentools413/Makefile pkgsrc/sysutils/xentools413/PLIST \
pkgsrc/sysutils/xentools413/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xentools413/files/blk_netbsd.c \
pkgsrc/sysutils/xentools413/files/blktapctrl_netbsd.c \
pkgsrc/sysutils/xentools413/files/locking.sh \
pkgsrc/sysutils/xentools413/files/xen-watchdog.sh \
pkgsrc/sysutils/xentools413/files/xencommons.sh \
pkgsrc/sysutils/xentools413/files/xendomains.sh
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/xentools413/patches/patch-Config.mk \
pkgsrc/sysutils/xentools413/patches/patch-Makefile \
pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl-disk-configuration.5.pod \
pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.1.pod.in \
pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.cfg.5.pod.in \
pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.conf.5.pod \
pkgsrc/sysutils/xentools413/patches/patch-docs_man_xlcpupool.cfg.5.pod \
pkgsrc/sysutils/xentools413/patches/patch-docs_misc_block-scripts.txt \
pkgsrc/sysutils/xentools413/patches/patch-docs_misc_vtd.txt \
pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_Config.mk \
pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_arch_x86_arch.mk \
pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_fcntl.h \
pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_time.h \
pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lib_sys.c \
pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lock.c \
pkgsrc/sysutils/xentools413/patches/patch-m4_paths.m4 \
pkgsrc/sysutils/xentools413/patches/patch-tools_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_Rules.mk \
pkgsrc/sysutils/xentools413/patches/patch-tools_configure \
pkgsrc/sysutils/xentools413/patches/patch-tools_console_daemon_utils.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_examples_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_hvmloader_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_block \
pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-bridge \
pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-ip \
pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_common_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_netbsd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_private.h \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_netbsd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_private.h \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_netbsd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl__create.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dom.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_event.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_internal.h \
pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_uuid.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_common.make \
pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_utils.ml \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_block-raw-posix.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_configure \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_e1000.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_ide.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.h \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_piix4acpi.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-graphics.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.h \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_net.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_xen-hooks.mak \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_audio_audio.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_configure \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap-bsd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_qemu-doc.texi \
pkgsrc/sysutils/xentools413/patches/patch-tools_xenpaging_xenpaging.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_xenpmd_xenpmd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xc.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xs_lib.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_xentrace_xentrace.c \
pkgsrc/sysutils/xentools413/patches/patch-tools_xl_Makefile \
pkgsrc/sysutils/xentools413/patches/patch-xen_Rules.mk \
pkgsrc/sysutils/xentools413/patches/patch-xen_tools_symbols.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Added files:
Index: pkgsrc/sysutils/xenkernel413/DESCR
diff -u /dev/null pkgsrc/sysutils/xenkernel413/DESCR:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/DESCR Tue May 26 11:12:10 2020
@@ -0,0 +1,14 @@
+Xen is a hypervisor which supports running multiple guest operating
+systems on a single machine. Guest OSes (also called "domains")
+can be either paravirtualised (i.e. make hypercalls in order to
+access hardware), run in HVM (Hardware Virtualisation Mode) where
+they will be presented with virtual devices, or a combination where
+they use hypercalls to access hardware but manage memory themselves.
+At boot, the xen kernel is loaded along with the guest kernel for
+the first domain (called domain0). domain0 has privileges to access
+the physical hardware (PCI and ISA devices), administrate other
+domains and provide virtual devices (disks and network) to other
+domains.
+
+This package contains the 4.13 Xen kernel itself. PCI passthrough is
+not supported. PAE is mandatory; on i386 one must use XEN3PAE_DOM[0U].
Index: pkgsrc/sysutils/xenkernel413/MESSAGE
diff -u /dev/null pkgsrc/sysutils/xenkernel413/MESSAGE:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/MESSAGE Tue May 26 11:12:10 2020
@@ -0,0 +1,11 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+The Xen hypervisor is installed under the following locations:
+ ${XENKERNELDIR}/xen.gz (standard hypervisor)
+ ${XENKERNELDIR}/xen-debug.gz (debug hypervisor)
+
+Note that unlike upstream Xen, pv-linear-pt defaults to true.
+You can disable it using pv-linear-pt=false on the Xen command line,
+but then you can't boot NetBSD in PV mode.
+===========================================================================
Index: pkgsrc/sysutils/xenkernel413/Makefile
diff -u /dev/null pkgsrc/sysutils/xenkernel413/Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/Makefile Tue May 26 11:12:10 2020
@@ -0,0 +1,82 @@
+# $NetBSD: Makefile,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+VERSION= 4.13.1
+#PKGREVISION= 1
+DISTNAME= xen-${VERSION}
+PKGNAME= xenkernel413-${VERSION}
+CATEGORIES= sysutils
+MASTER_SITES= https://downloads.xenproject.org/release/xen/${VERSION}/
+DIST_SUBDIR= xen413
+
+MAINTAINER= bouyer%NetBSD.org@localhost
+HOMEPAGE= https://xenproject.org/
+COMMENT= Xen 4.13.x Kernel
+
+LICENSE= gnu-gpl-v2
+
+ONLY_FOR_PLATFORM= Linux-2.6*-x86_64
+ONLY_FOR_PLATFORM+= NetBSD-*.*-x86_64
+
+SSP_SUPPORTED= no
+
+NO_CONFIGURE= yes
+USE_TOOLS+= gmake
+
+PYTHON_FOR_BUILD_ONLY= YES
+
+MAKE_ENV+= OCAML_TOOLS=no
+.if defined(PKGREVISION) && !empty(PKGREVISION) && (${PKGREVISION} != "0")
+MAKE_ENV+= XEN_VENDORVERSION=nb${PKGREVISION}
+.else
+MAKE_ENV+= XEN_VENDORVERSION=nb0
+.endif
+
+INSTALLATION_DIRS= xen413-kernel
+XENKERNELDIR= ${PREFIX}/${INSTALLATION_DIRS}
+
+MESSAGE_SUBST+= XENKERNELDIR=${XENKERNELDIR}
+
+.include "../../mk/compiler.mk"
+.if !empty(PKGSRC_COMPILER:Mclang)
+EXTRA_CFLAGS+= -Qunused-arguments -no-integrated-as -Wno-error=format \
+ -Wno-error=parentheses-equality -Wno-error=enum-conversion \
+ -Wno-error=unused-function -Wno-error=unused-const-variable \
+ -Wno-error=ignored-attributes -Wno-error=constant-conversion \
+ -Wno-error=address-of-packed-member \
+ -Wno-error=initializer-overrides \
+ -Wno-error=tautological-compare
+.elif !empty(PKGSRC_COMPILER:Mgcc)
+EXTRA_CFLAGS+= -falign-functions=16
+.endif
+
+MAKE_ENV+= EXTRA_CFLAGS=${EXTRA_CFLAGS:Q}
+
+do-build:
+ cd ${WRKSRC} && ${BUILD_MAKE_CMD} build-xen
+ ${CP} ${WRKSRC}/xen/xen.gz ${WRKDIR}/xen.gz
+ cd ${WRKSRC} && ${MAKE_PROGRAM} clean
+ echo "CONFIG_DEBUG=y" >> ${WRKSRC}/xen/.config
+ echo "CONFIG_DEBUG_INFO=y" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_DEBUG_LOCK_PROFILE is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_DEBUG_LOCKS is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_DEBUG_TRACE is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_XMEM_POOL_POISON is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_CRASH_DEBUG is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_FRAME_POINTER is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_GCOV is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_LOCK_PROFILE is not set" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_PERF_COUNTERS is not set" >> ${WRKSRC}/xen/.config
+ echo "CONFIG_VERBOSE_DEBUG=y" >> ${WRKSRC}/xen/.config
+ echo "CONFIG_SCRUB_DEBUG=y" >> ${WRKSRC}/xen/.config
+ echo "# CONFIG_UBSAN is not set" >> ${WRKSRC}/xen/.config
+ cd ${WRKSRC} && ${BUILD_MAKE_CMD} build-xen
+ ${CP} ${WRKSRC}/xen/xen.gz ${WRKDIR}/xen-debug.gz
+
+do-install:
+ ${INSTALL_DATA} ${WRKDIR}/xen.gz \
+ ${DESTDIR}${XENKERNELDIR}/xen.gz
+ ${INSTALL_DATA} ${WRKDIR}/xen-debug.gz \
+ ${DESTDIR}${XENKERNELDIR}/xen-debug.gz
+
+.include "../../lang/python/application.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/sysutils/xenkernel413/PLIST
diff -u /dev/null pkgsrc/sysutils/xenkernel413/PLIST:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/PLIST Tue May 26 11:12:10 2020
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+xen413-kernel/xen-debug.gz
+xen413-kernel/xen.gz
Index: pkgsrc/sysutils/xenkernel413/distinfo
diff -u /dev/null pkgsrc/sysutils/xenkernel413/distinfo:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/distinfo Tue May 26 11:12:10 2020
@@ -0,0 +1,14 @@
+$NetBSD: distinfo,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+SHA1 (xen413/xen-4.13.1.tar.gz) = 194a314171120dad0b3c5433104c92343ec884ba
+RMD160 (xen413/xen-4.13.1.tar.gz) = 29cfb90b9da0ede99c1228b8e5964a99547c205d
+SHA512 (xen413/xen-4.13.1.tar.gz) = b56d20704155d98d803496cba83eb928e0f986a750831cd5600fc88d0ae772fe1456571654375054043d2da8daca255cc98385ebf08b1b1a75ecf7f4b7a0ee90
+Size (xen413/xen-4.13.1.tar.gz) = 39024612 bytes
+SHA1 (patch-Config.mk) = 9372a09efd05c9fbdbc06f8121e411fcb7c7ba65
+SHA1 (patch-xen_Makefile) = 465388d80de414ca3bb84faefa0f52d817e423a6
+SHA1 (patch-xen_Rules.mk) = c743dc63f51fc280d529a7d9e08650292c171dac
+SHA1 (patch-xen_arch_x86_Rules.mk) = 0bedfc53a128a87b6a249ae04fbdf6a053bfb70b
+SHA1 (patch-xen_arch_x86_boot_build32.mk) = b82c20de9b86ddaa9d05bbc1ff28f970eb78473c
+SHA1 (patch-xen_arch_x86_mm_p2m.c) = 6e9b84dc8448eca9677f184e720bbfcb3c6d314e
+SHA1 (patch-xen_drivers_passthrough_x86_iommu.c) = 76dd564d5740df587b5ebe4a593dac82ab18edac
+SHA1 (patch-xen_tools_symbols.c) = 6070b3b5ccc38a196283cfc1c52f5d87858beb18
Index: pkgsrc/sysutils/xenkernel413/patches/patch-Config.mk
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-Config.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-Config.mk Tue May 26 11:12:10 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-Config.mk,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+--- Config.mk.orig 2018-04-17 19:21:31.000000000 +0200
++++ Config.mk 2018-04-23 13:29:47.000000000 +0200
+@@ -32,6 +32,9 @@
+ # Tools to run on system hosting the build
+ HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
+ HOSTCFLAGS += -fno-strict-aliasing
++HOSTCFLAGS += ${EXTRA_CFLAGS}
++CFLAGS += ${EXTRA_CFLAGS}
++
+
+ DISTDIR ?= $(XEN_ROOT)/dist
+ DESTDIR ?= /
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_Makefile
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_Makefile Tue May 26 11:12:10 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-xen_Makefile,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+--- xen/Makefile.orig 2018-04-17 19:21:31.000000000 +0200
++++ xen/Makefile 2018-04-23 13:29:47.000000000 +0200
+@@ -167,7 +167,7 @@
+ -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
+ -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
+ -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
+- -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
++ -e 's!@@compiler@@!$(shell $(CC) $(EXTRA_CFLAGS) $(CFLAGS) --version 2>&1 | head -1)!g' \
+ -e 's/@@version@@/$(XEN_VERSION)/g' \
+ -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
+ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_Rules.mk
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_Rules.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_Rules.mk Tue May 26 11:12:10 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-xen_Rules.mk,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+--- xen/Rules.mk.orig 2018-04-23 14:50:02.000000000 +0200
++++ xen/Rules.mk 2018-04-23 14:50:32.000000000 +0200
+@@ -1,4 +1,7 @@
+
++#reset cflags. Why is it needed in pkgsrc ?
++CFLAGS=
++
+ -include $(BASEDIR)/include/config/auto.conf
+
+ include $(XEN_ROOT)/Config.mk
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_Rules.mk
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_Rules.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_Rules.mk Tue May 26 11:12:10 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-xen_arch_x86_Rules.mk,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+--- xen/arch/x86/Rules.mk.orig 2018-04-17 19:21:31.000000000 +0200
++++ xen/arch/x86/Rules.mk 2018-04-23 13:31:24.000000000 +0200
+@@ -8,6 +8,7 @@
+ CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
+ CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
+ CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
++CFLAGS += $(EXTRA_CFLAGS)
+
+ # Prevent floating-point variables from creeping into Xen.
+ CFLAGS += -msoft-float
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_boot_build32.mk
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_boot_build32.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_boot_build32.mk Tue May 26 11:12:10 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-xen_arch_x86_boot_build32.mk,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+linux's toolchain doesn't generate a .eh_frame section but NetBSD does.
+remove it.
+
+--- xen/arch/x86/boot/build32.mk.orig 2018-04-17 19:21:31.000000000 +0200
++++ xen/arch/x86/boot/build32.mk 2018-04-23 13:29:47.000000000 +0200
+@@ -25,7 +25,7 @@
+ exit $$(expr $$idx + 1);; \
+ esac; \
+ done
+- $(OBJCOPY) -O binary -R .got.plt $< $@
++ $(OBJCOPY) -O binary -R .got.plt -R .eh_frame $< $@
+
+ %.lnk: %.o
+ $(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_mm_p2m.c
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_mm_p2m.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_arch_x86_mm_p2m.c Tue May 26 11:12:10 2020
@@ -0,0 +1,21 @@
+$NetBSD: patch-xen_arch_x86_mm_p2m.c,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+silent a noisy warning
+
+--- xen/arch/x86/mm/p2m.c.orig 2020-05-03 21:13:56.173269058 +0200
++++ xen/arch/x86/mm/p2m.c 2020-05-03 21:15:38.477174874 +0200
+@@ -1367,10 +1367,13 @@
+ ret = 0;
+ else
+ ret = -EBUSY;
+- printk(XENLOG_G_WARNING
++
++ if (gfn_l != mfn_x(mfn)) {
++ printk(XENLOG_G_WARNING
+ "Cannot setup identity map d%d:%lx,"
+ " gfn already mapped to %lx.\n",
+ d->domain_id, gfn_l, mfn_x(mfn));
++ }
+ }
+
+ gfn_unlock(p2m, gfn, 0);
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_drivers_passthrough_x86_iommu.c
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_drivers_passthrough_x86_iommu.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_drivers_passthrough_x86_iommu.c Tue May 26 11:12:10 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-xen_drivers_passthrough_x86_iommu.c,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+Silent noisy warning
+
+--- xen/drivers/passthrough/x86/iommu.c.orig 2020-05-03 22:03:37.840754709 +0200
++++ xen/drivers/passthrough/x86/iommu.c 2020-05-03 22:04:36.676914512 +0200
+@@ -234,7 +234,7 @@
+ rc = iommu_map(d, _dfn(pfn), _mfn(pfn), PAGE_ORDER_4K,
+ IOMMUF_readable | IOMMUF_writable, &flush_flags);
+
+- if ( rc )
++ if ( rc && (!paging_mode_translate(d) || rc != -16) )
+ printk(XENLOG_WARNING "%pd: identity %smapping of %lx failed: %d\n",
+ d, !paging_mode_translate(d) ? "IOMMU " : "", pfn, rc);
+
Index: pkgsrc/sysutils/xenkernel413/patches/patch-xen_tools_symbols.c
diff -u /dev/null pkgsrc/sysutils/xenkernel413/patches/patch-xen_tools_symbols.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xenkernel413/patches/patch-xen_tools_symbols.c Tue May 26 11:12:10 2020
@@ -0,0 +1,19 @@
+$NetBSD: patch-xen_tools_symbols.c,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+fix "error: array subscript has type 'char'"
+
+--- xen/tools/symbols.c.orig 2018-04-17 19:21:31.000000000 +0200
++++ xen/tools/symbols.c 2018-04-23 13:29:47.000000000 +0200
+@@ -173,11 +173,11 @@
+ /* include the type field in the symbol name, so that it gets
+ * compressed together */
+ s->len = strlen(str) + 1;
+- if (islower(stype) && filename)
++ if (islower((uint8_t)stype) && filename)
+ s->len += strlen(filename) + 1;
+ s->sym = malloc(s->len + 1);
+ sym = SYMBOL_NAME(s);
+- if (islower(stype) && filename) {
++ if (islower((uint8_t)stype) && filename) {
+ sym = stpcpy(sym, filename);
+ *sym++ = '#';
+ }
Index: pkgsrc/sysutils/xentools413/DESCR
diff -u /dev/null pkgsrc/sysutils/xentools413/DESCR:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/DESCR Tue May 26 11:12:10 2020
@@ -0,0 +1,5 @@
+The Xen virtual machine monitor allows running several virtual machines
+on a single physical machine. The xentools413 package contains the
+tools to create, destroy and control the virtual machines.
+
+This package contains the tools for Xen 4.13.x
Index: pkgsrc/sysutils/xentools413/MESSAGE
diff -u /dev/null pkgsrc/sysutils/xentools413/MESSAGE:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/MESSAGE Tue May 26 11:12:10 2020
@@ -0,0 +1,11 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+Please note that the xm command has been removed.
+You have to switch to the xl command, which is now functional on NetBSD.
+
+Also note that the rc.d scripts have been updated in this version.
+If you don't use PKG_RCD_SCRIPTS=YES then it is very important for
+you to copy the new rc.d scripts to /etc/rc.d.
+
+===========================================================================
Index: pkgsrc/sysutils/xentools413/MESSAGE.NetBSD
diff -u /dev/null pkgsrc/sysutils/xentools413/MESSAGE.NetBSD:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/MESSAGE.NetBSD Tue May 26 11:12:10 2020
@@ -0,0 +1,17 @@
+===========================================================================
+$NetBSD: MESSAGE.NetBSD,v 1.1 2020/05/26 11:12:10 bouyer 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
+
+===========================================================================
Index: pkgsrc/sysutils/xentools413/Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/Makefile Tue May 26 11:12:10 2020
@@ -0,0 +1,256 @@
+# $NetBSD: Makefile,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+#
+VERSION= 4.13.1
+
+DIST_SUBDIR= xen413
+DISTNAME= xen-${VERSION}
+PKGNAME= xentools413-${VERSION}
+#PKGREVISION= 2
+CATEGORIES= sysutils
+MASTER_SITES= https://downloads.xenproject.org/release/xen/${VERSION}/
+
+DISTFILES= ${DISTNAME}.tar.gz
+
+MAINTAINER= bouyer%NetBSD.org@localhost
+HOMEPAGE= https://xenproject.org/
+COMMENT= Userland Tools for Xen 4.13.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
+DEPENDS+= ${PYPKGPREFIX}-curses>=0:../../devel/py-curses
+
+PKG_SYSCONFSUBDIR= xen
+
+ONLY_FOR_PLATFORM= Linux-2.6*-x86_64
+ONLY_FOR_PLATFORM+= NetBSD-9.99.6[4-9]-x86_64 NetBSD-9.99.[7-9]*-x86_64
+
+SSP_SUPPORTED= no
+
+CONFLICTS+= libxen-[0-9]*
+CONFLICTS+= xenstoretools-[0-9]*
+
+CHECK_PORTABILITY_SKIP= tools/examples/* \
+ tools/qemu-xen/scripts/qemu-binfmt-conf.sh
+CHECK_RELRO_SKIP= libexec/xen/boot/hvmloader
+
+EGDIR= ${PREFIX}/share/examples/xen
+MESSAGE_SUBST+= EGDIR=${EGDIR}
+
+USE_TOOLS+= pod2man gmake pkg-config makeinfo perl bash cmake
+USE_LANGUAGES= c
+
+GNU_CONFIGURE= YES
+#CONFIGURE_ARGS+= --enable-xenapi
+CONFIGURE_ARGS+= --disable-seabios
+CONFIGURE_ARGS+= --disable-ipxe
+
+CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASE}
+
+MAKE_ENV+= PREFIX=${prefix:Q} WRKSRC=${WRKSRC}
+MAKE_ENV+= APPEND_LIB=${LDFLAGS:Q}
+MAKE_ENV+= XEN_EXAMPLES_DIR=${EGDIR}
+MAKE_ENV+= MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
+MAKE_ENV+= V=YES
+MAKE_ENV+= NO_WERROR=1
+
+PY_PATCHPLIST= yes
+REPLACE_PYTHON+= tools/misc/xen-bugtool tools/misc/xen-ringwatch
+REPLACE_PYTHON+= tools/misc/xencons
+REPLACE_PYTHON+= tools/misc/xenpvnetboot tools/misc/xensymoops
+REPLACE_PYTHON+= tools/python/scripts/convert-legacy-stream
+REPLACE_PYTHON+= tools/python/scripts/verify-stream-v2
+REPLACE_PYTHON+= tools/xenmon/xenmon.py tools/misc/xencov_split
+
+SUBST_CLASSES+= perlpath
+SUBST_STAGE.perlpath= pre-configure
+SUBST_FILES.perlpath= tools/misc/xencov_split
+SUBST_FILES.perlpath+= tools/firmware/rombios/makesym.perl
+SUBST_FILES.perlpath+= tools/qemu-xen-traditional/texi2pod.pl
+SUBST_FILES.perlpath+= tools/examples/xeninfo.pl
+SUBST_FILES.perlpath+= tools/include/xen-external/bsd-sys-queue-h-seddery
+SUBST_FILES.perlpath+= tools/qemu-xen/scripts/texi2pod.pl
+SUBST_FILES.perlpath+= tools/qemu-xen/scripts/get_maintainer.pl
+SUBST_FILES.perlpath+= tools/qemu-xen/scripts/checkpatch.pl
+SUBST_FILES.perlpath+= tools/libxl/libxl_save_msgs_gen.pl
+SUBST_FILES.perlpath+= tools/libxl/check-libxl-api-rules
+SUBST_SED.perlpath= -e "s|/usr/bin/perl|${PREFIX}/bin/perl|g"
+
+SUBST_CLASSES+= pathsvar
+SUBST_STAGE.pathsvar= pre-configure
+SUBST_FILES.pathsvar= tools/Makefile \
+ tools/hotplug/Linux/init.d/sysconfig.xendomains
+SUBST_SED.pathsvar= -e "s|/var/lib|${VARBASE}/run|g"
+
+SUBST_CLASSES+= conf
+SUBST_STAGE.conf= pre-configure
+SUBST_FILES.conf+= tools/ocaml/xenstored/define.ml
+SUBST_FILES.conf+= tools/libxl/xl_cmdtable.c
+SUBST_FILES.conf+= docs/misc/block-scripts.txt
+SUBST_FILES.conf+= docs/misc/vtd.txt
+SUBST_SED.conf= -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g"
+
+XEND_SCRIPTS= block vif-bridge vif-ip qemu-ifup hotplugpath.sh locking.sh
+
+SUBST_CLASSES.NetBSD+= proc
+SUBST_STAGE.proc= pre-configure
+SUBST_FILES.proc+= tools/ocaml/xenstored/define.ml
+SUBST_SED.proc= -e "s|/proc|/kern|g"
+
+SUBST_CLASSES+= getopt
+SUBST_STAGE.getopt= pre-configure
+SUBST_MESSAGE.getopt= Fixing getopt_long_only
+SUBST_FILES.getopt+= tools/fuzz/x86_instruction_emulator/afl-harness.c
+SUBST_SED.getopt+= -e 's,getopt_long_only,getopt_long,'
+
+OPSYSVARS+= PROCPATH
+PROCPATH.NetBSD= /kern
+PROCPATH.*= /proc
+
+.include "../../mk/bsd.prefs.mk"
+
+SUBST_CLASSES+= procdev
+SUBST_STAGE.procdev= pre-configure
+SUBST_FILES.procdev= tools/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 xendomains
+FILES_SUBST+= RCD_INTERPRETER=${PYTHONBIN:Q}
+FILES_SUBST+= PROCPATH=${PROCPATH:Q}
+FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
+FILES_SUBST+= PREFIX=${PREFIX}
+
+CONF_FILES+= ${EGDIR}/xl.conf ${PKG_SYSCONFDIR}/xl.conf
+CONF_FILES+= ${EGDIR}/oxenstored.conf ${PKG_SYSCONFDIR}/oxenstored.conf
+
+OWN_DIRS= ${PKG_SYSCONFDIR}/scripts ${VARBASE}/log/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
+ ${CP} -f ${FILESDIR}/locking.sh ${WRKSRC}/tools/hotplug/NetBSD/
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xenstore-chmod.1.pod |\
+ pod2man -n xenstore-chmod >${WRKDIR}/xenstore-chmod.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xenstore-ls.1.pod |\
+ pod2man -n xenstore-ls >${WRKDIR}/xenstore-ls.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xenstore.1.pod |\
+ pod2man -n xenstore >${WRKDIR}/xenstore.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xentop.1.pod |\
+ pod2man -n xentop >${WRKDIR}/xentop.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xentrace.8.pod |\
+ pod2man -n xentrace >${WRKDIR}/xentrace.8
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xentrace_format.1.pod |\
+ pod2man -n xenstore_format >${WRKDIR}/xentrace_format.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xl.cfg.5.pod.in |\
+ pod2man -n xl.cfg >${WRKDIR}/xl.cfg.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xl.conf.5.pod |\
+ pod2man -n xl.conf >${WRKDIR}/xl.conf.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xl.1.pod.in |\
+ pod2man -n xl >${WRKDIR}/xl.1
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xlcpupool.cfg.5.pod |\
+ pod2man -n xlcpupool.cfg >${WRKDIR}/xlcpupool.cfg.5
+ ${SED} -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g" \
+ ${WRKSRC}/docs/man/xl-disk-configuration.5.pod |\
+ pod2man -n xl-disk-configuration >${WRKDIR}/xl-disk-configuration.5
+
+INSTALLATION_DIRS= ${EGDIR} ${PKGMANDIR}/man1 ${PKGMANDIR}/man5
+INSTALLATION_DIRS+= ${PKGMANDIR}/man8 share/doc/xen
+
+BUILD_DEFS+= VARBASE
+
+do-build:
+ cd ${WRKSRC} && ${BUILD_MAKE_CMD} build-tools
+
+do-install:
+ cd ${WRKSRC} && ${BUILD_MAKE_CMD} DESTDIR=${DESTDIR} install-tools
+
+post-install:
+ ${INSTALL_MAN} ${WRKDIR}/xenstore-chmod.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_MAN} ${WRKDIR}/xenstore-ls.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_MAN} ${WRKDIR}/xenstore.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_MAN} ${WRKDIR}/xentop.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_MAN} ${WRKDIR}/xentrace.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
+ ${INSTALL_MAN} ${WRKDIR}/xentrace_format.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_MAN} ${WRKDIR}/xl.cfg.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+ ${INSTALL_MAN} ${WRKDIR}/xl.conf.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+ ${INSTALL_MAN} ${WRKDIR}/xl.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+ ${INSTALL_MAN} ${WRKDIR}/xlcpupool.cfg.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
+.for f in \
+ gamd-ucode-container.txt gqemu-backends.txt \
+ gblock-scripts.txt gqemu-deprivilege.txt \
+ gconsole.txt gstubdom.txt \
+ gcrashdb.txt gvtd-pi.txt \
+ gdistro_mapping.txt gvtd.txt \
+ gdump-core-format.txt gvtpm-platforms.txt \
+ ggrant-tables.txt gxen-error-handling.txt \
+ gkconfig-language.txt gxenmon.txt \
+ gkconfig.txt gxenpaging.txt \
+ gkexec_and_kdump.txt gxenstore-ring.txt \
+ glibxl_memory.txt gxenstore.txt \
+ gprintk-formats.txt gxsm-flask.txt \
+ ${INSTALL_DATA} ${WRKSRC}/docs/misc/$f ${DESTDIR}${PREFIX}/share/doc/xen
+.endfor
+
+.if (${OPSYS} == "NetBSD" && \
+ (empty(OS_VERSION:M6.99.[3-9]?) && empty(OS_VERSION:M[7-9].*)))
+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 \
+ -Wno-error=unused-function -Wno-error=format \
+ -Wno-error=unused-const-variable \
+ -Wno-error=gnu-designator -Wno-error=uninitialized \
+ -Wno-error=parentheses-equality \
+ -Wno-error=enum-conversion \
+ -Wno-error=address-of-packed-member
+BUILDLINK_TRANSFORM+= rm:-falign-jumps=1 rm:-falign-loops=1 \
+ rm:-mpreferred-stack-boundary=2
+.endif
+
+MAKE_ENV+= EXTRA_HOSTCFLAGS=${EXTRA_HOSTCFLAGS:Q} EXTRA_CFLAGS=${EXTRA_CFLAGS:M*:Q} TARGET_CC=${TARGET_CC}
+
+.include "../../lang/python/application.mk"
+.include "../../lang/python/extension.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 "../../devel/argp/buildlink3.mk"
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../x11/pixman/buildlink3.mk"
+
+.include "../../mk/curses.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/sysutils/xentools413/PLIST
diff -u /dev/null pkgsrc/sysutils/xentools413/PLIST:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/PLIST Tue May 26 11:12:10 2020
@@ -0,0 +1,532 @@
+@comment $NetBSD: PLIST,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+${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}/pygrub-0.6-py${PYVERSSUFFIX}.egg-info
+${PYSITELIB}/xen-3.0-py${PYVERSSUFFIX}.egg-info
+${PYSITELIB}/xenfsimage.so
+${PYSITELIB}/xen/__init__.py
+${PYSITELIB}/xen/__init__.pyc
+${PYSITELIB}/xen/lowlevel/__init__.py
+${PYSITELIB}/xen/lowlevel/__init__.pyc
+${PYSITELIB}/xen/lowlevel/xc.so
+${PYSITELIB}/xen/lowlevel/xs.so
+${PYSITELIB}/xen/migration/__init__.py
+${PYSITELIB}/xen/migration/__init__.pyc
+${PYSITELIB}/xen/migration/legacy.py
+${PYSITELIB}/xen/migration/legacy.pyc
+${PYSITELIB}/xen/migration/libxc.py
+${PYSITELIB}/xen/migration/libxc.pyc
+${PYSITELIB}/xen/migration/libxl.py
+${PYSITELIB}/xen/migration/libxl.pyc
+${PYSITELIB}/xen/migration/public.py
+${PYSITELIB}/xen/migration/public.pyc
+${PYSITELIB}/xen/migration/tests.py
+${PYSITELIB}/xen/migration/tests.pyc
+${PYSITELIB}/xen/migration/verify.py
+${PYSITELIB}/xen/migration/verify.pyc
+${PYSITELIB}/xen/migration/xl.py
+${PYSITELIB}/xen/migration/xl.pyc
+bin/pygrub
+bin/qemu-img-xen
+bin/xen-cpuid
+bin/xen-detect
+bin/xenalyze
+bin/xencons
+bin/xencov_split
+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_format
+include/_libxl_list.h
+include/_libxl_types.h
+include/_libxl_types_json.h
+include/libxl.h
+include/libxl_event.h
+include/libxl_json.h
+include/libxl_utils.h
+include/libxl_uuid.h
+include/libxlutil.h
+include/xen/COPYING
+include/xen/arch-arm.h
+include/xen/arch-arm/hvm/save.h
+include/xen/arch-x86/cpufeatureset.h
+include/xen/arch-x86/cpuid.h
+include/xen/arch-x86/hvm/save.h
+include/xen/arch-x86/hvm/start_info.h
+include/xen/arch-x86/pmu.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/argo.h
+include/xen/callback.h
+include/xen/device_tree_defs.h
+include/xen/dom0_ops.h
+include/xen/domctl.h
+include/xen/elfnote.h
+include/xen/errno.h
+include/xen/event_channel.h
+include/xen/features.h
+include/xen/foreign/arm32.h
+include/xen/foreign/arm64.h
+include/xen/foreign/x86_32.h
+include/xen/foreign/x86_64.h
+include/xen/grant_table.h
+include/xen/hvm/dm_op.h
+include/xen/hvm/e820.h
+include/xen/hvm/hvm_info_table.h
+include/xen/hvm/hvm_op.h
+include/xen/hvm/hvm_vcpu.h
+include/xen/hvm/hvm_xs_strings.h
+include/xen/hvm/ioreq.h
+include/xen/hvm/params.h
+include/xen/hvm/pvdrivers.h
+include/xen/hvm/save.h
+include/xen/io/9pfs.h
+include/xen/io/blkif.h
+include/xen/io/cameraif.h
+include/xen/io/console.h
+include/xen/io/displif.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/pvcalls.h
+include/xen/io/ring.h
+include/xen/io/sndif.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/memory.h
+include/xen/nmi.h
+include/xen/physdev.h
+include/xen/platform.h
+include/xen/pmu.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/vm_event.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/xencall.h
+include/xenctrl.h
+include/xenctrl_compat.h
+include/xendevicemodel.h
+include/xenevtchn.h
+include/xenforeignmemory.h
+include/xenfsimage.h
+include/xenfsimage_grub.h
+include/xenfsimage_plugin.h
+include/xengnttab.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/xentoolcore.h
+include/xentoollog.h
+include/xs.h
+include/xs_lib.h
+lib/debug${LOCALBASE}/libexec/xen/boot/xen-shim-syms
+lib/libxencall.a
+lib/libxencall.so
+lib/libxencall.so.1
+lib/libxencall.so.1.2
+lib/libxenctrl.a
+lib/libxenctrl.so
+lib/libxenctrl.so.4.13
+lib/libxenctrl.so.4.13.0
+lib/libxendevicemodel.a
+lib/libxendevicemodel.so
+lib/libxendevicemodel.so.1
+lib/libxendevicemodel.so.1.3
+lib/libxenevtchn.a
+lib/libxenevtchn.so
+lib/libxenevtchn.so.1
+lib/libxenevtchn.so.1.1
+lib/libxenforeignmemory.a
+lib/libxenforeignmemory.so
+lib/libxenforeignmemory.so.1
+lib/libxenforeignmemory.so.1.3
+lib/libxenfsimage.so
+lib/libxenfsimage.so.4.13
+lib/libxenfsimage.so.4.13.0
+lib/libxengnttab.a
+lib/libxengnttab.so
+lib/libxengnttab.so.1
+lib/libxengnttab.so.1.2
+lib/libxenguest.a
+lib/libxenguest.so
+lib/libxenguest.so.4.13
+lib/libxenguest.so.4.13.0
+lib/libxenlight.a
+lib/libxenlight.so
+lib/libxenlight.so.4.13
+lib/libxenlight.so.4.13.0
+lib/libxenstat.a
+lib/libxenstat.so
+lib/libxenstat.so.4.13
+lib/libxenstat.so.4.13.0
+lib/libxenstore.a
+lib/libxenstore.so
+lib/libxenstore.so.3.0
+lib/libxenstore.so.3.0.3
+lib/libxentoolcore.a
+lib/libxentoolcore.so
+lib/libxentoolcore.so.1
+lib/libxentoolcore.so.1.0
+lib/libxentoollog.a
+lib/libxentoollog.so
+lib/libxentoollog.so.1
+lib/libxentoollog.so.1.0
+lib/libxlutil.a
+lib/libxlutil.so
+lib/libxlutil.so.4.13
+lib/libxlutil.so.4.13.0
+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
+lib/ocaml/site-lib/xentoollog/META
+lib/ocaml/site-lib/xentoollog/dllxentoollog_stubs.so
+lib/ocaml/site-lib/xentoollog/libxentoollog_stubs.a
+lib/ocaml/site-lib/xentoollog/xentoollog.a
+lib/ocaml/site-lib/xentoollog/xentoollog.cma
+lib/ocaml/site-lib/xentoollog/xentoollog.cmi
+lib/ocaml/site-lib/xentoollog/xentoollog.cmx
+lib/ocaml/site-lib/xentoollog/xentoollog.cmxa
+lib/pkgconfig/xencall.pc
+lib/pkgconfig/xencontrol.pc
+lib/pkgconfig/xendevicemodel.pc
+lib/pkgconfig/xenevtchn.pc
+lib/pkgconfig/xenforeignmemory.pc
+lib/pkgconfig/xengnttab.pc
+lib/pkgconfig/xenguest.pc
+lib/pkgconfig/xenlight.pc
+lib/pkgconfig/xenstat.pc
+lib/pkgconfig/xenstore.pc
+lib/pkgconfig/xentoolcore.pc
+lib/pkgconfig/xentoollog.pc
+lib/pkgconfig/xlutil.pc
+lib/xenfsimage/ext2fs/fsimage.so
+lib/xenfsimage/fat/fsimage.so
+lib/xenfsimage/iso9660/fsimage.so
+lib/xenfsimage/reiserfs/fsimage.so
+lib/xenfsimage/ufs/fsimage.so
+lib/xenfsimage/xfs/fsimage.so
+lib/xenfsimage/zfs/fsimage.so
+libexec/xen/bin/convert-legacy-stream
+libexec/xen/bin/libxl-save-helper
+libexec/xen/bin/lsevtchn
+libexec/xen/bin/pygrub
+libexec/xen/bin/qemu-dm
+libexec/xen/bin/qemu-edid
+libexec/xen/bin/qemu-img
+libexec/xen/bin/qemu-io
+libexec/xen/bin/qemu-nbd
+libexec/xen/bin/qemu-system-i386
+libexec/xen/bin/readnotes
+libexec/xen/bin/verify-stream-v2
+libexec/xen/bin/xen-init-dom0
+libexec/xen/bin/xenconsole
+libexec/xen/bin/xenctx
+libexec/xen/bin/xenpaging
+libexec/xen/bin/xenpvnetboot
+libexec/xen/boot/hvmloader
+libexec/xen/boot/xen-shim
+man/man1/xenstore-chmod.1
+man/man1/xenstore-ls.1
+man/man1/xenstore.1
+man/man1/xentop.1
+man/man1/xentrace_format.1
+man/man1/xl.1
+man/man5/xl.cfg.5
+man/man5/xl.conf.5
+man/man5/xlcpupool.cfg.5
+man/man8/xentrace.8
+sbin/flask-get-bool
+sbin/flask-getenforce
+sbin/flask-label-pci
+sbin/flask-loadpolicy
+sbin/flask-set-bool
+sbin/flask-setenforce
+sbin/gdbsx
+sbin/oxenstored
+sbin/xen-diag
+sbin/xen-hptool
+sbin/xen-hvmcrash
+sbin/xen-hvmctx
+sbin/xen-kdd
+sbin/xen-livepatch
+sbin/xen-lowmemd
+sbin/xen-mfndump
+sbin/xen-ucode
+sbin/xenbaked
+sbin/xenconsoled
+sbin/xencov
+sbin/xenlockprof
+sbin/xenmon
+sbin/xenperf
+sbin/xenpm
+sbin/xenpmd
+sbin/xenstored
+sbin/xentop
+sbin/xentrace
+sbin/xentrace_setmask
+sbin/xentrace_setsize
+sbin/xenwatchdogd
+sbin/xl
+share/examples/xen/README
+share/examples/xen/README.incompatibilities
+share/examples/xen/cpupool
+share/examples/xen/oxenstored.conf
+share/examples/xen/scripts/block
+share/examples/xen/scripts/hotplugpath.sh
+share/examples/xen/scripts/locking.sh
+share/examples/xen/scripts/qemu-ifup
+share/examples/xen/scripts/vif-bridge
+share/examples/xen/scripts/vif-ip
+share/examples/xen/xl.conf
+share/examples/xen/xl.sh
+share/examples/xen/xlexample.hvm
+share/examples/xen/xlexample.pvlinux
+share/qemu-xen/applications/qemu.desktop
+share/qemu-xen/icons/hicolor/128x128/apps/qemu.png
+share/qemu-xen/icons/hicolor/16x16/apps/qemu.png
+share/qemu-xen/icons/hicolor/24x24/apps/qemu.png
+share/qemu-xen/icons/hicolor/256x256/apps/qemu.png
+share/qemu-xen/icons/hicolor/32x32/apps/qemu.bmp
+share/qemu-xen/icons/hicolor/32x32/apps/qemu.png
+share/qemu-xen/icons/hicolor/48x48/apps/qemu.png
+share/qemu-xen/icons/hicolor/512x512/apps/qemu.png
+share/qemu-xen/icons/hicolor/64x64/apps/qemu.png
+share/qemu-xen/icons/hicolor/scalable/apps/qemu.svg
+share/qemu-xen/qemu/QEMU,cgthree.bin
+share/qemu-xen/qemu/QEMU,tcx.bin
+share/qemu-xen/qemu/bamboo.dtb
+share/qemu-xen/qemu/bios-256k.bin
+share/qemu-xen/qemu/bios.bin
+share/qemu-xen/qemu/canyonlands.dtb
+share/qemu-xen/qemu/edk2-aarch64-code.fd
+share/qemu-xen/qemu/edk2-arm-code.fd
+share/qemu-xen/qemu/edk2-arm-vars.fd
+share/qemu-xen/qemu/edk2-i386-code.fd
+share/qemu-xen/qemu/edk2-i386-secure-code.fd
+share/qemu-xen/qemu/edk2-i386-vars.fd
+share/qemu-xen/qemu/edk2-licenses.txt
+share/qemu-xen/qemu/edk2-x86_64-code.fd
+share/qemu-xen/qemu/edk2-x86_64-secure-code.fd
+share/qemu-xen/qemu/efi-e1000.rom
+share/qemu-xen/qemu/efi-e1000e.rom
+share/qemu-xen/qemu/efi-eepro100.rom
+share/qemu-xen/qemu/efi-ne2k_pci.rom
+share/qemu-xen/qemu/efi-pcnet.rom
+share/qemu-xen/qemu/efi-rtl8139.rom
+share/qemu-xen/qemu/efi-virtio.rom
+share/qemu-xen/qemu/efi-vmxnet3.rom
+share/qemu-xen/qemu/firmware/50-edk2-i386-secure.json
+share/qemu-xen/qemu/firmware/50-edk2-x86_64-secure.json
+share/qemu-xen/qemu/firmware/60-edk2-aarch64.json
+share/qemu-xen/qemu/firmware/60-edk2-arm.json
+share/qemu-xen/qemu/firmware/60-edk2-i386.json
+share/qemu-xen/qemu/firmware/60-edk2-x86_64.json
+share/qemu-xen/qemu/hppa-firmware.img
+share/qemu-xen/qemu/keymaps/ar
+share/qemu-xen/qemu/keymaps/bepo
+share/qemu-xen/qemu/keymaps/cz
+share/qemu-xen/qemu/keymaps/da
+share/qemu-xen/qemu/keymaps/de
+share/qemu-xen/qemu/keymaps/de-ch
+share/qemu-xen/qemu/keymaps/en-gb
+share/qemu-xen/qemu/keymaps/en-us
+share/qemu-xen/qemu/keymaps/es
+share/qemu-xen/qemu/keymaps/et
+share/qemu-xen/qemu/keymaps/fi
+share/qemu-xen/qemu/keymaps/fo
+share/qemu-xen/qemu/keymaps/fr
+share/qemu-xen/qemu/keymaps/fr-be
+share/qemu-xen/qemu/keymaps/fr-ca
+share/qemu-xen/qemu/keymaps/fr-ch
+share/qemu-xen/qemu/keymaps/hr
+share/qemu-xen/qemu/keymaps/hu
+share/qemu-xen/qemu/keymaps/is
+share/qemu-xen/qemu/keymaps/it
+share/qemu-xen/qemu/keymaps/ja
+share/qemu-xen/qemu/keymaps/lt
+share/qemu-xen/qemu/keymaps/lv
+share/qemu-xen/qemu/keymaps/mk
+share/qemu-xen/qemu/keymaps/nl
+share/qemu-xen/qemu/keymaps/no
+share/qemu-xen/qemu/keymaps/pl
+share/qemu-xen/qemu/keymaps/pt
+share/qemu-xen/qemu/keymaps/pt-br
+share/qemu-xen/qemu/keymaps/ru
+share/qemu-xen/qemu/keymaps/sl
+share/qemu-xen/qemu/keymaps/sv
+share/qemu-xen/qemu/keymaps/th
+share/qemu-xen/qemu/keymaps/tr
+share/qemu-xen/qemu/kvmvapic.bin
+share/qemu-xen/qemu/linuxboot.bin
+share/qemu-xen/qemu/linuxboot_dma.bin
+share/qemu-xen/qemu/multiboot.bin
+share/qemu-xen/qemu/openbios-ppc
+share/qemu-xen/qemu/openbios-sparc32
+share/qemu-xen/qemu/openbios-sparc64
+share/qemu-xen/qemu/opensbi-riscv32-virt-fw_jump.bin
+share/qemu-xen/qemu/opensbi-riscv64-sifive_u-fw_jump.bin
+share/qemu-xen/qemu/opensbi-riscv64-virt-fw_jump.bin
+share/qemu-xen/qemu/palcode-clipper
+share/qemu-xen/qemu/petalogix-ml605.dtb
+share/qemu-xen/qemu/petalogix-s3adsp1800.dtb
+share/qemu-xen/qemu/ppc_rom.bin
+share/qemu-xen/qemu/pvh.bin
+share/qemu-xen/qemu/pxe-e1000.rom
+share/qemu-xen/qemu/pxe-eepro100.rom
+share/qemu-xen/qemu/pxe-ne2k_pci.rom
+share/qemu-xen/qemu/pxe-pcnet.rom
+share/qemu-xen/qemu/pxe-rtl8139.rom
+share/qemu-xen/qemu/pxe-virtio.rom
+share/qemu-xen/qemu/qemu-nsis.bmp
+share/qemu-xen/qemu/qemu_vga.ndrv
+share/qemu-xen/qemu/s390-ccw.img
+share/qemu-xen/qemu/s390-netboot.img
+share/qemu-xen/qemu/sgabios.bin
+share/qemu-xen/qemu/skiboot.lid
+share/qemu-xen/qemu/slof.bin
+share/qemu-xen/qemu/spapr-rtas.bin
+share/qemu-xen/qemu/trace-events-all
+share/qemu-xen/qemu/u-boot-sam460-20100605.bin
+share/qemu-xen/qemu/u-boot.e500
+share/qemu-xen/qemu/vgabios-ati.bin
+share/qemu-xen/qemu/vgabios-bochs-display.bin
+share/qemu-xen/qemu/vgabios-cirrus.bin
+share/qemu-xen/qemu/vgabios-qxl.bin
+share/qemu-xen/qemu/vgabios-ramfb.bin
+share/qemu-xen/qemu/vgabios-stdvga.bin
+share/qemu-xen/qemu/vgabios-virtio.bin
+share/qemu-xen/qemu/vgabios-vmware.bin
+share/qemu-xen/qemu/vgabios.bin
+share/xen/qemu/bamboo.dtb
+share/xen/qemu/bios.bin
+share/xen/qemu/keymaps/ar
+share/xen/qemu/keymaps/common
+share/xen/qemu/keymaps/da
+share/xen/qemu/keymaps/de
+share/xen/qemu/keymaps/de-ch
+share/xen/qemu/keymaps/en-gb
+share/xen/qemu/keymaps/en-us
+share/xen/qemu/keymaps/es
+share/xen/qemu/keymaps/et
+share/xen/qemu/keymaps/fi
+share/xen/qemu/keymaps/fo
+share/xen/qemu/keymaps/fr
+share/xen/qemu/keymaps/fr-be
+share/xen/qemu/keymaps/fr-ca
+share/xen/qemu/keymaps/fr-ch
+share/xen/qemu/keymaps/hr
+share/xen/qemu/keymaps/hu
+share/xen/qemu/keymaps/is
+share/xen/qemu/keymaps/it
+share/xen/qemu/keymaps/ja
+share/xen/qemu/keymaps/lt
+share/xen/qemu/keymaps/lv
+share/xen/qemu/keymaps/mk
+share/xen/qemu/keymaps/modifiers
+share/xen/qemu/keymaps/nl
+share/xen/qemu/keymaps/nl-be
+share/xen/qemu/keymaps/no
+share/xen/qemu/keymaps/pl
+share/xen/qemu/keymaps/pt
+share/xen/qemu/keymaps/pt-br
+share/xen/qemu/keymaps/ru
+share/xen/qemu/keymaps/sl
+share/xen/qemu/keymaps/sv
+share/xen/qemu/keymaps/th
+share/xen/qemu/keymaps/tr
+share/xen/qemu/openbios-ppc
+share/xen/qemu/openbios-sparc32
+share/xen/qemu/openbios-sparc64
+share/xen/qemu/ppc_rom.bin
+share/xen/qemu/pxe-e1000.bin
+share/xen/qemu/pxe-ne2k_pci.bin
+share/xen/qemu/pxe-pcnet.bin
+share/xen/qemu/pxe-rtl8139.bin
+share/xen/qemu/vgabios-cirrus.bin
+share/xen/qemu/vgabios.bin
+share/xen/qemu/video.x
+@pkgdir share/examples/xen/auto
Index: pkgsrc/sysutils/xentools413/distinfo
diff -u /dev/null pkgsrc/sysutils/xentools413/distinfo:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/distinfo Tue May 26 11:12:10 2020
@@ -0,0 +1,80 @@
+$NetBSD: distinfo,v 1.1 2020/05/26 11:12:10 bouyer Exp $
+
+SHA1 (xen413/xen-4.13.1.tar.gz) = 194a314171120dad0b3c5433104c92343ec884ba
+RMD160 (xen413/xen-4.13.1.tar.gz) = 29cfb90b9da0ede99c1228b8e5964a99547c205d
+SHA512 (xen413/xen-4.13.1.tar.gz) = b56d20704155d98d803496cba83eb928e0f986a750831cd5600fc88d0ae772fe1456571654375054043d2da8daca255cc98385ebf08b1b1a75ecf7f4b7a0ee90
+Size (xen413/xen-4.13.1.tar.gz) = 39024612 bytes
+SHA1 (patch-Config.mk) = c41005a60de2f94a72b0206030eb021c137653d3
+SHA1 (patch-Makefile) = 6c580cbea532d08a38cf5e54228bd0210a98da21
+SHA1 (patch-docs_man_xl-disk-configuration.5.pod) = 9261cc5035dba3414e32955da80707baab042476
+SHA1 (patch-docs_man_xl.1.pod.in) = ac3525478471a43fd30fa40c7e89d4b5cb164038
+SHA1 (patch-docs_man_xl.cfg.5.pod.in) = 5970961552f29c4536a884161a208a27a20dccf4
+SHA1 (patch-docs_man_xl.conf.5.pod) = 357d941b9c2e875de0b7203bfbe7e8b7b1e140c0
+SHA1 (patch-docs_man_xlcpupool.cfg.5.pod) = ab3a2529cd10458948557fd7ab032e80df8b1d81
+SHA1 (patch-docs_misc_block-scripts.txt) = 29a49edc4d15c4c8db822fd1d6356d07aeb27b86
+SHA1 (patch-docs_misc_vtd.txt) = 26c12a3023315f35a6f59b6715b811c989c67680
+SHA1 (patch-extras_mini-os_Config.mk) = cb5cdb32f1b3c55abad702ab6768caf59d886ff2
+SHA1 (patch-extras_mini-os_arch_x86_arch.mk) = 8b4f1fe0e888f5b70408d2cc3a3968ce27eae5dc
+SHA1 (patch-extras_mini-os_include_fcntl.h) = 4ed18497227c8c327ee3db9d793caa4ac6254822
+SHA1 (patch-extras_mini-os_include_time.h) = ab3b0794bf892ce6a036aa889c6852d65b508596
+SHA1 (patch-extras_mini-os_lib_sys.c) = f6514ad743a206c0e81dcccd2586e8fe65bfd1b9
+SHA1 (patch-extras_mini-os_lock.c) = e28753793dee483c1ffad8ea8ed2706353046b50
+SHA1 (patch-m4_paths.m4) = 19250964fd808cad30a2aca3de011650a2788251
+SHA1 (patch-tools_Makefile) = a0cba219b1a48a4809be1aaf1758699fe56c885b
+SHA1 (patch-tools_Rules.mk) = c7b4ca2068182c2305522b0efc6f33a3b0ed513c
+SHA1 (patch-tools_configure) = aa0838a1eadf70f5ed99748926234c0376989ff5
+SHA1 (patch-tools_console_daemon_utils.c) = 1c954e1edadad2607f7b87eaf2d6285be7f968ff
+SHA1 (patch-tools_debugger_gdbsx_xg_xg_main.c) = 059551256e95858d7ade25e7637667862bd92499
+SHA1 (patch-tools_examples_Makefile) = fe258fc26e4507ca2fb4363c5e2197ee06e89d64
+SHA1 (patch-tools_firmware_etherboot_Makefile) = ca9f42207888de19e44b2129311e0bce1d4cfee1
+SHA1 (patch-tools_firmware_hvmloader_Makefile) = 02cac5e9314c4c71105f15a3c1c303c573d6583a
+SHA1 (patch-tools_hotplug_NetBSD_Makefile) = a880a38f82e97a5d7846345307d354c8055d23a9
+SHA1 (patch-tools_hotplug_NetBSD_block) = 535ecef7cc0431a14515387e47aadea5dec79569
+SHA1 (patch-tools_hotplug_NetBSD_vif-bridge) = 6d5288c9c47fe81b388ea73f9a71ca3975df36c2
+SHA1 (patch-tools_hotplug_NetBSD_vif-ip) = cb8fd1150f6ac24fa853444618437f7d984b4282
+SHA1 (patch-tools_hotplug_common_Makefile) = 590186dfb31713e8d9ee675186f826bcbcba3c15
+SHA1 (patch-tools_include_xen-sys_NetBSD_gntdev.h) = ce4f7160e92d23afa029c9548cead180fe980ff4
+SHA1 (patch-tools_libs_call_netbsd.c) = c5e166212b0069220d9155636b41028f0f7f9e9e
+SHA1 (patch-tools_libs_call_private.h) = caeaf937ae379836c3187bee97ac0b986af53f9f
+SHA1 (patch-tools_libs_evtchn_netbsd.c) = 1abb0f128ab0702b606e22f199d297d1e9c0aae5
+SHA1 (patch-tools_libs_foreignmemory_Makefile) = d225187d9a1c988b9a46ab464fc7e141097e56e3
+SHA1 (patch-tools_libs_foreignmemory_netbsd.c) = a8eaa785fc3d46cce943f6f205066ff175f7f0e6
+SHA1 (patch-tools_libs_foreignmemory_private.h) = 4dfd16cb0bc14882f9aba8ccbd543b09e7959499
+SHA1 (patch-tools_libs_gnttab_Makefile) = 613a1e1867c5110f0fcf85a3c766306c02a1f001
+SHA1 (patch-tools_libs_gnttab_netbsd.c) = fecbb0d41365fc49621964dbf8d3b3fcbfddb5d3
+SHA1 (patch-tools_libxl_libxl__create.c) = 09cd562f0839dda6f92d63d8fc8ed6de08dd82a8
+SHA1 (patch-tools_libxl_libxl_dm.c) = f1f1842dc75afbc6114f201b8a7ed09fea0e271b
+SHA1 (patch-tools_libxl_libxl_dom.c) = 0c4a96523d13de65aaa71ef705c3579ee8d641f3
+SHA1 (patch-tools_libxl_libxl_event.c) = 8147122d03102eccc45c48a7d6ca1aa5d6286040
+SHA1 (patch-tools_libxl_libxl_internal.h) = 31da26f2121fe2a1928d75f719554ed9389c187b
+SHA1 (patch-tools_libxl_libxl_uuid.c) = 1eb8c027dbeb7e67df7475ee6e4d87220140c65b
+SHA1 (patch-tools_ocaml_common.make) = 4b845bdf3a013852109749ee18dfe28e3440d951
+SHA1 (patch-tools_ocaml_xenstored_Makefile) = b267702cf4090c7b45bba530e60327fced24e3e5
+SHA1 (patch-tools_ocaml_xenstored_utils.ml) = fd951de732d6c31cae89bd4b58c5650108578d79
+SHA1 (patch-tools_qemu-xen-traditional_Makefile) = 5fbb55bf84f9856043be301d5d06530190fe9a60
+SHA1 (patch-tools_qemu-xen-traditional_block-raw-posix.c) = eb3efea4b0c7fd744f627f1926fca737ba826b99
+SHA1 (patch-tools_qemu-xen-traditional_configure) = 6a42dcac010f90439a347c0f6e886b07185cb19a
+SHA1 (patch-tools_qemu-xen-traditional_hw_e1000.c) = ec86584529cc743ea27768ad1fab523ee9fb6bea
+SHA1 (patch-tools_qemu-xen-traditional_hw_ide.c) = b541546390c6d142bc6079dbd51cfd65b5223e9e
+SHA1 (patch-tools_qemu-xen-traditional_hw_pass-through.c) = 45848fb5038bdd6def218b35dd0a6496a14102f1
+SHA1 (patch-tools_qemu-xen-traditional_hw_pass-through.h) = 6edb7a9a03d99b84801bf595c4d68acbc361bb4b
+SHA1 (patch-tools_qemu-xen-traditional_hw_piix4acpi.c) = 280265db035e239b173efd9d63b629201d2c0cfa
+SHA1 (patch-tools_qemu-xen-traditional_hw_pt-graphics.c) = b9c18042f40ccacb3f24ab0f1e3c6e1a5bf5521a
+SHA1 (patch-tools_qemu-xen-traditional_hw_pt-msi.c) = a953380dbc3e64528c39e26d2c45c0cbd3e4d738
+SHA1 (patch-tools_qemu-xen-traditional_hw_pt-msi.h) = 787447cc24518fe5ae16942d72d3038db612419d
+SHA1 (patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak) = 3fdfbb7c9c2243a4cf5dabc5a6dd13c12f9d5850
+SHA1 (patch-tools_qemu-xen-traditional_net.c) = 0999993172070db5dc8d7c7daaa4999a3edaadb8
+SHA1 (patch-tools_qemu-xen-traditional_xen-hooks.mak) = 528878c8465d75b63e044e4f6c89609e4edbc3e0
+SHA1 (patch-tools_qemu-xen_audio_audio.c) = a7f47ff0350900bcb99b5515eeee162144a98cf8
+SHA1 (patch-tools_qemu-xen_configure) = 38eee924f66c226a09c2408312fc0f67d99d2b81
+SHA1 (patch-tools_qemu-xen_net_tap-bsd.c) = ac1ed72daeb051eae7352542630a9a02c99e485e
+SHA1 (patch-tools_qemu-xen_qemu-doc.texi) = e72d480ec29829055f01226eaf020d4cbd100d5d
+SHA1 (patch-tools_xenpaging_xenpaging.c) = 0a154b97f1f452a5f80f7c9a835a1f216f12f7e1
+SHA1 (patch-tools_xenpmd_xenpmd.c) = 851ce7a295e2f41ffcd966850d8003c82670c751
+SHA1 (patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c) = e0f52d2a6ce9c92780209ed5b6f6f2ad1c175221
+SHA1 (patch-tools_xenstore_xc.c) = cf49b65cba064667e13bb041d1f0099c76ab6a40
+SHA1 (patch-tools_xenstore_xs_lib.c) = e3a8f6e3b149c3ab0f4ec8dcfa455983f94e6c16
+SHA1 (patch-tools_xentrace_xentrace.c) = f964c7555f454358a39f28a2e75db8ee100a4243
+SHA1 (patch-tools_xl_Makefile) = dd4fa8cc66c74eea8b022cd6129aa2831776f2a8
+SHA1 (patch-xen_Rules.mk) = c743dc63f51fc280d529a7d9e08650292c171dac
+SHA1 (patch-xen_tools_symbols.c) = 67b5a38312095029631e00457abc0e4bb633aaf8
Index: pkgsrc/sysutils/xentools413/files/blk_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/files/blk_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/files/blk_netbsd.c Tue May 26 11:12:11 2020
@@ -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;
+}
Index: pkgsrc/sysutils/xentools413/files/blktapctrl_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/files/blktapctrl_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/files/blktapctrl_netbsd.c Tue May 26 11:12:11 2020
@@ -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;
+}
Index: pkgsrc/sysutils/xentools413/files/locking.sh
diff -u /dev/null pkgsrc/sysutils/xentools413/files/locking.sh:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/files/locking.sh Tue May 26 11:12:11 2020
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# Copyright (c) 2016, Christoph Badura. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+LOCK_BASEDIR="$XEN_LOCK_DIR/xen-hotplug"
+
+_lockfd=9
+_have_lock=0 # lock not taken yet.
+
+SHLOCK="shlock ${_shlock_debug-}"
+
+_lock_set_vars() {
+ _lockfile="$LOCK_BASEDIR/$1.lock"
+ _lockfifo="$LOCK_BASEDIR/$1.fifo"
+}
+
+_lock_init() {
+ mkdir -p "$LOCK_BASEDIR" 2>/dev/null || true
+ mkfifo $_lockfifo 2>/dev/null || true
+}
+
+#
+# use a named pipe as condition variable
+# opening for read-only blocks when there's no writer.
+# opening for read-write never blocks but unblocks any waiting readers.
+#
+_lock_wait_cv() {
+ eval "exec $_lockfd< $_lockfifo ; exec $_lockfd<&-"
+}
+_lock_signal_cv() {
+ eval "exec $_lockfd<> $_lockfifo ; exec $_lockfd<&-"
+}
+
+claim_lock() {
+ _lock_set_vars $1
+ _lock_init
+ until $SHLOCK -f $_lockfile -p $$; do
+ _lock_wait_cv
+ done
+ _have_lock=1
+ # be sure to release the lock when the shell exits
+ trap "release_lock $1" 0 1 2 15
+}
+
+release_lock() {
+ _lock_set_vars $1
+ [ "$_have_lock" != 0 -a -f $_lockfile ] && rm $_lockfile
+ _have_lock=0
+ _lock_signal_cv;
+}
Index: pkgsrc/sysutils/xentools413/files/xen-watchdog.sh
diff -u /dev/null pkgsrc/sysutils/xentools413/files/xen-watchdog.sh:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/files/xen-watchdog.sh Tue May 26 11:12:11 2020
@@ -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"
Index: pkgsrc/sysutils/xentools413/files/xencommons.sh
diff -u /dev/null pkgsrc/sysutils/xentools413/files/xencommons.sh:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/files/xencommons.sh Tue May 26 11:12:11 2020
@@ -0,0 +1,107 @@
+#!@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
+LIBEXEC_BIN=@PREFIX@/libexec/xen/bin
+
+xen_precmd()
+{
+ mkdir -p /var/run/xen || exit 1
+ mkdir -p /var/run/xenstored || exit 1
+}
+
+xen_startcmd()
+{
+ printf "Starting xenservices: xenstored, xenconsoled.\n"
+ if test ! -r ${required_files}; then
+ warn "${required_files} is not readable."
+ fi
+ 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, domid and JSON config...\n"
+ ${LIBEXEC_BIN}/xen-init-dom0
+
+ 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"
Index: pkgsrc/sysutils/xentools413/files/xendomains.sh
diff -u /dev/null pkgsrc/sysutils/xentools413/files/xendomains.sh:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/files/xendomains.sh Tue May 26 11:12:11 2020
@@ -0,0 +1,129 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: xendomains
+# REQUIRE: xencommons
+# 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 -F $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"
Index: pkgsrc/sysutils/xentools413/patches/patch-Config.mk
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-Config.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-Config.mk Tue May 26 11:12:11 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-Config.mk,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- Config.mk.orig 2018-04-17 19:21:31.000000000 +0200
++++ Config.mk 2018-04-23 16:15:57.000000000 +0200
+@@ -31,7 +31,7 @@
+
+ # Tools to run on system hosting the build
+ HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
+-HOSTCFLAGS += -fno-strict-aliasing
++HOSTCFLAGS += -fno-strict-aliasing ${EXTRA_HOSTCFLAGS}
+
+ DISTDIR ?= $(XEN_ROOT)/dist
+ DESTDIR ?= /
+@@ -219,6 +219,8 @@
+
+ CFLAGS += -Wall -Wstrict-prototypes
+
++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)
Index: pkgsrc/sysutils/xentools413/patches/patch-Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,30 @@
+$NetBSD: patch-Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- Makefile.orig 2019-12-17 15:23:09.000000000 +0100
++++ Makefile 2020-05-08 20:05:12.875067651 +0200
+@@ -65,9 +65,9 @@
+ .PHONY: build-stubdom
+ build-stubdom: mini-os-dir build-tools-public-headers
+ $(MAKE) -C stubdom build
+-ifeq (x86_64,$(XEN_TARGET_ARCH))
+- XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
+-endif
++#ifeq (x86_64,$(XEN_TARGET_ARCH))
++# XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub
++#endif
+
+ .PHONY: build-docs
+ build-docs:
+@@ -136,9 +136,9 @@
+ .PHONY: install-stubdom
+ install-stubdom: mini-os-dir install-tools
+ $(MAKE) -C stubdom install
+-ifeq (x86_64,$(XEN_TARGET_ARCH))
+- XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
+-endif
++#ifeq (x86_64,$(XEN_TARGET_ARCH))
++# XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
++#endif
+
+ .PHONY: tools/firmware/seabios-dir-force-update
+ tools/firmware/seabios-dir-force-update:
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl-disk-configuration.5.pod
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl-disk-configuration.5.pod:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl-disk-configuration.5.pod Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-docs_man_xl-disk-configuration.5.pod,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- docs/man/xl-disk-configuration.5.pod.orig 2018-04-23 16:19:11.000000000 +0200
++++ docs/man/xl-disk-configuration.5.pod 2018-04-23 16:19:41.000000000 +0200
+@@ -257,7 +257,7 @@
+
+ Specifies that B<target> is not a normal host path, but rather
+ information to be interpreted by the executable program I<SCRIPT>,
+-(looked for in F</etc/xen/scripts>, if it doesn't contain a slash).
++(looked for in F<@XENDCONFDIR@/scripts>, if it doesn't contain a slash).
+
+ These scripts are normally called "block-I<SCRIPT>".
+
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.1.pod.in
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.1.pod.in:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.1.pod.in Tue May 26 11:12:11 2020
@@ -0,0 +1,44 @@
+$NetBSD: patch-docs_man_xl.1.pod.in,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- docs/man/xl.1.pod.in.orig 2017-03-24 17:39:08.000000000 +0100
++++ docs/man/xl.1.pod.in 2017-03-24 17:40:12.000000000 +0100
+@@ -33,10 +33,10 @@
+
+ =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
+@@ -50,7 +50,7 @@
+
+ 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>
+
+@@ -175,7 +175,7 @@
+
+ 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.
+
+ =item I<with extra parameters>
+@@ -528,7 +528,7 @@
+ =item B<-N> I<netbufscript>
+
+ Use <netbufscript> to setup network buffering instead of the
+-default script (/etc/xen/scripts/remus-netbuf-setup).
++default script (@XENDCONFDIR@/scripts/remus-netbuf-setup).
+
+ =item B<-F>
+
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.cfg.5.pod.in
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.cfg.5.pod.in:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.cfg.5.pod.in Tue May 26 11:12:11 2020
@@ -0,0 +1,29 @@
+$NetBSD: patch-docs_man_xl.cfg.5.pod.in,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- docs/man/xl.cfg.5.pod.in.orig 2018-04-17 19:21:31.000000000 +0200
++++ docs/man/xl.cfg.5.pod.in 2018-04-23 16:14:18.000000000 +0200
+@@ -4,13 +4,13 @@
+
+ =head1 SYNOPSIS
+
+- /etc/xen/xldomain
++ @XENDCONFDIR@/xldomain
+
+ =head1 DESCRIPTION
+
+ Creating a VM (a domain in Xen terminology, sometimes called a guest)
+ with xl requires the provision of a domain configuration file. Typically,
+-these live in F</etc/xen/DOMAIN.cfg>, where DOMAIN is the name of the
++these live in F<@XENDCONFDIR@/DOMAIN.cfg>, where DOMAIN is the name of the
+ domain.
+
+ =head1 SYNTAX
+@@ -2623,7 +2623,7 @@
+
+ =head1 FILES
+
+-F</etc/xen/NAME.cfg>
++F<@XENDCONFDIR@/NAME.cfg>
+ F<@XEN_DUMP_DIR@/NAME>
+
+ =head1 BUGS
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.conf.5.pod
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.conf.5.pod:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_man_xl.conf.5.pod Tue May 26 11:12:11 2020
@@ -0,0 +1,37 @@
+$NetBSD: patch-docs_man_xl.conf.5.pod,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- docs/man/xl.conf.5.pod.orig 2016-12-05 13:03:27.000000000 +0100
++++ docs/man/xl.conf.5.pod 2017-03-24 17:37:53.000000000 +0100
+@@ -1,6 +1,6 @@
+ =head1 NAME
+
+-/etc/xen/xl.conf - XL Global/Host Configuration
++@XENDCONFDIR@/xl.conf - XL Global/Host Configuration
+
+ =head1 DESCRIPTION
+
+@@ -83,7 +83,7 @@
+
+ The old B<vifscript> option is deprecated and should not be used.
+
+-Default: C</etc/xen/scripts/vif-bridge>
++Default: C<@XENDCONFDIR@/scripts/vif-bridge>
+
+ =item B<vif.default.bridge="NAME">
+
+@@ -109,13 +109,13 @@
+
+ Configures the default script used by Remus to setup network buffering.
+
+-Default: C</etc/xen/scripts/remus-netbuf-setup>
++Default: C<@XENDCONFDIR@/scripts/remus-netbuf-setup>
+
+ =item B<colo.default.proxyscript="PATH">
+
+ Configures the default script used by COLO to setup colo-proxy.
+
+-Default: C</etc/xen/scripts/colo-proxy-setup>
++Default: C<@XENDCONFDIR@/scripts/colo-proxy-setup>
+
+ =item B<output_format="json|sxp">
+
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_man_xlcpupool.cfg.5.pod
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_man_xlcpupool.cfg.5.pod:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_man_xlcpupool.cfg.5.pod Tue May 26 11:12:11 2020
@@ -0,0 +1,28 @@
+$NetBSD: patch-docs_man_xlcpupool.cfg.5.pod,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- docs/man/xlcpupool.cfg.5.pod.orig 2017-03-24 17:41:23.000000000 +0100
++++ docs/man/xlcpupool.cfg.5.pod 2017-03-24 17:41:50.000000000 +0100
+@@ -4,12 +4,12 @@
+
+ =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
+@@ -117,7 +117,7 @@
+
+ =head1 FILES
+
+-F</etc/xen/CPUPOOL.cfg>
++F<@XENDCONFDIR@/CPUPOOL.cfg>
+
+ =head1 BUGS
+
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_misc_block-scripts.txt
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_misc_block-scripts.txt:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_misc_block-scripts.txt Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-docs_misc_block-scripts.txt,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- ./docs/misc/block-scripts.txt.orig 2018-04-23 16:23:34.000000000 +0200
++++ ./docs/misc/block-scripts.txt 2018-04-23 16:23:39.000000000 +0200
+@@ -18,7 +18,7 @@
+
+ It is highly recommended that custom hotplug scripts as much as
+ possible include and use the common Xen functionality. If the script
+-is run from the normal block script location (/etc/xen/scripts by
++is run from the normal block script location (@XENDCONFDIR@/scripts by
+ default), then this can be done by adding the following to the top of
+ the script:
+
Index: pkgsrc/sysutils/xentools413/patches/patch-docs_misc_vtd.txt
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-docs_misc_vtd.txt:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-docs_misc_vtd.txt Tue May 26 11:12:11 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-docs_misc_vtd.txt,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- docs/misc/vtd.txt.orig 2020-05-08 16:46:26.400241453 +0200
++++ docs/misc/vtd.txt 2020-05-08 16:46:50.253734556 +0200
+@@ -39,7 +39,7 @@
+ echo -n 0000:01:00.0 >/sys/bus/pci/drivers/pciback/bind
+
+ 12) reboot system (not requires if you use the dynamic hiding method)
+-13) add "pci" line in /etc/xen/hvm.conf for to assigned devices
++13) add "pci" line in @XENDCONFDIR@/hvm.conf for to assigned devices
+ pci = [ '01:00.0', '03:00.0' ]
+ 15) start hvm guest and use "lspci" to see the passthru device and
+ "ifconfig" to see if IP address has been assigned to NIC devices.
+@@ -77,7 +77,7 @@
+ echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
+ echo "0000:01:00.0" > /sys/bus/pci/drivers/pci-stub/bind
+
+-12) add "pci" line in /etc/xen/hvm.conf for to assigned devices
++12) add "pci" line in @XENDCONFDIR@/hvm.conf for to assigned devices
+ pci = [ '01:00.0' ]
+ 13) start hvm guest and use "lspci" to see the passthru device and
+ "ifconfig" to see if IP address has been assigned to NIC devices.
Index: pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_Config.mk
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_Config.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_Config.mk Tue May 26 11:12:11 2020
@@ -0,0 +1,17 @@
+--- extras/mini-os/Config.mk.orig 2017-03-27 19:37:46.000000000 +0200
++++ extras/mini-os/Config.mk 2017-03-27 19:38:46.000000000 +0200
+@@ -106,13 +106,7 @@
+ # Set tools
+ AS = $(CROSS_COMPILE)as
+ LD = $(CROSS_COMPILE)ld
+-ifeq ($(clang),y)
+-CC = $(CROSS_COMPILE)clang
+-LD_LTO = $(CROSS_COMPILE)llvm-ld
+-else
+-CC = $(CROSS_COMPILE)gcc
+-LD_LTO = $(CROSS_COMPILE)ld
+-endif
++CC = $(TARGET_CC)
+ CPP = $(CC) -E
+ AR = $(CROSS_COMPILE)ar
+ RANLIB = $(CROSS_COMPILE)ranlib
Index: pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_arch_x86_arch.mk
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_arch_x86_arch.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_arch_x86_arch.mk Tue May 26 11:12:11 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-extras_mini-os_arch_x86_arch.mk,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- extras/mini-os/arch/x86/arch.mk.orig 2017-03-27 16:41:50.000000000 +0200
++++ extras/mini-os/arch/x86/arch.mk 2017-03-27 16:43:37.000000000 +0200
+@@ -7,7 +7,7 @@
+
+ ifeq ($(MINIOS_TARGET_ARCH),x86_32)
+ ARCH_CFLAGS := -m32 -march=i686
+-ARCH_LDFLAGS := -m elf_i386
++ARCH_LDFLAGS := -Wl,-melf_i386
+ ARCH_ASFLAGS := -m32
+ EXTRA_INC += $(TARGET_ARCH_FAM)/$(MINIOS_TARGET_ARCH)
+ EXTRA_SRC += arch/$(EXTRA_INC)
+@@ -17,7 +17,7 @@
+ ARCH_CFLAGS := -m64 -mno-red-zone -fno-reorder-blocks
+ ARCH_CFLAGS += -fno-asynchronous-unwind-tables
+ ARCH_ASFLAGS := -m64
+-ARCH_LDFLAGS := -m elf_x86_64
++ARCH_LDFLAGS := -Wl,-melf_x86_64
+ EXTRA_INC += $(TARGET_ARCH_FAM)/$(MINIOS_TARGET_ARCH)
+ EXTRA_SRC += arch/$(EXTRA_INC)
+ endif
Index: pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_fcntl.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_fcntl.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_fcntl.h Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-extras_mini-os_include_fcntl.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+--- extras/mini-os/include/fcntl.h.orig 2017-03-28 19:38:01.000000000 +0200
++++ extras/mini-os/include/fcntl.h 2017-03-28 19:38:12.000000000 +0200
+@@ -93,7 +93,7 @@
+
+ #endif
+
+-int open(const char *path, int flags, ...) asm("open64");
++int open(const char *path, int flags, ...);
+ int fcntl(int fd, int cmd, ...);
+
+ #endif
Index: pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_time.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_time.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_include_time.h Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-extras_mini-os_include_time.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+--- extras/mini-os/include/time.h.orig 2016-09-28 13:09:38.000000000 +0200
++++ extras/mini-os/include/time.h 2017-03-28 20:00:33.000000000 +0200
+@@ -48,7 +48,7 @@
+
+ #include <sys/time.h>
+
+-#ifdef HAVE_LIBC
++#if defined(HAVE_LIBC) && defined(NEED_TIME_H)
+ #include_next <time.h>
+ #endif
+
Index: pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lib_sys.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lib_sys.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lib_sys.c Tue May 26 11:12:11 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-extras_mini-os_lib_sys.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+
+--- extras/mini-os/lib/sys.c.orig 2017-10-20 12:50:35.000000000 +0200
++++ extras/mini-os/lib/sys.c 2018-04-23 15:28:25.000000000 +0200
+@@ -18,6 +18,12 @@
+ #define DEBUG(fmt,...)
+ #endif
+
++void __enable_execute_stack (void *);
++void
++__enable_execute_stack (void *addr __attribute__((__unused__)))
++{
++}
++
+ #ifdef HAVE_LIBC
+ #include <os.h>
+ #include <string.h>
Index: pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lock.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lock.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-extras_mini-os_lock.c Tue May 26 11:12:11 2020
@@ -0,0 +1,11 @@
+--- extras/mini-os/lock.c.orig 2017-03-28 12:14:33.000000000 +0200
++++ extras/mini-os/lock.c 2017-03-28 12:14:43.000000000 +0200
+@@ -4,7 +4,7 @@
+ * Samuel Thibault <Samuel.Thibault%eu.citrix.net@localhost>, July 20008
+ */
+
+-#ifdef HAVE_LIBC
++#if 0 /* def HAVE_LIBC */
+
+ #include <sys/lock.h>
+ #include <sched.h>
Index: pkgsrc/sysutils/xentools413/patches/patch-m4_paths.m4
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-m4_paths.m4:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-m4_paths.m4 Tue May 26 11:12:11 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-m4_paths.m4,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- m4/paths.m4.orig
++++ m4/paths.m4
+@@ -135,8 +135,9 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
+ AC_SUBST(XEN_SCRIPT_DIR)
+
+ case "$host_os" in
+-*freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
++*freebsd*) XEN_LOCK_DIR=$rundir_path ;;
++*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
++*openbsd*) XEN_LOCK_DIR=$rundir_path ;;
+ *) XEN_LOCK_DIR=$localstatedir/lock ;;
+ esac
+ AC_SUBST(XEN_LOCK_DIR)
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,48 @@
+$NetBSD: patch-tools_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/Makefile.orig 2019-12-17 15:23:09.000000000 +0100
++++ tools/Makefile 2020-05-08 16:52:21.141716531 +0200
+@@ -20,7 +20,7 @@
+ SUBDIRS-y += xenmon
+ SUBDIRS-y += xenstat
+ SUBDIRS-$(CONFIG_Linux) += memshr
+-SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
++#XXX SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
+ SUBDIRS-y += libfsimage
+ SUBDIRS-$(CONFIG_Linux) += libvchan
+
+@@ -38,7 +38,7 @@
+ 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))
+@@ -267,17 +267,18 @@
+ -L$(XEN_ROOT)/tools/libs/gnttab \
+ -L$(XEN_ROOT)/tools/libs/foreignmemory \
+ -L$(XEN_ROOT)/tools/libs/devicemodel \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toolcore \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/evtchn \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/gnttab \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/call \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/foreignmemory \
+- -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/devicemodel \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/toolcore \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/toollog \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/evtchn \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/gnttab \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/call \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/foreignmemory \
++ -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/devicemodel \
+ $(QEMU_UPSTREAM_RPATH)" \
+ --bindir=$(LIBEXEC_BIN) \
+ --datadir=$(SHAREDIR)/qemu-xen \
+ --localstatedir=$(localstatedir) \
++ --disable-opengl \
+ --disable-kvm \
+ --disable-docs \
+ --disable-guest-agent \
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_Rules.mk
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_Rules.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_Rules.mk Tue May 26 11:12:11 2020
@@ -0,0 +1,108 @@
+$NetBSD: patch-tools_Rules.mk,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/Rules.mk.orig 2019-12-17 15:23:09.000000000 +0100
++++ tools/Rules.mk 2020-05-08 16:55:13.142182769 +0200
+@@ -102,54 +102,54 @@
+ CFLAGS_libxentoollog = -I$(XEN_LIBXENTOOLLOG)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxentoollog =
+ LDLIBS_libxentoollog = $(SHDEPS_libxentoollog) $(XEN_LIBXENTOOLLOG)/libxentoollog$(libextension)
+-SHLIB_libxentoollog = $(SHDEPS_libxentoollog) -Wl,-rpath-link=$(XEN_LIBXENTOOLLOG)
++SHLIB_libxentoollog = $(SHDEPS_libxentoollog) -Wl,-rpath-link,$(XEN_LIBXENTOOLLOG)
+
+ CFLAGS_libxentoolcore = -I$(XEN_LIBXENTOOLCORE)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxentoolcore =
+ LDLIBS_libxentoolcore = $(SHDEPS_libxentoolcore) $(XEN_LIBXENTOOLCORE)/libxentoolcore$(libextension)
+-SHLIB_libxentoolcore = $(SHDEPS_libxentoolcore) -Wl,-rpath-link=$(XEN_LIBXENTOOLCORE)
++SHLIB_libxentoolcore = $(SHDEPS_libxentoolcore) -Wl,-rpath-link,$(XEN_LIBXENTOOLCORE)
+
+ CFLAGS_libxenevtchn = -I$(XEN_LIBXENEVTCHN)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxenevtchn = $(SHLIB_libxentoolcore)
+ LDLIBS_libxenevtchn = $(SHDEPS_libxenevtchn) $(XEN_LIBXENEVTCHN)/libxenevtchn$(libextension)
+-SHLIB_libxenevtchn = $(SHDEPS_libxenevtchn) -Wl,-rpath-link=$(XEN_LIBXENEVTCHN)
++SHLIB_libxenevtchn = $(SHDEPS_libxenevtchn) -Wl,-rpath-link,$(XEN_LIBXENEVTCHN)
+
+ CFLAGS_libxengnttab = -I$(XEN_LIBXENGNTTAB)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxengnttab = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore)
+ LDLIBS_libxengnttab = $(SHDEPS_libxengnttab) $(XEN_LIBXENGNTTAB)/libxengnttab$(libextension)
+-SHLIB_libxengnttab = $(SHDEPS_libxengnttab) -Wl,-rpath-link=$(XEN_LIBXENGNTTAB)
++SHLIB_libxengnttab = $(SHDEPS_libxengnttab) -Wl,-rpath-link,$(XEN_LIBXENGNTTAB)
+
+ CFLAGS_libxencall = -I$(XEN_LIBXENCALL)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxencall = $(SHLIB_libxentoolcore)
+ LDLIBS_libxencall = $(SHDEPS_libxencall) $(XEN_LIBXENCALL)/libxencall$(libextension)
+-SHLIB_libxencall = $(SHDEPS_libxencall) -Wl,-rpath-link=$(XEN_LIBXENCALL)
++SHLIB_libxencall = $(SHDEPS_libxencall) -Wl,-rpath-link,$(XEN_LIBXENCALL)
+
+ CFLAGS_libxenforeignmemory = -I$(XEN_LIBXENFOREIGNMEMORY)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxenforeignmemory = $(SHLIB_libxentoolcore)
+ LDLIBS_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) $(XEN_LIBXENFOREIGNMEMORY)/libxenforeignmemory$(libextension)
+-SHLIB_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link=$(XEN_LIBXENFOREIGNMEMORY)
++SHLIB_libxenforeignmemory = $(SHDEPS_libxenforeignmemory) -Wl,-rpath-link,$(XEN_LIBXENFOREIGNMEMORY)
+
+ CFLAGS_libxendevicemodel = -I$(XEN_LIBXENDEVICEMODEL)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxendevicemodel = $(SHLIB_libxentoollog) $(SHLIB_libxentoolcore) $(SHLIB_xencall)
+ LDLIBS_libxendevicemodel = $(SHDEPS_libxendevicemodel) $(XEN_LIBXENDEVICEMODEL)/libxendevicemodel$(libextension)
+-SHLIB_libxendevicemodel = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link=$(XEN_LIBXENDEVICEMODEL)
++SHLIB_libxendevicemodel = $(SHDEPS_libxendevicemodel) -Wl,-rpath-link,$(XEN_LIBXENDEVICEMODEL)
+
+ # code which compiles against libxenctrl get __XEN_TOOLS__ and
+ # therefore sees the unstable hypercall interfaces.
+ CFLAGS_libxenctrl = -I$(XEN_LIBXC)/include $(CFLAGS_libxentoollog) $(CFLAGS_libxenforeignmemory) $(CFLAGS_libxendevicemodel) $(CFLAGS_xeninclude) -D__XEN_TOOLS__
+ SHDEPS_libxenctrl = $(SHLIB_libxentoollog) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab) $(SHLIB_libxencall) $(SHLIB_libxenforeignmemory) $(SHLIB_libxendevicemodel)
+ LDLIBS_libxenctrl = $(SHDEPS_libxenctrl) $(XEN_LIBXC)/libxenctrl$(libextension)
+-SHLIB_libxenctrl = $(SHDEPS_libxenctrl) -Wl,-rpath-link=$(XEN_LIBXC)
++SHLIB_libxenctrl = $(SHDEPS_libxenctrl) -Wl,-rpath-link,$(XEN_LIBXC)
+
+ CFLAGS_libxenguest = -I$(XEN_LIBXC)/include $(CFLAGS_libxenevtchn) $(CFLAGS_libxenforeignmemory) $(CFLAGS_xeninclude)
+ SHDEPS_libxenguest = $(SHLIB_libxenevtchn)
+ LDLIBS_libxenguest = $(SHDEPS_libxenguest) $(XEN_LIBXC)/libxenguest$(libextension)
+-SHLIB_libxenguest = $(SHDEPS_libxenguest) -Wl,-rpath-link=$(XEN_LIBXC)
++SHLIB_libxenguest = $(SHDEPS_libxenguest) -Wl,-rpath-link,$(XEN_LIBXC)
+
+ CFLAGS_libxenstore = -I$(XEN_XENSTORE)/include $(CFLAGS_xeninclude)
+ SHDEPS_libxenstore = $(SHLIB_libxentoolcore)
+ LDLIBS_libxenstore = $(SHDEPS_libxenstore) $(XEN_XENSTORE)/libxenstore$(libextension)
+-SHLIB_libxenstore = $(SHDEPS_libxenstore) -Wl,-rpath-link=$(XEN_XENSTORE)
++SHLIB_libxenstore = $(SHDEPS_libxenstore) -Wl,-rpath-link,$(XEN_XENSTORE)
+ ifeq ($(CONFIG_Linux),y)
+ LDLIBS_libxenstore += -ldl
+ endif
+@@ -157,12 +157,12 @@
+ CFLAGS_libxenstat = -I$(XEN_LIBXENSTAT)
+ SHDEPS_libxenstat = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
+ LDLIBS_libxenstat = $(SHDEPS_libxenstat) $(XEN_LIBXENSTAT)/libxenstat$(libextension)
+-SHLIB_libxenstat = $(SHDEPS_libxenstat) -Wl,-rpath-link=$(XEN_LIBXENSTAT)
++SHLIB_libxenstat = $(SHDEPS_libxenstat) -Wl,-rpath-link,$(XEN_LIBXENSTAT)
+
+ CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN)
+ SHDEPS_libxenvchan = $(SHLIB_libxentoollog) $(SHLIB_libxenstore) $(SHLIB_libxenevtchn) $(SHLIB_libxengnttab)
+ LDLIBS_libxenvchan = $(SHDEPS_libxenvchan) $(XEN_LIBVCHAN)/libxenvchan$(libextension)
+-SHLIB_libxenvchan = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_LIBVCHAN)
++SHLIB_libxenvchan = $(SHDEPS_libxenvchan) -Wl,-rpath-link,$(XEN_LIBVCHAN)
+
+ ifeq ($(debug),y)
+ # Disable optimizations
+@@ -176,12 +176,12 @@
+ CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
+ SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
+ LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension)
+-SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)
++SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath-link,$(XEN_XENLIGHT)
+
+ CFLAGS_libxlutil = -I$(XEN_XLUTIL)
+ SHDEPS_libxlutil = $(SHLIB_libxenlight)
+ LDLIBS_libxlutil = $(SHDEPS_libxlutil) $(XEN_XLUTIL)/libxlutil$(libextension)
+-SHLIB_libxlutil = $(SHDEPS_libxlutil) -Wl,-rpath-link=$(XEN_XLUTIL)
++SHLIB_libxlutil = $(SHDEPS_libxlutil) -Wl,-rpath-link,$(XEN_XLUTIL)
+
+ CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
+
+@@ -257,7 +257,7 @@
+ -e 's!@@firmwaredir@@!$(XENFIRMWAREDIR)!g' \
+ -e 's!@@libexecbin@@!$(LIBEXEC_BIN)!g' \
+ -e 's!@@cflagslocal@@!$(PKG_CONFIG_CFLAGS_LOCAL)!g' \
+- -e 's!@@libsflag@@\([^ ]*\)!-L\1 -Wl,-rpath-link=\1!g' \
++ -e 's!@@libsflag@@\([^ ]*\)!-L\1 -Wl,-rpath-link,\1!g' \
+ $(PKG_CONFIG_FILTER) < $< > $@
+
+ %.pc: %.pc.in Makefile $(XEN_ROOT)/tools/Rules.mk
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_configure
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_configure:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_configure Tue May 26 11:12:11 2020
@@ -0,0 +1,39 @@
+$NetBSD: patch-tools_configure,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/configure.orig 2018-04-17 19:21:31.000000000 +0200
++++ tools/configure 2018-04-23 16:12:57.000000000 +0200
+@@ -2422,7 +2422,7 @@
+
+
+
+-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons
hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain
hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain
ocaml/xenstored/oxenstored.conf"
++ac_config_files="$ac_config_files ../config/Tools.mk ../config/Paths.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons
hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain
hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain
ocaml/xenstored/oxenstored.conf"
+
+ ac_config_headers="$ac_config_headers config.h"
+
+@@ -3870,7 +3870,7 @@
+
+ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
+ case "$host_os" in
+- *freebsd*)
++ *freebsd*|*netbsd*)
+ sysconfdir=$prefix/etc
+ ;;
+ *solaris*)
+@@ -4006,7 +4006,7 @@
+
+ case "$host_os" in
+ *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
++*netbsd*) XEN_LOCK_DIR=$localstatedir/run ;;
+ *) XEN_LOCK_DIR=$localstatedir/lock ;;
+ esac
+
+@@ -10430,6 +10430,7 @@
+ do
+ case $ac_config_target in
+ "../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;;
++ "../config/Paths.mk") CONFIG_FILES="$CONFIG_FILES ../config/Paths.mk" ;;
+ "hotplug/FreeBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xencommons" ;;
+ "hotplug/FreeBSD/rc.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/FreeBSD/rc.d/xendriverdomain" ;;
+ "hotplug/Linux/init.d/sysconfig.xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xencommons" ;;
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_console_daemon_utils.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_console_daemon_utils.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_console_daemon_utils.c Tue May 26 11:12:11 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-tools_console_daemon_utils.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/console/daemon/utils.c.orig 2015-06-22 13:41:35.000000000 +0000
++++ tools/console/daemon/utils.c
+@@ -113,13 +113,15 @@ bool xen_setup(void)
+ xs = xs_daemon_open();
+ if (xs == NULL) {
+ dolog(LOG_ERR,
+- "Failed to contact xenstore (%m). Is it running?");
++ "Failed to contact xenstore (%s). Is it running?",
++ strerror(errno));
+ goto out;
+ }
+
+ xc = xc_interface_open(0,0,0);
+ if (!xc) {
+- dolog(LOG_ERR, "Failed to contact hypervisor (%m)");
++ dolog(LOG_ERR, "Failed to contact hypervisor (%s)",
++ strerror(errno));
+ goto out;
+ }
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_debugger_gdbsx_xg_xg_main.c Tue May 26 11:12:11 2020
@@ -0,0 +1,24 @@
+$NetBSD: patch-tools_debugger_gdbsx_xg_xg_main.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/debugger/gdbsx/xg/xg_main.c.orig 2020-04-30 09:57:45.000000000 +0200
++++ tools/debugger/gdbsx/xg/xg_main.c 2020-04-30 09:58:43.000000000 +0200
+@@ -126,12 +126,19 @@
+ int flags, saved_errno;
+
+ XGTRC("E\n");
++#ifdef __NetBSD__
++ if ((_dom0_fd=open("/kern/xen/privcmd", O_RDWR)) == -1) {
++ perror("Failed to open /kern/xen/privcmd\n");
++ return -1;
++ }
++#else
+ if ((_dom0_fd=open("/dev/xen/privcmd", O_RDWR)) == -1) {
+ if ((_dom0_fd=open("/proc/xen/privcmd", O_RDWR)) == -1) {
+ perror("Failed to open /dev/xen/privcmd or /proc/xen/privcmd\n");
+ return -1;
+ }
+ }
++#endif
+ /* Although we return the file handle as the 'xc handle' the API
+ * does not specify / guarentee that this integer is in fact
+ * a file handle. Thus we must take responsiblity to ensure
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_examples_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_examples_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_examples_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-tools_examples_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/examples/Makefile.orig 2015-01-12 17:53:24.000000000 +0100
++++ tools/examples/Makefile 2015-01-19 13:37:18.000000000 +0100
+@@ -1,6 +1,6 @@
+ XEN_ROOT = $(CURDIR)/../..
+ include $(XEN_ROOT)/tools/Rules.mk
+-
++XEN_CONFIG_DIR=${XEN_EXAMPLES_DIR}
+ # Xen configuration dir and configs to go there.
+ XEN_READMES = README
+ XEN_READMES += README.incompatibilities
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_etherboot_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,26 @@
+$NetBSD: patch-tools_firmware_etherboot_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/firmware/etherboot/Makefile.orig 2019-12-17 15:23:09.000000000 +0100
++++ tools/firmware/etherboot/Makefile 2020-05-08 16:59:46.337172477 +0200
+@@ -32,18 +32,10 @@
+ %.rom: $D/src/arch/i386/Makefile
+ $(MAKE) -C $D/src bin/$(*F).rom
+
+-$T:
+- set -e; if ! $(FETCHER) _$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 -n >../_$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
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_hvmloader_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_hvmloader_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_firmware_hvmloader_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_firmware_hvmloader_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/firmware/hvmloader/Makefile.orig 2016-12-05 13:03:27.000000000 +0100
++++ tools/firmware/hvmloader/Makefile 2017-03-24 18:14:34.000000000 +0100
+@@ -26,7 +26,7 @@
+ # SMBIOS spec requires format mm/dd/yyyy
+ SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y)
+
+-CFLAGS += $(CFLAGS_xeninclude)
++CFLAGS += $(CFLAGS_xeninclude) $(EXTRA_CFLAGS)
+
+ # We mustn't use tools-only public interfaces.
+ CFLAGS += -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,52 @@
+$NetBSD: patch-tools_hotplug_NetBSD_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/hotplug/NetBSD/Makefile.orig 2018-04-17 19:21:31.000000000 +0200
++++ tools/hotplug/NetBSD/Makefile 2018-04-23 16:05:01.000000000 +0200
+@@ -3,12 +3,13 @@
+
+ # Xen script dir and scripts to go there.
+ XEN_SCRIPTS =
++XEN_SCRIPTS += locking.sh
+ XEN_SCRIPTS += block
+ XEN_SCRIPTS += vif-bridge
+ XEN_SCRIPTS += vif-ip
+
+ XEN_SCRIPT_DATA =
+-XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
++#XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
+
+ .PHONY: all
+ all:
+@@ -24,10 +25,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 \
+@@ -41,12 +43,12 @@
+
+ .PHONY: install-rcd
+ install-rcd:
+- $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
+- set -e; for i in $(XEN_RCD_PROG); \
+- do \
+- $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
+- done
+- $(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(INITD_DIR)/xen-hotplugpath.sh
++# $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
++# set -e; for i in $(XEN_RCD_PROG); \
++# do \
++# $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
++# done
++# $(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(INITD_DIR)/xen-hotplugpath.sh
+
+ .PHONY: uninstall-rcd
+ uninstall-rcd:
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_block
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_block:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_block Tue May 26 11:12:11 2020
@@ -0,0 +1,37 @@
+$NetBSD: patch-tools_hotplug_NetBSD_block,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/hotplug/NetBSD/block.orig 2016-02-09 14:44:19.000000000 +0000
++++ tools/hotplug/NetBSD/block
+@@ -6,6 +6,7 @@
+
+ DIR=$(dirname "$0")
+ . "${DIR}/hotplugpath.sh"
++. "${DIR}/locking.sh"
+
+ PATH=${bindir}:${sbindir}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
+ export PATH
+@@ -62,6 +63,7 @@ case $xstatus in
+ available_disks="$available_disks $disk"
+ eval $disk=free
+ done
++ claim_lock block
+ # Mark the used vnd(4) devices as ``used''.
+ for disk in `sysctl hw.disknames`; do
+ case $disk in
+@@ -77,6 +79,7 @@ case $xstatus in
+ break
+ fi
+ done
++ release_lock block
+ if [ x$device = x ] ; then
+ error "no available vnd device"
+ fi
+@@ -86,7 +89,7 @@ case $xstatus in
+ device=$xparams
+ ;;
+ esac
+- physical_device=$(stat -f '%r' "$device")
++ physical_device=$(stat -L -f '%r' "$device")
+ xenstore-write $xpath/physical-device $physical_device
+ xenstore-write $xpath/hotplug-status connected
+ exit 0
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-bridge
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-bridge:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-bridge Tue May 26 11:12:11 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-tools_hotplug_NetBSD_vif-bridge,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/hotplug/NetBSD/vif-bridge.orig 2015-01-12 17:53:24.000000000 +0100
++++ tools/hotplug/NetBSD/vif-bridge 2015-01-19 13:16:37.000000000 +0100
+@@ -23,7 +23,10 @@
+ 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
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-ip
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-ip:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_NetBSD_vif-ip Tue May 26 11:12:11 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-tools_hotplug_NetBSD_vif-ip,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/hotplug/NetBSD/vif-ip.orig 2015-01-12 17:53:24.000000000 +0100
++++ tools/hotplug/NetBSD/vif-ip 2015-01-19 13:16:37.000000000 +0100
+@@ -24,6 +24,10 @@
+ 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
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_common_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_common_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_hotplug_common_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,24 @@
+$NetBSD: patch-tools_hotplug_common_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/hotplug/common/Makefile.orig 2018-04-17 19:21:31.000000000 +0200
++++ tools/hotplug/common/Makefile 2018-04-23 16:03:55.000000000 +0200
+@@ -26,15 +26,15 @@
+
+ .PHONY: install-scripts
+ install-scripts: build
+- [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
+- $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
++ [ -d $(DESTDIR)${XEN_EXAMPLES_DIR}/scripts ] || \
++ $(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 \
+- $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \
++ $(INSTALL_DATA) $$i $(DESTDIR)${XEN_EXAMPLES_DIR}/scripts; \
+ done
+
+ .PHONY: uninstall-scripts
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_include_xen-sys_NetBSD_gntdev.h Tue May 26 11:12:11 2020
@@ -0,0 +1,110 @@
+$NetBSD: patch-tools_include_xen-sys_NetBSD_gntdev.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/include/xen-sys/NetBSD/gntdev.h.orig 2015-01-19 13:16:37.000000000 +0100
++++ tools/include/xen-sys/NetBSD/gntdev.h 2015-01-19 13:16:37.000000000 +0100
+@@ -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__ */
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_netbsd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,55 @@
+$NetBSD: patch-tools_libs_call_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libs/call/netbsd.c.orig 2017-03-24 18:29:45.000000000 +0100
++++ tools/libs/call/netbsd.c 2017-03-24 18:34:05.000000000 +0100
+@@ -19,12 +19,14 @@
+ * Split from xc_netbsd.c
+ */
+
+-#include "xc_private.h"
+
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <malloc.h>
++#include <errno.h>
+ #include <sys/mman.h>
++#include <sys/ioctl.h>
++#include "private.h"
+
+ int osdep_xencall_open(xencall_handle *xcall)
+ {
+@@ -69,12 +71,13 @@
+ return close(fd);
+ }
+
+-void *osdep_alloc_hypercall_buffer(xencall_handle *xcall, size_t npages)
++void *osdep_alloc_pages(xencall_handle *xcall, size_t npages)
+ {
+- size_t size = npages * XC_PAGE_SIZE;
++ size_t size = npages * PAGE_SIZE;
+ void *p;
++ int ret;
+
+- ret = posix_memalign(&p, XC_PAGE_SIZE, size);
++ ret = posix_memalign(&p, PAGE_SIZE, size);
+ if ( ret != 0 || !p )
+ return NULL;
+
+@@ -86,14 +89,13 @@
+ return p;
+ }
+
+-void osdep_free_hypercall_buffer(xencall_handle *xcall, void *ptr,
+- size_t npages)
++void osdep_free_pages(xencall_handle *xcall, void *ptr, size_t npages)
+ {
+- (void) munlock(ptr, npages * XC_PAGE_SIZE);
++ (void) munlock(ptr, npages * PAGE_SIZE);
+ free(ptr);
+ }
+
+-int do_xen_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
++int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+ {
+ int fd = xcall->fd;
+ int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_private.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_private.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_call_private.h Tue May 26 11:12:11 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-tools_libs_call_private.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libs/call/private.h.orig 2017-03-28 10:42:37.000000000 +0200
++++ tools/libs/call/private.h 2017-03-28 10:43:04.000000000 +0200
+@@ -11,8 +11,10 @@
+ #ifndef PAGE_SHIFT /* Mini-os, Yukk */
+ #define PAGE_SHIFT 12
+ #endif
+-#ifndef __MINIOS__ /* Yukk */
++#ifndef PAGE_SIZE
+ #define PAGE_SIZE (1UL << PAGE_SHIFT)
++#endif
++#ifndef PAGE_MASK
+ #define PAGE_MASK (~(PAGE_SIZE-1))
+ #endif
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_evtchn_netbsd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-tools_libs_evtchn_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libs/evtchn/netbsd.c.orig 2017-03-24 18:23:27.000000000 +0100
++++ tools/libs/evtchn/netbsd.c 2017-03-24 18:23:40.000000000 +0100
+@@ -124,7 +124,7 @@
+ int fd = xce->fd;
+ evtchn_port_t port;
+
+- if ( read_exact(fd, (char *)&port, sizeof(port)) == -1 )
++ if ( read(fd, (char *)&port, sizeof(port)) == -1 )
+ return -1;
+
+ return port;
+@@ -133,7 +133,7 @@
+ int xenevtchn_unmask(xenevtchn_handle *xce, evtchn_port_t port)
+ {
+ int fd = xce->fd;
+- return write_exact(fd, (char *)&port, sizeof(port));
++ return write(fd, (char *)&port, sizeof(port));
+ }
+
+ /*
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-tools_libs_foreignmemory_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+--- tools/libs/foreignmemory/Makefile.orig 2020-05-25 17:33:42.184858531 +0200
++++ tools/libs/foreignmemory/Makefile 2020-05-25 17:33:49.531799991 +0200
+@@ -10,7 +10,7 @@
+ SRCS-$(CONFIG_Linux) += linux.c
+ SRCS-$(CONFIG_FreeBSD) += freebsd.c
+ SRCS-$(CONFIG_SunOS) += compat.c solaris.c
+-SRCS-$(CONFIG_NetBSD) += compat.c netbsd.c
++SRCS-$(CONFIG_NetBSD) += netbsd.c
+ SRCS-$(CONFIG_MiniOS) += minios.c
+
+ include $(XEN_ROOT)/tools/libs/libs.mk
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_netbsd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,114 @@
+$NetBSD: patch-tools_libs_foreignmemory_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libs/foreignmemory/netbsd.c.orig 2020-05-14 14:19:32.000000000 +0200
++++ tools/libs/foreignmemory/netbsd.c 2020-05-25 17:36:19.241323602 +0200
+@@ -19,7 +19,9 @@
+
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <errno.h>
+ #include <sys/mman.h>
++#include <sys/ioctl.h>
+
+ #include "private.h"
+
+@@ -66,15 +68,17 @@
+ return close(fd);
+ }
+
+-void *osdep_map_foreign_batch(xenforeignmem_handle *fmem, uint32_t dom,
+- void *addr, int prot, int flags,
+- xen_pfn_t *arr, int num)
++void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
++ uint32_t dom, void *addr,
++ int prot, int flags, size_t num,
++ const xen_pfn_t arr[/*num*/], int err[/*num*/])
++
+ {
+ int fd = fmem->fd;
+- privcmd_mmapbatch_t ioctlx;
+- addr = mmap(addr, num*XC_PAGE_SIZE, prot, flags | MAP_ANON | MAP_SHARED, -1, 0);
++ privcmd_mmapbatch_v2_t ioctlx;
++ addr = mmap(addr, num*PAGE_SIZE, prot, flags | MAP_ANON | MAP_SHARED, -1, 0);
+ if ( addr == MAP_FAILED ) {
+- PERROR("osdep_map_foreign_batch: mmap failed");
++ PERROR("osdep_xenforeignmemory_map: mmap failed");
+ return NULL;
+ }
+
+@@ -82,11 +86,12 @@
+ ioctlx.dom=dom;
+ ioctlx.addr=(unsigned long)addr;
+ ioctlx.arr=arr;
+- if ( ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx) < 0 )
++ ioctlx.err=err;
++ if ( ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx) < 0 )
+ {
+ int saved_errno = errno;
+- PERROR("osdep_map_foreign_batch: ioctl failed");
+- (void)munmap(addr, num*XC_PAGE_SIZE);
++ PERROR("osdep_xenforeignmemory_map: ioctl failed");
++ (void)munmap(addr, num*PAGE_SIZE);
+ errno = saved_errno;
+ return NULL;
+ }
+@@ -97,7 +102,58 @@
+ int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
+ void *addr, size_t num)
+ {
+- return munmap(addr, num*XC_PAGE_SIZE);
++ return munmap(addr, num*PAGE_SIZE);
++}
++
++int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem,
++ domid_t domid)
++{
++ return 0;
++}
++
++int osdep_xenforeignmemory_unmap_resource(
++ xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
++{
++ return fres ? munmap(fres->addr, fres->nr_frames << PAGE_SHIFT) : 0;
++}
++
++int osdep_xenforeignmemory_map_resource(
++ xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
++{
++ privcmd_mmap_resource_t mr = {
++ .dom = fres->domid,
++ .type = fres->type,
++ .id = fres->id,
++ .idx = fres->frame,
++ .num = fres->nr_frames,
++ };
++ int rc;
++
++ fres->addr = mmap(fres->addr, fres->nr_frames << PAGE_SHIFT,
++ fres->prot, fres->flags | MAP_ANON | MAP_SHARED, -1, 0);
++ if ( fres->addr == MAP_FAILED )
++ return -1;
++
++ mr.addr = (uintptr_t)fres->addr;
++
++ rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
++ if ( rc )
++ {
++ int saved_errno;
++
++ if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP )
++ PERROR("ioctl failed");
++ else
++ errno = EOPNOTSUPP;
++
++ saved_errno = errno;
++ (void)osdep_xenforeignmemory_unmap_resource(fmem, fres);
++ errno = saved_errno;
++
++ return -1;
++ }
++
++ return 0;
+ }
+
+ /*
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_private.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_private.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_foreignmemory_private.h Tue May 26 11:12:11 2020
@@ -0,0 +1,36 @@
+$NetBSD: patch-tools_libs_foreignmemory_private.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libs/foreignmemory/private.h.orig 2019-12-17 15:23:09.000000000 +0100
++++ tools/libs/foreignmemory/private.h 2020-05-17 20:52:40.910407317 +0200
+@@ -8,7 +8,13 @@
+ #include <xentoolcore_internal.h>
+
+ #include <xen/xen.h>
++
++#ifdef __NetBSD__
++#include <xen/xen.h>
++#include <xen/xenio.h>
++#else
+ #include <xen/sys/privcmd.h>
++#endif
+
+ #ifndef PAGE_SHIFT /* Mini-os, Yukk */
+ #define PAGE_SHIFT 12
+@@ -38,7 +44,7 @@
+
+ #if defined(__NetBSD__) || defined(__sun__)
+ /* Strictly compat for those two only only */
+-void *compat_mapforeign_batch(xenforeignmem_handle *fmem, uint32_t dom,
++void *osdep_map_foreign_batch(xenforeignmemory_handle *fmem, uint32_t dom,
+ void *addr, int prot, int flags,
+ xen_pfn_t *arr, int num);
+ #endif
+@@ -54,7 +60,7 @@
+ int flags;
+ };
+
+-#ifndef __linux__
++#if !defined(__linux__) && !defined(__NetBSD__)
+ static inline int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem,
+ domid_t domid)
+ {
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-tools_libs_gnttab_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libs/gnttab/Makefile.orig 2020-05-09 10:17:22.745274071 +0200
++++ tools/libs/gnttab/Makefile 2020-05-09 10:17:45.177659218 +0200
+@@ -12,8 +12,8 @@
+ SRCS-$(CONFIG_Linux) += $(SRCS-GNTTAB) $(SRCS-GNTSHR) linux.c
+ SRCS-$(CONFIG_MiniOS) += $(SRCS-GNTTAB) gntshr_unimp.c minios.c
+ SRCS-$(CONFIG_FreeBSD) += $(SRCS-GNTTAB) $(SRCS-GNTSHR) freebsd.c
++SRCS-$(CONFIG_NetBSD) += $(SRCS-GNTTAB) $(SRCS-GNTSHR) netbsd.c
+ SRCS-$(CONFIG_SunOS) += gnttab_unimp.c gntshr_unimp.c
+-SRCS-$(CONFIG_NetBSD) += gnttab_unimp.c gntshr_unimp.c
+
+ include $(XEN_ROOT)/tools/libs/libs.mk
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libs_gnttab_netbsd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,274 @@
+$NetBSD: patch-tools_libs_gnttab_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+add NetBSD support
+
+--- ./tools/libs/gnttab/netbsd.c.orig 2020-05-09 10:17:17.773398339 +0200
++++ ./tools/libs/gnttab/netbsd.c 2020-05-09 20:33:06.970192829 +0200
+@@ -0,0 +1,267 @@
++/*
++ * Copyright (c) 2007-2008, D G Murray <Derek.Murray%cl.cam.ac.uk@localhost>
++ * Copyright (c) 2016-2017, Akshay Jaggi <jaggi%FreeBSD.org@localhost>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation;
++ * version 2.1 of the License.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
++ *
++ * Split out from linux.c
++ */
++
++#include <fcntl.h>
++#include <errno.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <stdint.h>
++#include <string.h>
++
++#include <sys/ioctl.h>
++#include <sys/mman.h>
++
++#include <xen/xen.h>
++#include <xen/xenio.h>
++
++#include "private.h"
++
++#define PAGE_SHIFT 12
++#define PAGE_SIZE (1UL << PAGE_SHIFT)
++#define PAGE_MASK (~(PAGE_SIZE-1))
++
++#define DEVXEN "/kern/xen/privcmd"
++
++int osdep_gnttab_open(xengnttab_handle *xgt)
++{
++ int fd = open(DEVXEN, O_RDWR|O_CLOEXEC);
++
++ if ( fd == -1 )
++ return -1;
++ xgt->fd = fd;
++
++ return 0;
++}
++
++int osdep_gnttab_close(xengnttab_handle *xgt)
++{
++ if ( xgt->fd == -1 )
++ return 0;
++
++ return close(xgt->fd);
++}
++
++int osdep_gnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count)
++{
++ return 0;
++}
++
++void *osdep_gnttab_grant_map(xengnttab_handle *xgt,
++ uint32_t count, int flags, int prot,
++ uint32_t *domids, uint32_t *refs,
++ uint32_t notify_offset,
++ evtchn_port_t notify_port)
++{
++ uint32_t i;
++ int fd = xgt->fd;
++ struct ioctl_gntdev_mmap_grant_ref map;
++ void *addr = NULL;
++ int domids_stride;
++ unsigned int refs_size = count * sizeof(struct ioctl_gntdev_grant_ref);
++ int rv;
++
++ domids_stride = (flags & XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN) ? 0 : 1;
++ map.refs = malloc(refs_size);
++
++ for ( i = 0; i < count; i++ )
++ {
++ map.refs[i].domid = domids[i * domids_stride];
++ map.refs[i].ref = refs[i];
++ }
++
++ map.count = count;
++ addr = mmap(NULL, count * PAGE_SIZE,
++ prot, flags | MAP_ANON | MAP_SHARED, -1, 0);
++
++ if (map.va == MAP_FAILED) {
++ GTERROR(xgt->logger, "osdep_gnttab_grant_map: mmap failed");
++ munmap((void *)map.va, count * PAGE_SIZE);
++ addr = MAP_FAILED;
++ }
++ map.va = addr;
++
++ map.notify.offset = 0;
++ map.notify.action = 0;
++ if ( notify_offset < PAGE_SIZE * count )
++ {
++ map.notify.offset = notify_offset;
++ map.notify.action |= UNMAP_NOTIFY_CLEAR_BYTE;
++ }
++ if ( notify_port != -1 )
++ {
++ map.notify.event_channel_port = notify_port;
++ map.notify.action |= UNMAP_NOTIFY_SEND_EVENT;
++ }
++
++ rv = ioctl(fd, IOCTL_GNTDEV_MMAP_GRANT_REF, &map);
++ if ( rv )
++ {
++ GTERROR(xgt->logger,
++ "ioctl IOCTL_GNTDEV_MMAP_GRANT_REF failed: %d", rv);
++ munmap(addr, count * PAGE_SIZE);
++ addr = MAP_FAILED;
++ }
++ free(map.refs);
++ return addr;
++}
++
++int osdep_gnttab_unmap(xengnttab_handle *xgt,
++ void *start_address,
++ uint32_t count)
++{
++ int rc;
++ if ( start_address == NULL )
++ {
++ errno = EINVAL;
++ return -1;
++ }
++
++ /* Next, unmap the memory. */
++ rc = munmap(start_address, count * PAGE_SIZE);
++
++ return rc;
++}
++
++int osdep_gnttab_grant_copy(xengnttab_handle *xgt,
++ uint32_t count,
++ xengnttab_grant_copy_segment_t *segs)
++{
++ errno = ENOSYS;
++ return -1;
++}
++
++int osdep_gntshr_open(xengntshr_handle *xgs)
++{
++
++ int fd = open(DEVXEN, O_RDWR);
++
++ if ( fd == -1 )
++ return -1;
++ xgs->fd = fd;
++
++ return 0;
++}
++
++int osdep_gntshr_close(xengntshr_handle *xgs)
++{
++ if ( xgs->fd == -1 )
++ return 0;
++
++ return close(xgs->fd);
++}
++
++void *osdep_gntshr_share_pages(xengntshr_handle *xgs,
++ uint32_t domid, int count,
++ uint32_t *refs, int writable,
++ uint32_t notify_offset,
++ evtchn_port_t notify_port)
++{
++ int err;
++ int fd = xgs->fd;
++ void *area = NULL;
++ struct ioctl_gntdev_alloc_grant_ref alloc;
++
++ alloc.gref_ids = malloc(count * sizeof(uint32_t));
++ if ( alloc.gref_ids == NULL )
++ return NULL;
++ alloc.domid = domid;
++ alloc.flags = writable ? GNTDEV_ALLOC_FLAG_WRITABLE : 0;
++ alloc.count = count;
++ area = mmap(NULL, count * PAGE_SIZE,
++ PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
++
++ if (area == MAP_FAILED) {
++ GTERROR(xgs->logger, "osdep_gnttab_grant_map: mmap failed");
++ area = MAP_FAILED;
++ goto out;
++ }
++ alloc.va = area;
++
++ alloc.notify.offset = 0;
++ alloc.notify.action = 0;
++ if ( notify_offset < PAGE_SIZE * count )
++ {
++ alloc.notify.offset = notify_offset;
++ alloc.notify.action |= UNMAP_NOTIFY_CLEAR_BYTE;
++ }
++ if ( notify_port != -1 )
++ {
++ alloc.notify.event_channel_port = notify_port;
++ alloc.notify.action |= UNMAP_NOTIFY_SEND_EVENT;
++ }
++ err = ioctl(fd, IOCTL_GNTDEV_ALLOC_GRANT_REF, &alloc);
++ if ( err )
++ {
++ GSERROR(xgs->logger, "IOCTL_GNTDEV_ALLOC_GRANT_REF failed");
++ munmap(area, count * PAGE_SIZE);
++ area = MAP_FAILED;
++ goto out;
++ }
++ memcpy(refs, alloc.gref_ids, count * sizeof(uint32_t));
++
++ out:
++ free(alloc.gref_ids);
++ return area;
++}
++
++int osdep_gntshr_unshare(xengntshr_handle *xgs,
++ void *start_address, uint32_t count)
++{
++ return munmap(start_address, count * PAGE_SIZE);
++}
++
++/*
++ * The functions below are Linux-isms that will likely never be implemented
++ * on FreeBSD unless FreeBSD also implements something akin to Linux dmabuf.
++ */
++int osdep_gnttab_dmabuf_exp_from_refs(xengnttab_handle *xgt, uint32_t domid,
++ uint32_t flags, uint32_t count,
++ const uint32_t *refs,
++ uint32_t *dmabuf_fd)
++{
++ abort();
++}
++
++int osdep_gnttab_dmabuf_exp_wait_released(xengnttab_handle *xgt,
++ uint32_t fd, uint32_t wait_to_ms)
++{
++ abort();
++}
++
++int osdep_gnttab_dmabuf_imp_to_refs(xengnttab_handle *xgt, uint32_t domid,
++ uint32_t fd, uint32_t count, uint32_t *refs)
++{
++ abort();
++}
++
++int osdep_gnttab_dmabuf_imp_release(xengnttab_handle *xgt, uint32_t fd)
++{
++ abort();
++}
++
++/*
++ * Local variables:
++ * mode: C
++ * c-file-style: "BSD"
++ * c-basic-offset: 4
++ * tab-width: 4
++ * indent-tabs-mode: nil
++ * End:
++ */
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl__create.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl__create.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl__create.c Tue May 26 11:12:11 2020
@@ -0,0 +1,40 @@
+$NetBSD: patch-tools_libxl_libxl__create.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libxl/libxl_create.c.orig 2018-04-17 19:21:31.000000000 +0200
++++ tools/libxl/libxl_create.c 2018-04-23 15:59:53.000000000 +0200
+@@ -460,7 +460,7 @@
+ vments[2] = "image/ostype";
+ vments[3] = "hvm";
+ vments[4] = "start_time";
+- vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[5] = GCSPRINTF("%jd.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
+
+ localents = libxl__calloc(gc, 13, sizeof(char *));
+ i = 0;
+@@ -499,7 +499,7 @@
+ vments[i++] = "image/kernel";
+ vments[i++] = (char *) state->pv_kernel.path;
+ vments[i++] = "start_time";
+- vments[i++] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[i++] = GCSPRINTF("%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;
+@@ -1197,7 +1197,7 @@
+ vments[2] = "image/ostype";
+ vments[3] = "hvm";
+ vments[4] = "start_time";
+- vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[5] = GCSPRINTF("%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 *));
+@@ -1207,7 +1207,7 @@
+ vments[i++] = "image/kernel";
+ vments[i++] = (char *) state->pv_kernel.path;
+ vments[i++] = "start_time";
+- vments[i++] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
++ vments[i++] = GCSPRINTF("%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;
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dm.c Tue May 26 11:12:11 2020
@@ -0,0 +1,25 @@
+--- ./tools/libxl/libxl_dm.c.orig 2020-05-08 21:07:35.429483538 +0200
++++ ./tools/libxl/libxl_dm.c 2020-05-08 21:21:20.119079508 +0200
+@@ -3351,6 +3351,14 @@
+
+ LOGD(DEBUG, domid, "DM reaper: calling setresuid(%d, %d, 0)",
+ reaper_uid, dm_kill_uid);
++#ifdef __NetBSD__
++ r = setuid(dm_kill_uid);
++ if (r) {
++ LOGED(ERROR, domid, "setuid to %d", dm_kill_uid);
++ rc = rc ?: ERROR_FAIL;
++ goto out;
++ }
++#else /* __NetBSD__ */
+ r = setresuid(reaper_uid, dm_kill_uid, 0);
+ if (r) {
+ LOGED(ERROR, domid, "setresuid to (%d, %d, 0)",
+@@ -3358,6 +3366,7 @@
+ rc = rc ?: ERROR_FAIL;
+ goto out;
+ }
++#endif /* __NetBSD__ */
+
+ /*
+ * And kill everyone but me.
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dom.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dom.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_dom.c Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_libxl_libxl_dom.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libxl/libxl_dom.c.orig
++++ tools/libxl/libxl_dom.c
+@@ -1361,7 +1361,7 @@ const char *libxl__userdata_path(libxl__gc *gc, uint32_t domid,
+ goto out;
+ }
+ uuid_string = GCSPRINTF(LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid));
+- path = GCSPRINTF(XEN_LIB_DIR "/userdata-%s.%u.%s.%s",
++ path = GCSPRINTF(XEN_RUN_DIR "/userdata-%s.%u.%s.%s",
+ wh, domid, uuid_string, userdata_userid);
+
+ out:
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_event.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_event.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_event.c Tue May 26 11:12:11 2020
@@ -0,0 +1,24 @@
+$NetBSD: patch-tools_libxl_libxl_event.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+The SIGCHLD handler just writes to a pipe where the reader is the
+same process. The idea is that this will cause poll(2) in the main
+thread to exit with the reaper pipe readable, and do child cleanup here.
+
+Unfortunably, is the child also has a write pipe back to the
+parent (as e.g. with pygrub), the loop in afterpoll_internal() may see the
+POLLHUP event on this pipe before the POLLIN even on the reaper pipe, and
+this will be considered as an error (from e.g. pygrub).
+
+work around by filtering POLLHUP events here
+
+--- tools/libxl/libxl_event.c.orig 2016-12-20 16:01:30.000000000 +0100
++++ tools/libxl/libxl_event.c 2016-12-20 17:28:52.000000000 +0100
+@@ -1261,7 +1261,7 @@
+
+ revents = afterpoll_check_fd(poller,fds,nfds,
+ efd->fd,efd->events);
+- if (revents)
++ if (revents & ~POLLHUP)
+ goto found_fd_event;
+ }
+ /* no ordinary fd events, then */
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_internal.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_internal.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_internal.h Tue May 26 11:12:11 2020
@@ -0,0 +1,23 @@
+$NetBSD: patch-tools_libxl_libxl_internal.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+bump some timeouts to more reasonable values. 40s is not enough
+if there is lots of them (e.g lots of network interfaces) and they
+need to be serialized.
+
+--- tools/libxl/libxl_internal.h.orig 2019-12-17 15:23:09.000000000 +0100
++++ tools/libxl/libxl_internal.h 2020-05-08 20:07:01.795038304 +0200
+@@ -93,11 +93,11 @@
+ #include "_libxl_types_internal_json.h"
+
+ #define LIBXL_INIT_TIMEOUT 10
+-#define LIBXL_DESTROY_TIMEOUT 10
+-#define LIBXL_HOTPLUG_TIMEOUT 40
++#define LIBXL_DESTROY_TIMEOUT 180
++#define LIBXL_HOTPLUG_TIMEOUT 180
+ /* QEMU may be slow to load and start due to a bug in Linux where the I/O
+ * subsystem sometime produce high latency under load. */
+-#define LIBXL_DEVICE_MODEL_START_TIMEOUT 60
++#define LIBXL_DEVICE_MODEL_START_TIMEOUT 180
+ #define LIBXL_DEVICE_MODEL_SAVE_FILE XEN_LIB_DIR "/qemu-save" /* .$domid */
+ #define LIBXL_DEVICE_MODEL_RESTORE_FILE XEN_LIB_DIR "/qemu-resume" /* .$domid */
+ #define LIBXL_QMP_CMD_TIMEOUT 10
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_uuid.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_uuid.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_libxl_libxl_uuid.c Tue May 26 11:12:11 2020
@@ -0,0 +1,22 @@
+$NetBSD: patch-tools_libxl_libxl_uuid.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/libxl/libxl_uuid.c.orig 2016-12-05 13:03:27.000000000 +0100
++++ tools/libxl/libxl_uuid.c 2017-03-24 18:15:58.000000000 +0100
+@@ -82,7 +82,7 @@
+ uuid_enc_be(uuid->uuid, &nat_uuid);
+ }
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ int libxl_uuid_from_string(libxl_uuid *uuid, const char *in)
+ {
+ uint32_t status;
+@@ -120,7 +120,7 @@
+ memset(&uuid->uuid, 0, sizeof(uuid->uuid));
+ }
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ int libxl_uuid_compare(const libxl_uuid *uuid1, const libxl_uuid *uuid2)
+ {
+ uuid_t nat_uuid1, nat_uuid2;
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_common.make
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_common.make:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_common.make Tue May 26 11:12:11 2020
@@ -0,0 +1,31 @@
+$NetBSD: patch-tools_ocaml_common.make,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+Handle ocaml-findlib 1.7.3 already appending destdir
+Add -unsafe-string to fix build with ocaml-4.06.0 and later
+
+--- tools/ocaml/common.make.orig 2018-01-23 13:49:58.000000000 +0000
++++ tools/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
+@@ -12,11 +12,11 @@ OCAMLFIND ?= ocamlfind
+ CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
+
+ OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^ *\(-g\) .*/\1/p')
+-OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
+-OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
++OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -unsafe-string -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
++OCAMLCFLAGS += -unsafe-string -g $(OCAMLINCLUDE) -w F -warn-error F
+
+ VERSION := 4.1
+
+-OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
++OCAMLDESTDIR ?= $(shell $(OCAMLFIND) printconf destdir)
+
+ o= >$@.new && mv -f $@.new $@
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-tools_ocaml_xenstored_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/ocaml/xenstored/Makefile.orig 2016-02-09 14:44:19.000000000 +0000
++++ tools/ocaml/xenstored/Makefile
+@@ -1,6 +1,7 @@
+ XEN_ROOT = $(CURDIR)/../../..
+ OCAML_TOPLEVEL = $(CURDIR)/..
+ include $(OCAML_TOPLEVEL)/common.make
++XEN_CONFIG_DIR=${XEN_EXAMPLES_DIR}
+
+ # Include configure output (config.h)
+ CFLAGS += -include $(XEN_ROOT)/tools/config.h
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_utils.ml
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_utils.ml:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_ocaml_xenstored_utils.ml Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_ocaml_xenstored_utils.ml,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- ./tools/ocaml/xenstored/utils.ml.orig 2018-07-09 15:47:19.000000000 +0200
++++ ./tools/ocaml/xenstored/utils.ml 2018-07-16 13:50:03.000000000 +0200
+@@ -86,7 +86,7 @@
+ let buf = Bytes.make 20 '\000' in
+ let sz = Unix.read fd buf 0 20 in
+ Unix.close fd;
+- int_of_string (Bytes.sub_string 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
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,84 @@
+$NetBSD: patch-tools_qemu-xen-traditional_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/Makefile.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/Makefile 2015-01-19 14:16:12.000000000 +0100
+@@ -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 @@
+ 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_PROG) $(STRIP_OPT) $(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 @@
+
+ # documentation
+ %.html: %.texi
+- texi2html -monolithic -number $<
++ texi2html -monolithic -number-sections $<
+
+ %.info: %.texi
+ makeinfo $< -o $@
+@@ -284,15 +284,15 @@
+ 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
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_block-raw-posix.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_block-raw-posix.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_block-raw-posix.c Tue May 26 11:12:11 2020
@@ -0,0 +1,62 @@
+$NetBSD: patch-tools_qemu-xen-traditional_block-raw-posix.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+- if given a block device, use the character device instead.
+
+--- tools/qemu-xen-traditional/block-raw-posix.c.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/block-raw-posix.c 2015-01-19 13:16:38.000000000 +0100
+@@ -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 @@
+ {
+ 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();
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_configure
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_configure:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_configure Tue May 26 11:12:11 2020
@@ -0,0 +1,41 @@
+$NetBSD: patch-tools_qemu-xen-traditional_configure,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/configure.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/configure 2015-01-20 22:58:07.000000000 +0100
+@@ -1089,7 +1089,7 @@
+ # 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 @@
+ if test -z "$prefix" ; then
+ prefix="/usr/local"
+ fi
+- mansuffix="/share/man"
++ mansuffix="/man"
+ datasuffix="/share/qemu"
+ docsuffix="/share/doc/qemu"
+ binsuffix="/bin"
+@@ -1216,6 +1216,8 @@
+ echo "MAKE=$make" >> $config_mak
+ echo "INSTALL=$install" >> $config_mak
+ echo "INSTALL_PROG=$install -m 0755" >> $config_mak
++echo "INSTALL_DATA=$install -m0644" >> $config_mak
++echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
+ echo "CC=$cc" >> $config_mak
+ echo "HOST_CC=$host_cc" >> $config_mak
+ echo "AR=$ar" >> $config_mak
+@@ -1493,7 +1495,9 @@
+ # XXX: suppress that
+ if [ "$bsd" = "yes" ] ; then
+ echo "#define O_LARGEFILE 0" >> $config_h
++ echo "#ifndef MAP_ANONYMOUS" >> $config_h
+ echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
++ echo "#endif" >> $config_h
+ echo "#define _BSD 1" >> $config_h
+ fi
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_e1000.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_e1000.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_e1000.c Tue May 26 11:12:11 2020
@@ -0,0 +1,34 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_e1000.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+From sysutils/xentools33/patches/patch-ak.
+
+qemu-0.13.x will include this fix:
+http://git.qemu.org/qemu.git/commit/?id=9651ac55e5de0e1534d898316cc851af6ffc4334
+
+--- tools/qemu-xen-traditional/hw/e1000.c.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/hw/e1000.c 2015-01-19 13:16:38.000000000 +0100
+@@ -265,16 +265,20 @@
+
+ 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;
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_ide.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_ide.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_ide.c Tue May 26 11:12:11 2020
@@ -0,0 +1,37 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_ide.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/ide.c.orig 2014-01-09 13:44:42.000000000 +0100
++++ tools/qemu-xen-traditional/hw/ide.c 2015-06-11 16:15:49.000000000 +0200
+@@ -757,10 +757,15 @@
+ put_le16(p + 58, oldsize >> 16);
+ if (s->mult_sectors)
+ put_le16(p + 59, 0x100 | s->mult_sectors);
+- put_le16(p + 60, s->nb_sectors);
+- put_le16(p + 61, s->nb_sectors >> 16);
++ if (s->nb_sectors > 0x10000000)
++ oldsize = 0x10000000; /* report only 128GB */
++ else
++ oldsize = s->nb_sectors;
++ put_le16(p + 60, oldsize);
++ put_le16(p + 61, oldsize >> 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 +817,12 @@
+ 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 */
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.c Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_pass-through.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/pass-through.c.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/hw/pass-through.c 2015-01-19 13:16:38.000000000 +0100
+@@ -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"
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pass-through.h Tue May 26 11:12:11 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_pass-through.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/pass-through.h.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/hw/pass-through.h 2015-01-19 13:16:38.000000000 +0100
+@@ -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"
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_piix4acpi.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_piix4acpi.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_piix4acpi.c Tue May 26 11:12:11 2020
@@ -0,0 +1,17 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_piix4acpi.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/piix4acpi.c.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/hw/piix4acpi.c 2015-01-19 13:16:38.000000000 +0100
+@@ -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)
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-graphics.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-graphics.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-graphics.c Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_pt-graphics.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/pt-graphics.c.orig 2015-01-19 16:14:46.000000000 +0100
++++ tools/qemu-xen-traditional/hw/pt-graphics.c 2015-01-19 16:14:51.000000000 +0100
+@@ -4,8 +4,6 @@
+
+ #include "pass-through.h"
+ #include "pci.h"
+-#include "pci/header.h"
+-#include "pci/pci.h"
+
+ #include <unistd.h>
+ #include <sys/ioctl.h>
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.c Tue May 26 11:12:11 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_pt-msi.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/pt-msi.c.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/hw/pt-msi.c 2015-01-19 13:16:38.000000000 +0100
+@@ -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;
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.h
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.h:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_hw_pt-msi.h Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-tools_qemu-xen-traditional_hw_pt-msi.h,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/hw/pt-msi.h.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/hw/pt-msi.h 2015-01-19 13:16:38.000000000 +0100
+@@ -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 */
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-tools_qemu-xen-traditional_i386-dm_hookstarget.mak,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen-traditional/i386-dm/hookstarget.mak.orig 2014-10-06 17:50:24.000000000 +0200
++++ tools/qemu-xen-traditional/i386-dm/hookstarget.mak 2015-01-19 13:16:38.000000000 +0100
+@@ -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"
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_net.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_net.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_net.c Tue May 26 11:12:11 2020
@@ -0,0 +1,46 @@
+$NetBSD: patch-tools_qemu-xen-traditional_net.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+--- tools/qemu-xen-traditional/net.c.orig 2016-11-29 17:36:38.000000000 +0100
++++ tools/qemu-xen-traditional/net.c 2017-03-29 18:16:54.000000000 +0200
+@@ -990,6 +990,7 @@
+ #define DEFAULT_NETWORK_DOWN_SCRIPT ""
+ #endif
+
++#if !defined(CONFIG_STUBDOM)
+ static int launch_script(const char *setup_script, const char *ifname,
+ const char *script_arg, int fd)
+ {
+@@ -1028,6 +1029,7 @@
+ }
+ return 0;
+ }
++#endif
+
+ static int net_tap_init(VLANState *vlan, const char *model,
+ const char *name, const char *ifname1,
+@@ -1048,12 +1050,14 @@
+
+ if (!setup_script || !strcmp(setup_script, "no"))
+ setup_script = "";
++#if !defined(CONFIG_STUBDOM)
+ if (setup_script[0] != '\0') {
+ if (launch_script(setup_script, ifname, script_arg, fd)) {
+ close(fd);
+ return -1;
+ }
+ }
++#endif
+ s = net_tap_fd_init(vlan, model, name, fd);
+ if (!s)
+ return -1;
+@@ -1965,9 +1969,11 @@
+ if (vc->fd_read == tap_receive) {
+ TAPState *s = vc->opaque;
+
++#ifndef CONFIG_STUBDOM
+ if (s->down_script[0])
+ launch_script(s->down_script, s->down_script_arg,
+ s->script_arg, s->fd);
++#endif
+ }
+ #if defined(CONFIG_VDE)
+ if (vc->fd_read == vde_from_qemu) {
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_xen-hooks.mak
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_xen-hooks.mak:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen-traditional_xen-hooks.mak Tue May 26 11:12:11 2020
@@ -0,0 +1,51 @@
+$NetBSD: patch-tools_qemu-xen-traditional_xen-hooks.mak,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+enable PCI passthrough when pciutils is present
+
+--- tools/qemu-xen-traditional/xen-hooks.mak.orig 2017-09-15 20:37:27.000000000 +0200
++++ tools/qemu-xen-traditional/xen-hooks.mak 2018-04-23 16:01:41.000000000 +0200
+@@ -26,11 +26,11 @@
+ LIBS += -L$(XEN_ROOT)/tools/libs/gnttab -lxengnttab
+ LIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl -lxenguest
+ LIBS += -L$(XEN_ROOT)/tools/xenstore -lxenstore
+-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toollog
+-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/toolcore
+-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/call
+-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/foreignmemory
+-LIBS += -Wl,-rpath-link=$(XEN_ROOT)/tools/libs/devicemodel
++LIBS += -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/toollog
++LIBS += -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/toolcore
++LIBS += -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/call
++LIBS += -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/foreignmemory
++LIBS += -Wl,-rpath-link,$(XEN_ROOT)/tools/libs/devicemodel
+
+ LDFLAGS := $(CFLAGS) $(LDFLAGS)
+
+@@ -71,17 +71,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
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_audio_audio.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_audio_audio.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_audio_audio.c Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-tools_qemu-xen_audio_audio.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen/audio/audio.c.orig 2016-11-24 13:24:26.000000000 +0100
++++ tools/qemu-xen/audio/audio.c 2017-03-24 18:11:17.000000000 +0100
+@@ -1156,6 +1156,7 @@
+ return 0;
+ }
+
++#undef read
+ return sw->hw->pcm_ops->read(sw, buf, size);
+ }
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_configure
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_configure:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_configure Tue May 26 11:12:11 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-tools_qemu-xen_configure,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+-lrt is needed for shm_open()
+
+--- tools/qemu-xen/configure.orig 2019-09-27 12:21:35.000000000 +0200
++++ tools/qemu-xen/configure 2020-05-08 20:09:00.341400664 +0200
+@@ -841,6 +841,7 @@
+ audio_drv_list="oss try-sdl"
+ audio_possible_drivers="oss sdl"
+ oss_lib="-lossaudio"
++ LIBS="-lrt $LIBS"
+ HOST_VARIANT_DIR="netbsd"
+ supported_os="yes"
+ ;;
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap-bsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap-bsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_net_tap-bsd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,44 @@
+$NetBSD: patch-tools_qemu-xen_net_tap-bsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/qemu-xen/net/tap-bsd.c.orig 2020-05-18 10:41:00.816005830 +0200
++++ tools/qemu-xen/net/tap-bsd.c 2020-05-18 15:02:30.497691415 +0200
+@@ -40,7 +40,7 @@
+ #include <sys/param.h>
+ #endif
+
+-#ifndef __FreeBSD__
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
+ int vnet_hdr_required, int mq_required, Error **errp)
+ {
+@@ -112,7 +112,7 @@
+ return fd;
+ }
+
+-#else /* __FreeBSD__ */
++#else /* __FreeBSD__ || __NetBSD__ */
+
+ #define PATH_NET_TAP "/dev/tap"
+
+@@ -137,6 +137,7 @@
+ }
+
+ if (ifname[0] != '\0') {
++#ifdef SIOCSIFNAME
+ /* User requested the interface to have a specific name */
+ s = socket(AF_LOCAL, SOCK_DGRAM, 0);
+ if (s < 0) {
+@@ -153,10 +154,12 @@
+ close(fd);
+ return -1;
+ }
++#else
++ pstrcpy(ifname, ifname_size, ifr.ifr_name);
++#endif
+ } else {
+ pstrcpy(ifname, ifname_size, ifr.ifr_name);
+ }
+-
+ return fd;
+ }
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_qemu-doc.texi
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_qemu-doc.texi:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_qemu-xen_qemu-doc.texi Tue May 26 11:12:11 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-tools_qemu-xen_qemu-doc.texi,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+Avoid encoding issues in pod2man.
+
+--- tools/qemu-xen/qemu-doc.texi.orig 2014-12-02 11:41:02.000000000 +0100
++++ tools/qemu-xen/qemu-doc.texi 2015-01-19 14:24:23.000000000 +0100
+@@ -220,7 +220,7 @@
+ QEMU uses YM3812 emulation by Tatsuyuki Satoh.
+
+ QEMU uses GUS emulation (GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
+-by Tibor "TS" Schütz.
++by Tibor "TS" Schuetz.
+
+ Note that, by default, GUS shares IRQ(7) with parallel ports and so
+ QEMU must be told to not have parallel ports to have working GUS.
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xenpaging_xenpaging.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xenpaging_xenpaging.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xenpaging_xenpaging.c Tue May 26 11:12:11 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-tools_xenpaging_xenpaging.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/xenpaging/xenpaging.c.orig 2016-06-20 12:08:22.000000000 +0000
++++ tools/xenpaging/xenpaging.c
+@@ -182,10 +182,11 @@ static int xenpaging_get_tot_pages(struc
+ static void *init_page(void)
+ {
+ void *buffer;
++ int rc;
+
+ /* Allocated page memory */
+- errno = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
+- if ( errno != 0 )
++ rc = posix_memalign(&buffer, PAGE_SIZE, PAGE_SIZE);
++ if ( rc != 0 )
+ return NULL;
+
+ /* Lock buffer in memory so it can't be paged out */
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xenpmd_xenpmd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xenpmd_xenpmd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xenpmd_xenpmd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-tools_xenpmd_xenpmd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+Elide format-truncation errors with GCC >= 7.
+
+--- tools/xenpmd/xenpmd.c.orig 2018-07-09 13:47:19.000000000 +0000
++++ tools/xenpmd/xenpmd.c
+@@ -100,7 +100,7 @@ FILE *get_next_battery_file(DIR *battery
+ {
+ FILE *file = 0;
+ struct dirent *dir_entries;
+- char file_name[284];
++ char file_name[FILENAME_MAX];
+
+ do
+ {
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c Tue May 26 11:12:11 2020
@@ -0,0 +1,31 @@
+$NetBSD: patch-tools_xenstat_libxenstat_src_xenstat_netbsd.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+Fix unused functions/variables error
+
+--- tools/xenstat/libxenstat/src/xenstat_netbsd.c.orig 2020-05-08 20:37:14.116639155 +0200
++++ tools/xenstat/libxenstat/src/xenstat_netbsd.c 2020-05-08 20:37:51.740635933 +0200
+@@ -55,11 +55,6 @@
+ }
+
+ /* Expected format of /proc/net/dev */
+-static const char PROCNETDEV_HEADER[] =
+- "Inter-| Receive |"
+- " Transmit\n"
+- " face |bytes packets errs drop fifo frame compressed multicast|"
+- "bytes packets errs drop fifo colls carrier compressed\n";
+
+ /* Collect information about networks */
+ int xenstat_collect_networks(xenstat_node * node)
+@@ -76,12 +71,6 @@
+ fclose(priv->procnetdev);
+ }
+
+-static int read_attributes_vbd(const char *vbd_directory, const char *what, char *ret, int cap)
+-{
+- /* XXX implement */
+- return 0;
+-}
+-
+ /* Collect information about VBDs */
+ int xenstat_collect_vbds(xenstat_node * node)
+ {
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xc.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xc.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xc.c Tue May 26 11:12:11 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-tools_xenstore_xc.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/xenstore/xs.c.orig 2015-01-19 15:40:00.000000000 +0100
++++ tools/xenstore/xs.c 2015-01-19 15:46:56.000000000 +0100
+@@ -725,9 +725,13 @@
+
+ #ifdef USE_PTHREAD
+ #define DEFAULT_THREAD_STACKSIZE (16 * 1024)
++#ifndef PTHREAD_STACK_MIN
++#define READ_THREAD_STACKSIZE DEFAULT_THREAD_STACKSIZE
++#else
+ #define READ_THREAD_STACKSIZE \
+ ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ? \
+ PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
++#endif
+
+ /* We dynamically create a reader thread on demand. */
+ mutex_lock(&h->request_mutex);
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xs_lib.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xs_lib.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xenstore_xs_lib.c Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_xenstore_xs_lib.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/xenstore/xs_lib.c.orig
++++ tools/xenstore/xs_lib.c
+@@ -52,7 +52,7 @@ static const char *xs_daemon_path(void)
+ const char *xs_daemon_tdb(void)
+ {
+ static char buf[PATH_MAX];
+- snprintf(buf, sizeof(buf), "%s/tdb", xs_daemon_rootdir());
++ snprintf(buf, sizeof(buf), "%s/tdb", xs_daemon_rundir());
+ return buf;
+ }
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xentrace_xentrace.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xentrace_xentrace.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xentrace_xentrace.c Tue May 26 11:12:11 2020
@@ -0,0 +1,13 @@
+$NetBSD: patch-tools_xentrace_xentrace.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/xentrace/xentrace.c.orig 2016-02-09 14:44:19.000000000 +0000
++++ tools/xentrace/xentrace.c
+@@ -945,7 +945,7 @@ static int parse_cpumask_range(const cha
+ {
+ unsigned int a, b;
+ int nmaskbits;
+- char c;
++ unsigned char c;
+ int in_range;
+ const char *s;
+
Index: pkgsrc/sysutils/xentools413/patches/patch-tools_xl_Makefile
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-tools_xl_Makefile:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-tools_xl_Makefile Tue May 26 11:12:11 2020
@@ -0,0 +1,16 @@
+$NetBSD: patch-tools_xl_Makefile,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- tools/xl/Makefile.orig 2018-04-24 12:18:12.000000000 +0200
++++ tools/xl/Makefile 2018-04-24 12:18:46.000000000 +0200
+@@ -42,9 +42,9 @@
+ .PHONY: install
+ install: all
+ $(INSTALL_DIR) $(DESTDIR)$(sbindir)
+- $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
++ $(INSTALL_DIR) $(DESTDIR)$(XEN_EXAMPLES_DIR)
+ $(INSTALL_PROG) xl $(DESTDIR)$(sbindir)
+- $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
++ $(INSTALL_DATA) bash-completion $(DESTDIR)$(XEN_EXAMPLES_DIR)/xl.sh
+
+ .PHONY: uninstall
+ uninstall:
Index: pkgsrc/sysutils/xentools413/patches/patch-xen_Rules.mk
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-xen_Rules.mk:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-xen_Rules.mk Tue May 26 11:12:11 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-xen_Rules.mk,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+
+--- xen/Rules.mk.orig 2018-04-23 14:50:02.000000000 +0200
++++ xen/Rules.mk 2018-04-23 14:50:32.000000000 +0200
+@@ -1,4 +1,7 @@
+
++#reset cflags. Why is it needed in pkgsrc ?
++CFLAGS=
++
+ -include $(BASEDIR)/include/config/auto.conf
+
+ include $(XEN_ROOT)/Config.mk
Index: pkgsrc/sysutils/xentools413/patches/patch-xen_tools_symbols.c
diff -u /dev/null pkgsrc/sysutils/xentools413/patches/patch-xen_tools_symbols.c:1.1
--- /dev/null Tue May 26 11:12:11 2020
+++ pkgsrc/sysutils/xentools413/patches/patch-xen_tools_symbols.c Tue May 26 11:12:11 2020
@@ -0,0 +1,19 @@
+$NetBSD: patch-xen_tools_symbols.c,v 1.1 2020/05/26 11:12:11 bouyer Exp $
+symbols.c:180:2: error: array subscript has type 'char' [-Werror=char-subscripts]
+
+--- ./xen/tools/symbols.c 2018-04-23 18:11:57.000000000 +0200
++++ ./xen/tools/symbols.c.orig 2018-04-23 18:13:15.000000000 +0200
+@@ -173,11 +173,11 @@
+ /* include the type field in the symbol name, so that it gets
+ * compressed together */
+ s->len = strlen(str) + 1;
+- if (islower(stype) && filename)
++ if (islower((unsigned char)stype) && filename)
+ s->len += strlen(filename) + 1;
+ s->sym = malloc(s->len + 1);
+ sym = SYMBOL_NAME(s);
+- if (islower(stype) && filename) {
++ if (islower((unsigned char)stype) && filename) {
+ sym = stpcpy(sym, filename);
+ *sym++ = '#';
+ }
Home |
Main Index |
Thread Index |
Old Index