summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorbouyer <bouyer>2006-10-19 22:58:21 +0000
committerbouyer <bouyer>2006-10-19 22:58:21 +0000
commit67bafbb68f5fcfb57ae609ae54d0f4e6c364c56d (patch)
treeb617ed489bfabad69cdd986d005f984bef56a2ac /sysutils
parenteb2773cfe604cd6cdca0c37061bc87e160b452cd (diff)
downloadpkgsrc-67bafbb68f5fcfb57ae609ae54d0f4e6c364c56d.tar.gz
Import a xentools30-hvm package, version 3.0.3
The Xen virtual machine monitor allows running several virtual machines on a single physical machine. The xentools30-vmx package contains additionnal tools to xentools30 to run unmodified guests using the Intel VT or AMD VMX extentions.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/xentools30-hvm/DESCR4
-rw-r--r--sysutils/xentools30-hvm/Makefile90
-rw-r--r--sysutils/xentools30-hvm/PLIST44
-rw-r--r--sysutils/xentools30-hvm/distinfo20
-rw-r--r--sysutils/xentools30-hvm/files/hvm-nbsd54
-rw-r--r--sysutils/xentools30-hvm/files/xenio.h105
-rw-r--r--sysutils/xentools30-hvm/files/xenio3.h89
-rw-r--r--sysutils/xentools30-hvm/patches/patch-aa58
-rw-r--r--sysutils/xentools30-hvm/patches/patch-an24
-rw-r--r--sysutils/xentools30-hvm/patches/patch-ao23
-rw-r--r--sysutils/xentools30-hvm/patches/patch-ap12
-rw-r--r--sysutils/xentools30-hvm/patches/patch-ar142
-rw-r--r--sysutils/xentools30-hvm/patches/patch-as26
-rw-r--r--sysutils/xentools30-hvm/patches/patch-at13
-rw-r--r--sysutils/xentools30-hvm/patches/patch-au16
-rw-r--r--sysutils/xentools30-hvm/patches/patch-av12
-rw-r--r--sysutils/xentools30-hvm/patches/patch-aw32
-rw-r--r--sysutils/xentools30-hvm/patches/patch-ax14
-rw-r--r--sysutils/xentools30-hvm/patches/patch-ay28
-rw-r--r--sysutils/xentools30-hvm/patches/patch-ba15
-rw-r--r--sysutils/xentools30-hvm/patches/patch-bb19
-rw-r--r--sysutils/xentools30-hvm/patches/patch-bv33
22 files changed, 873 insertions, 0 deletions
diff --git a/sysutils/xentools30-hvm/DESCR b/sysutils/xentools30-hvm/DESCR
new file mode 100644
index 00000000000..8b7d41362d4
--- /dev/null
+++ b/sysutils/xentools30-hvm/DESCR
@@ -0,0 +1,4 @@
+The Xen virtual machine monitor allows running several virtual machines
+on a single physical machine. The xentools30-vmx package contains
+additionnal tools to xentools30 to run unmodified guests using the
+Intel VT or AMD VMX extentions.
diff --git a/sysutils/xentools30-hvm/Makefile b/sysutils/xentools30-hvm/Makefile
new file mode 100644
index 00000000000..05c0155277c
--- /dev/null
+++ b/sysutils/xentools30-hvm/Makefile
@@ -0,0 +1,90 @@
+# $NetBSD: Makefile,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+#
+
+DISTNAME= xen-3.0.3_0-src
+PKGNAME= xentools30-hvm-3.0.3
+CATEGORIES= sysutils
+MASTER_SITES= http://www.cl.cam.ac.uk/research/srg/netos/xen/downloads/ \
+ http://bits.xensource.com/oss-xen/release/3.0.3-0/src.tgz/
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= bouyer@NetBSD.org
+HOMEPAGE= http://www.cl.cam.ac.uk/research/srg/netos/xen/
+COMMENT= Tools for Virtual Machine Extensions support in Xen
+
+BUILD_DEPENDS+= dev86-[0-9]*:../../devel/dev86 # needed to build firmware
+
+PKG_SYSCONFSUBDIR= xen
+
+ONLY_FOR_PLATFORM= Linux-2.[46]*-i386 NetBSD-*-i386
+
+CONFLICTS+= libxen-[0-9]*
+CONFLICTS+= xentools20-[0-9]*
+
+WRKSRC= ${WRKDIR}/xen-3.0.3_0-src/tools
+
+EGDIR= ${PREFIX}/share/examples/xen
+MESSAGE_SUBST= EGDIR=${EGDIR}
+
+USE_TOOLS+= perl
+USE_TOOLS+= gmake
+MAKE_ENV+= EGDIR=${EGDIR:Q}
+MAKE_ENV+= MV=${MV:Q} PYTHON=${PYTHONBIN:Q} SED=${SED:Q}
+MAKE_ENV+= XEN_TARGET_ARCH="x86_32"
+PYTHON_VERSIONS_ACCEPTED= 24 23 22
+PY_PATCHPLIST= yes
+PYTHON_PATCH_SCRIPTS= ioemu/keymaps/convert-map
+
+SUBST_CLASSES+= paths
+SUBST_STAGE.paths= pre-configure
+SUBST_FILES.paths= ioemu/vl.c
+SUBST_SED.paths= -e "s|/usr/sbin|${PREFIX}/sbin|g"
+SUBST_MESSAGE.paths= Fixing hardcoded paths.
+
+SUBST_CLASSES+= conf
+SUBST_STAGE.conf= pre-configure
+SUBST_FILES.conf= ioemu/configure
+SUBST_FILES.conf+= ioemu/vl.c
+SUBST_SED.conf= -e "s,@XENDCONFDIR@,${PKG_SYSCONFDIR},g"
+
+SUBST_CLASSES+= prefix
+SUBST_STAGE.prefix= pre-configure
+SUBST_FILES.prefix= python/xen/util/auxbin.py
+SUBST_FILES.prefix= ioemu/vl.c
+SUBST_SED.prefix= -e "s,@PREFIX@,${PREFIX},g"
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "NetBSD"
+PROCPATH= /kern
+.else
+PROCPATH= /proc
+.endif
+
+pre-build:
+ ${MKDIR} ${WRKSRC}/libxc/xen/NetBSD
+ ${TEST} -f ${WRKSRC}/libxc/xen/NetBSD/xenio.h || ${CP} ${FILESDIR}/xenio.h ${WRKSRC}/libxc/xen/NetBSD
+ ${TEST} -f ${WRKSRC}/libxc/xen/NetBSD/xenio3.h || ${CP} ${FILESDIR}/xenio3.h ${WRKSRC}/libxc/xen/NetBSD
+
+.if ${OPSYS} == "NetBSD"
+post-build:
+ cd ${FILESDIR}; for src in *-nbsd; do \
+ dst="$${src%-nbsd}"; \
+ ${SED} -e "s|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g" \
+ -e "s|@PREFIX@|${PREFIX}|g" \
+ $$src > ${WRKSRC}/examples/$$dst; \
+ done
+.endif
+
+post-install:
+ for f in hvm; do \
+ ${INSTALL_DATA} ${WRKSRC}/examples/$$f ${EGDIR}/$$f; \
+ done
+
+.include "../../lang/python/application.mk"
+.include "../../lang/python/extension.mk"
+.include "../../devel/ncurses/buildlink3.mk"
+.include "../../devel/SDL/buildlink3.mk"
+.include "../../sysutils/xentools30/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/xentools30-hvm/PLIST b/sysutils/xentools30-hvm/PLIST
new file mode 100644
index 00000000000..427d7ff044a
--- /dev/null
+++ b/sysutils/xentools30-hvm/PLIST
@@ -0,0 +1,44 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+lib/xen/boot/hvmloader
+libexec/qemu-dm
+share/examples/xen/hvm
+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
+@dirrm lib/xen/boot
+@dirrm lib/xen
+@dirrm share/xen/qemu/keymaps
+@dirrm share/xen/qemu
+@dirrm share/xen
diff --git a/sysutils/xentools30-hvm/distinfo b/sysutils/xentools30-hvm/distinfo
new file mode 100644
index 00000000000..8a31de0da23
--- /dev/null
+++ b/sysutils/xentools30-hvm/distinfo
@@ -0,0 +1,20 @@
+$NetBSD: distinfo,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+SHA1 (xen-3.0.3_0-src.tgz) = 9505ae3a5a42bc969836de81f501341409291f78
+RMD160 (xen-3.0.3_0-src.tgz) = 528020035ee32144b52bcdfccc8c44708b0196ea
+Size (xen-3.0.3_0-src.tgz) = 5465968 bytes
+SHA1 (patch-aa) = 1da529f00c897ef39bad7d3816cd5df0a468c280
+SHA1 (patch-an) = eab8d3a62da0b13b89fa575d5c950b6d12a27758
+SHA1 (patch-ao) = d1250258d09cf9b330a4e9d52e85332a0eef7998
+SHA1 (patch-ap) = 33f2bdbef6df3f2105d4502b8066abb6c952fc6c
+SHA1 (patch-ar) = e29052024101975c2e77809cef27efa41e816a2b
+SHA1 (patch-as) = 8850108d0c8f101642f4855184253824f9c214b5
+SHA1 (patch-at) = 2311289176c83fcd3ff18b90bab9c2e5e05a52f1
+SHA1 (patch-au) = beb2eaa8bf832e179e69b1758cfe0fafafdc496b
+SHA1 (patch-av) = be2a1440126908996410f92a04ad479f8a2ca373
+SHA1 (patch-aw) = 2776799b391983ad79af0f28367287a4a865260a
+SHA1 (patch-ax) = 93411fbeff95f76d723fdda993d55a2740d3a713
+SHA1 (patch-ay) = 59d1f89972bfabeb27cb80b92710dafefe9e448e
+SHA1 (patch-ba) = ee151472a9ec28301b67e696e81673c4bf753ed6
+SHA1 (patch-bb) = 4bfe5b1dad33244b3be3359d37ad1054cd876e7c
+SHA1 (patch-bv) = 4f3e34d75a073e55711ebbf6ddd805d5db097e42
diff --git a/sysutils/xentools30-hvm/files/hvm-nbsd b/sysutils/xentools30-hvm/files/hvm-nbsd
new file mode 100644
index 00000000000..b5a16bd8f84
--- /dev/null
+++ b/sysutils/xentools30-hvm/files/hvm-nbsd
@@ -0,0 +1,54 @@
+#============================================================================
+# Python configuration setup for 'xm create'.
+# This script sets the parameters used when a domain is created using 'xm create'.
+# You use a separate script for each domain you want to create, or
+# you can set the parameters for the domain on the xm command line.
+#============================================================================
+
+#----------------------------------------------------------------------------
+# Kernel image file.
+kernel = "@PREFIX@/lib/xen/boot/hvmloader"
+
+builder='hvm'
+
+# Initial memory allocation (in megabytes) for the new domain.
+memory = 256
+
+# A name for your domain. All domains must have different names.
+name = "hvm"
+
+#Network interface. By default emules a realtek 8139. For a NetBSD guest you
+# have to disable re(4) and let rtk attach to use it.
+# ne2k_pci emulates a pci ne2000 clone; this his cpu-hungry in dom0
+# pcnet emulates a AMD PCnet-PCI controller; but it corrupts packets with
+# pcn(4) under NetBSD.
+#vif = [ 'mac=00:16:3e:00:00:13, bridge=bridge0, type=ioemu, model=ne2k_pci' ]
+#vif = [ 'mac=00:16:3e:00:00:13, bridge=bridge0, type=ioemu, model=pcnet' ]
+vif = [ 'mac=00:16:3e:00:00:13, bridge=bridge0, type=ioemu' ]
+
+#----------------------------------------------------------------------------
+# Define the disk devices you want the domain to have access to, and
+# what you want them accessible as.
+# Each disk entry is of the form phy:UNAME,DEV,MODE
+# where UNAME is the device, DEV is the device name the domain will see,
+# and MODE is r for read-only, w for read-write.
+# For hvm domains you can only use hda to hdd. You can set extra types
+# (e.g. cdrom)
+
+disk = [ 'file:/home/domains/vmx,ioemu:hda,w', 'file:/home/domains/i386cd.iso,ioemu:hdc:cdrom,r' ]
+
+# floppy images; this doesn't seem to work currently. Use a iso image instead.
+#fda = '/home/domains/boot1.fs'
+
+device_model = '/usr/pkg/libexec/qemu-dm'
+
+# boot device: a = floppy, c= hard drive, d= cdrom (with the disk entry
+# before)
+boot='d'
+
+# By default, 'xm create' will try to open an X window on the current display
+# for the virtal framebuffer. You can have the virtal framebuffer in vnc
+# instead, and connect using a vnc client (using localhost:<domain number>)
+#vnc = 1
+
+#============================================================================
diff --git a/sysutils/xentools30-hvm/files/xenio.h b/sysutils/xentools30-hvm/files/xenio.h
new file mode 100644
index 00000000000..d670b414759
--- /dev/null
+++ b/sysutils/xentools30-hvm/files/xenio.h
@@ -0,0 +1,105 @@
+/* NetBSD: xenio.h,v 1.3 2005/05/24 12:07:12 yamt Exp $ */
+
+/******************************************************************************
+ * privcmd.h
+ *
+ * Copyright (c) 2003-2004, K A Fraser
+ *
+ * This file may be 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_PRIVCMD_H__
+#define __NetBSD_PRIVCMD_H__
+
+/* Interface to /proc/xen/privcmd */
+
+typedef struct privcmd_hypercall
+{
+ unsigned long op;
+ unsigned long arg[5];
+} privcmd_hypercall_t;
+
+typedef struct privcmd_mmap_entry {
+ unsigned long va;
+ unsigned long mfn;
+ unsigned long npages;
+} privcmd_mmap_entry_t;
+
+typedef struct privcmd_mmap {
+ int num;
+ domid_t dom; /* target domain */
+ privcmd_mmap_entry_t *entry;
+} privcmd_mmap_t;
+
+typedef struct privcmd_mmapbatch {
+ int num; /* number of pages to populate */
+ domid_t dom; /* target domain */
+ unsigned long addr; /* virtual address */
+ unsigned long *arr; /* array of mfns - top nibble set on err */
+} privcmd_mmapbatch_t;
+
+typedef struct privcmd_blkmsg
+{
+ unsigned long op;
+ void *buf;
+ int buf_size;
+} privcmd_blkmsg_t;
+
+/*
+ * @cmd: IOCTL_PRIVCMD_HYPERCALL
+ * @arg: &privcmd_hypercall_t
+ * Return: Value returned from execution of the specified hypercall.
+ */
+#define IOCTL_PRIVCMD_HYPERCALL \
+ _IOWR('P', 0, privcmd_hypercall_t)
+
+#if defined(_KERNEL)
+/* compat */
+#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN_OLD \
+ _IO('P', 1)
+#endif /* defined(_KERNEL) */
+
+#define IOCTL_PRIVCMD_MMAP \
+ _IOW('P', 2, privcmd_mmap_t)
+#define IOCTL_PRIVCMD_MMAPBATCH \
+ _IOW('P', 3, privcmd_mmapbatch_t)
+#define IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN \
+ _IOR('P', 4, unsigned long)
+
+/*
+ * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN
+ * @arg: n/a
+ * Return: Port associated with domain-controller end of control event channel
+ * for the initial domain.
+ */
+#define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
+ _IOR('P', 5, int)
+
+/* Interface to /dev/xenevt */
+/* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
+#define EVTCHN_RESET _IO('E', 1)
+/* EVTCHN_BIND: Bind to the specified event-channel port. */
+#define EVTCHN_BIND _IOW('E', 2, unsigned long)
+/* EVTCHN_UNBIND: Unbind from the specified event-channel port. */
+#define EVTCHN_UNBIND _IOW('E', 3, unsigned long)
+
+#endif /* __NetBSD_PRIVCMD_H__ */
diff --git a/sysutils/xentools30-hvm/files/xenio3.h b/sysutils/xentools30-hvm/files/xenio3.h
new file mode 100644
index 00000000000..d3828be8c0e
--- /dev/null
+++ b/sysutils/xentools30-hvm/files/xenio3.h
@@ -0,0 +1,89 @@
+/* $NetBSD: xenio3.h,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $ */
+/******************************************************************************
+ * evtchn.h
+ *
+ * Interface to /dev/xen/evtchn.
+ *
+ * Copyright (c) 2003-2005, K A Fraser
+ *
+ * This file may be 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_XENIO3_H__
+#define __NetBSD_XENIO3_H__
+
+/*
+ * Bind a fresh port to VIRQ @virq.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_VIRQ \
+ _IOWR('E', 4, struct ioctl_evtchn_bind_virq)
+struct ioctl_evtchn_bind_virq {
+ unsigned int virq;
+ unsigned int port;
+};
+
+/*
+ * Bind a fresh port to remote <@remote_domain, @remote_port>.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_INTERDOMAIN \
+ _IOWR('E', 5, struct ioctl_evtchn_bind_interdomain)
+struct ioctl_evtchn_bind_interdomain {
+ unsigned int remote_domain, remote_port;
+ unsigned int port;
+};
+
+/*
+ * Allocate a fresh port for binding to @remote_domain.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_UNBOUND_PORT \
+ _IOWR('E', 6, struct ioctl_evtchn_bind_unbound_port)
+struct ioctl_evtchn_bind_unbound_port {
+ unsigned int remote_domain;
+ unsigned int port;
+};
+
+/*
+ * Unbind previously allocated @port.
+ */
+#define IOCTL_EVTCHN_UNBIND \
+ _IOW('E', 7, struct ioctl_evtchn_unbind)
+struct ioctl_evtchn_unbind {
+ unsigned int port;
+};
+
+/*
+ * Send event to previously allocated @port.
+ */
+#define IOCTL_EVTCHN_NOTIFY \
+ _IOW('E', 8, struct ioctl_evtchn_notify)
+struct ioctl_evtchn_notify {
+ unsigned int port;
+};
+
+/* Clear and reinitialise the event buffer. Clear error condition. */
+#define IOCTL_EVTCHN_RESET \
+ _IO('E', 9)
+
+#endif /* __NetBSD_XENIO3_H__ */
diff --git a/sysutils/xentools30-hvm/patches/patch-aa b/sysutils/xentools30-hvm/patches/patch-aa
new file mode 100644
index 00000000000..dc8374ba781
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-aa
@@ -0,0 +1,58 @@
+$NetBSD: patch-aa,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- Makefile.orig 2006-10-04 04:27:58.000000000 +0200
++++ Makefile 2006-10-18 17:33:39.000000000 +0200
+@@ -2,31 +2,11 @@
+ include $(XEN_ROOT)/tools/Rules.mk
+
+ SUBDIRS-y :=
+-SUBDIRS-y += libxc
+-SUBDIRS-y += xenstore
+-SUBDIRS-y += misc
+-SUBDIRS-y += examples
+-SUBDIRS-y += xentrace
+-SUBDIRS-$(CONFIG_XCUTILS) += xcutils
+-SUBDIRS-$(CONFIG_X86) += firmware
+-SUBDIRS-y += security
+-SUBDIRS-y += console
+-SUBDIRS-y += xenmon
+-SUBDIRS-y += guest-headers
+-SUBDIRS-$(VTPM_TOOLS) += vtpm_manager
+-SUBDIRS-$(VTPM_TOOLS) += vtpm
+-SUBDIRS-y += xenstat
+-SUBDIRS-y += libaio
+-SUBDIRS-y += blktap
+-
+-# These don't cross-compile
+-ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
+-SUBDIRS-y += python
+-SUBDIRS-y += pygrub
+-endif
++SUBDIRS-y += firmware
+
+ .PHONY: all
+ all: check
++ (cd libxc ; $(MAKE) mk-symlinks)
+ @set -e; for subdir in $(SUBDIRS-y); do \
+ $(MAKE) -C $$subdir $@; \
+ done
+@@ -53,18 +33,16 @@
+
+ .PHONY: check
+ check:
+- $(MAKE) -C check
+
+ .PHONY: check_clean
+ check_clean:
+- $(MAKE) -C check clean
+
+ .PHONY: ioemu ioemuinstall ioemuclean
+ ifdef CONFIG_IOEMU
+ export IOEMU_DIR ?= ioemu
+ ioemu ioemuinstall:
+ [ -f $(IOEMU_DIR)/config-host.mak ] || \
+- (cd $(IOEMU_DIR) && sh configure --prefix=/usr)
++ (cd $(IOEMU_DIR) && sh configure --prefix=$(PREFIX))
+ $(MAKE) -C $(IOEMU_DIR) $(patsubst ioemu%,%,$@)
+ ioemuclean:
+ $(MAKE) -C $(IOEMU_DIR) distclean
diff --git a/sysutils/xentools30-hvm/patches/patch-an b/sysutils/xentools30-hvm/patches/patch-an
new file mode 100644
index 00000000000..de561ff64e6
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-an
@@ -0,0 +1,24 @@
+$NetBSD: patch-an,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- firmware/Makefile.orig 2006-10-04 04:28:02.000000000 +0200
++++ firmware/Makefile 2006-10-18 17:34:43.000000000 +0200
+@@ -4,7 +4,7 @@
+ # hvmloader is a 32-bit protected mode binary.
+ # It belongs in /usr/lib, not /usr/lib64.
+ TARGET := hvmloader/hvmloader
+-INSTALL_DIR := $(DESTDIR)/usr/lib/xen/boot
++INSTALL_DIR := $(PREFIX)/lib/xen/boot
+
+ SUBDIRS :=
+ SUBDIRS += rombios
+@@ -29,8 +29,8 @@
+
+ .PHONY: install
+ install: all
+- [ -d $(INSTALL_DIR) ] || install -d -m0755 $(INSTALL_DIR)
+- [ ! -e $(TARGET) ] || install -m0644 $(TARGET) $(INSTALL_DIR)
++ $(BSD_INSTALL_DATA_DIR) $(INSTALL_DIR)
++ $(BSD_INSTALL_DATA) $(TARGET) $(INSTALL_DIR)
+
+ .PHONY: clean
+ clean:
diff --git a/sysutils/xentools30-hvm/patches/patch-ao b/sysutils/xentools30-hvm/patches/patch-ao
new file mode 100644
index 00000000000..9dee07ee261
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-ao
@@ -0,0 +1,23 @@
+$NetBSD: patch-ao,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/configure.orig 2006-10-04 04:28:06.000000000 +0200
++++ ioemu/configure 2006-10-18 17:37:42.000000000 +0200
+@@ -517,7 +517,7 @@
+ datadir="$prefix/share/xen/qemu"
+ docdir="$prefix/share/doc/qemu"
+-bindir="$prefix/$libdir/xen/bin"
++bindir="$prefix/libexec"
+-configdir="/etc/xen"
++configdir="@XENDCONFDIR@"
+ fi
+
+ echo "Install prefix $prefix"
+@@ -653,6 +653,8 @@
+ echo "#define CONFIG_WIN32 1" >> $config_h
+ elif test -f "/usr/include/byteswap.h" ; then
+ echo "#define HAVE_BYTESWAP_H 1" >> $config_h
++elif test -f "/usr/include/machine/bswap.h" ; then
++ echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
+ fi
+ if test "$darwin" = "yes" ; then
+ echo "CONFIG_DARWIN=yes" >> $config_mak
diff --git a/sysutils/xentools30-hvm/patches/patch-ap b/sysutils/xentools30-hvm/patches/patch-ap
new file mode 100644
index 00000000000..6c93153b05a
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-ap
@@ -0,0 +1,12 @@
+$NetBSD: patch-ap,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- firmware/hvmloader/mkhex.orig 2006-04-13 19:48:38.000000000 +0200
++++ firmware/hvmloader/mkhex
+@@ -21,6 +21,6 @@
+ #
+
+ echo "unsigned $1[] = {"
+-od -v -t x $2 | sed 's/^[0-9]* /0x/' | sed 's/ /, 0x/g' | sed 's/$/,/'
++od -v -t x $2 | sed 's/^[0-9]* */0x0/' | sed 's/ */, 0x/g' | sed 's/$/,/'
+ echo "};"
+
diff --git a/sysutils/xentools30-hvm/patches/patch-ar b/sysutils/xentools30-hvm/patches/patch-ar
new file mode 100644
index 00000000000..069fc5e8e98
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-ar
@@ -0,0 +1,142 @@
+$NetBSD: patch-ar,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/vl.c.orig 2006-10-15 14:22:03.000000000 +0200
++++ ioemu/vl.c 2006-10-20 00:33:18.000000000 +0200
+@@ -37,14 +37,17 @@
+ #include <sys/poll.h>
+ #include <sys/mman.h>
+ #include <sys/ioctl.h>
++#include <sys/resource.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
++#include <net/if.h>
++#include <net/if_tap.h>
+ #include <arpa/inet.h>
+ #include <dirent.h>
+ #include <netdb.h>
+ #ifdef _BSD
+ #include <sys/stat.h>
+-#ifndef __APPLE__
++#ifndef _BSD
+ #include <libutil.h>
+ #endif
+ #else
+@@ -88,8 +91,8 @@
+
+ #include "exec-all.h"
+
+-#define DEFAULT_NETWORK_SCRIPT "/etc/xen/qemu-ifup"
+-#define DEFAULT_BRIDGE "xenbr0"
++#define DEFAULT_NETWORK_SCRIPT "@XENDCONFDIR@/scripts/qemu-ifup"
++#define DEFAULT_BRIDGE "bridge0"
+
+ //#define DEBUG_UNUSED_IOPORT
+ //#define DEBUG_IOPORT
+@@ -1603,7 +1606,7 @@
+ return 0;
+ }
+
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__NetBSD__)
+ CharDriverState *qemu_chr_open_pty(void)
+ {
+ struct termios tty;
+@@ -1755,7 +1758,7 @@
+ chr->chr_ioctl = tty_serial_ioctl;
+ return chr;
+ }
+-
++#if defined(__linux__)
+ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
+ {
+ int fd = (int)chr->opaque;
+@@ -1818,13 +1821,14 @@
+ chr->chr_ioctl = pp_ioctl;
+ return chr;
+ }
++#endif /* __linux__ */
+
+ #else
+ CharDriverState *qemu_chr_open_pty(void)
+ {
+ return NULL;
+ }
+-#endif
++#endif /* __linux__ || __NetBSD__ */
+
+ #endif /* !defined(_WIN32) */
+
+@@ -3064,7 +3068,7 @@
+ fclose(f);
+ atexit(smb_exit);
+
+- snprintf(smb_cmdline, sizeof(smb_cmdline), "/usr/sbin/smbd -s %s",
++ snprintf(smb_cmdline, sizeof(smb_cmdline), "@PREFIX@/sbin/smbd -s %s",
+ smb_conf);
+
+ slirp_add_exec(0, smb_cmdline, 4, 139);
+@@ -3128,16 +3132,26 @@
+ int fd;
+ char *dev;
+ struct stat s;
++ struct ifreq ifr;
+
+ fd = open("/dev/tap", O_RDWR);
+ if (fd < 0) {
+- fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
++ fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation: %s\n", strerror(errno));
+ return -1;
+ }
+
++#ifdef TAPGIFNAME
++ if (ioctl (fd, TAPGIFNAME, (void*)&ifr) < 0) {
++ fprintf(stderr, "warning: could not open get tap name: %s\n",
++ strerror(errno));
++ return -1;
++ }
++ pstrcpy(ifname, ifname_size, ifr.ifr_name);
++#else
+ fstat(fd, &s);
+ dev = devname(s.st_rdev, S_IFCHR);
+ pstrcpy(ifname, ifname_size, dev);
++#endif
+
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+ return fd;
+@@ -5855,9 +5869,36 @@
+ xen_pfn_t *page_array;
+ extern void *shared_page;
+ extern void *buffered_io_page;
++ struct rlimit rl;
+
+ char qemu_dm_logfilename[64];
+
++ /* XXX required for now */
++ if (setenv("PTHREAD_DIAGASSERT", "A", 1) != 0)
++ perror("setenv");
++ if (getrlimit(RLIMIT_STACK, &rl) != 0) {
++ perror("getrlimit(RLIMIT_STACK)");
++ exit(1);
++ }
++ rl.rlim_cur = rl.rlim_max;
++ if (setrlimit(RLIMIT_STACK, &rl) != 0)
++ perror("setrlimit(RLIMIT_STACK)");
++ if (getrlimit(RLIMIT_DATA, &rl) != 0) {
++ perror("getrlimit(RLIMIT_DATA)");
++ exit(1);
++ }
++ rl.rlim_cur = rl.rlim_max;
++ if (setrlimit(RLIMIT_DATA, &rl) != 0)
++ perror("setrlimit(RLIMIT_DATA)");
++ rl.rlim_cur = RLIM_INFINITY;
++ rl.rlim_max = RLIM_INFINITY;
++ if (setrlimit(RLIMIT_RSS, &rl) != 0)
++ perror("setrlimit(RLIMIT_RSS)");
++ rl.rlim_cur = RLIM_INFINITY;
++ rl.rlim_max = RLIM_INFINITY;
++ if (setrlimit(RLIMIT_MEMLOCK, &rl) != 0)
++ perror("setrlimit(RLIMIT_MEMLOCK)");
++
+ LIST_INIT (&vm_change_state_head);
+ #ifndef _WIN32
+ {
diff --git a/sysutils/xentools30-hvm/patches/patch-as b/sysutils/xentools30-hvm/patches/patch-as
new file mode 100644
index 00000000000..a01d665dc23
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-as
@@ -0,0 +1,26 @@
+$NetBSD: patch-as,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/bswap.h.orig 2006-04-13 19:48:38.000000000 +0200
++++ ioemu/bswap.h
+@@ -5,6 +5,12 @@
+
+ #include <inttypes.h>
+
++#ifdef HAVE_MACHINE_BSWAP_H
++#include <sys/endian.h>
++#include <sys/types.h>
++#include <machine/bswap.h>
++#else
++
+ #ifdef HAVE_BYTESWAP_H
+ #include <byteswap.h>
+ #else
+@@ -58,6 +64,8 @@ static inline uint64_t bswap64(uint64_t
+ return bswap_64(x);
+ }
+
++#endif /* ! HAVE_MACHINE_BSWAP_H */
++
+ static inline void bswap16s(uint16_t *s)
+ {
+ *s = bswap16(*s);
diff --git a/sysutils/xentools30-hvm/patches/patch-at b/sysutils/xentools30-hvm/patches/patch-at
new file mode 100644
index 00000000000..c9de9e20fbb
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-at
@@ -0,0 +1,13 @@
+$NetBSD: patch-at,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/audio/ossaudio.c.orig 2006-10-04 04:28:03.000000000 +0200
++++ ioemu/audio/ossaudio.c 2006-10-18 17:43:53.000000000 +0200
+@@ -231,7 +231,7 @@
+ goto err;
+ }
+
+- if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {
++ if (ioctl (fd, SNDCTL_DSP_NONBLOCK, NULL)) {
+ oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n");
+ goto err;
+ }
diff --git a/sysutils/xentools30-hvm/patches/patch-au b/sysutils/xentools30-hvm/patches/patch-au
new file mode 100644
index 00000000000..235349eb16c
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-au
@@ -0,0 +1,16 @@
+$NetBSD: patch-au,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- libxc/xc_private.h.orig 2006-10-16 22:15:35.000000000 +0200
++++ libxc/xc_private.h 2006-10-16 22:16:09.000000000 +0200
+@@ -15,7 +15,11 @@
+
+ #include "xenctrl.h"
+
++#ifdef __NetBSD__
++#include <xen/NetBSD/xenio.h>
++#else
+ #include <xen/sys/privcmd.h>
++#endif
+
+ /* valgrind cannot see when a hypercall has filled in some values. For this
+ reason, we must zero the privcmd_hypercall_t or domctl/sysctl instance
diff --git a/sysutils/xentools30-hvm/patches/patch-av b/sysutils/xentools30-hvm/patches/patch-av
new file mode 100644
index 00000000000..e71fe17c80c
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-av
@@ -0,0 +1,12 @@
+$NetBSD: patch-av,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- libxc/xg_private.h.orig 2006-10-16 22:15:35.000000000 +0200
++++ libxc/xg_private.h 2006-10-16 22:16:19.000000000 +0200
+@@ -15,7 +15,6 @@
+ #include "xenguest.h"
+ #include "xc_private.h"
+
+-#include <xen/sys/privcmd.h>
+ #include <xen/memory.h>
+ #include <xen/elfnote.h>
+
diff --git a/sysutils/xentools30-hvm/patches/patch-aw b/sysutils/xentools30-hvm/patches/patch-aw
new file mode 100644
index 00000000000..eafc3003761
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-aw
@@ -0,0 +1,32 @@
+$NetBSD: patch-aw,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/audio/mixeng.c.orig 2006-10-04 04:28:03.000000000 +0200
++++ ioemu/audio/mixeng.c 2006-10-18 17:45:57.000000000 +0200
+@@ -102,6 +102,7 @@
+ #undef SHIFT
+
+ t_sample *mixeng_conv[2][2][2][2] = {
++#if !defined(__NetBSD__)
+ {
+ {
+ {
+@@ -146,9 +147,11 @@
+ }
+ }
+ }
++#endif /* !__NetBSD__ */
+ };
+
+ f_sample *mixeng_clip[2][2][2][2] = {
++#if !defined(__NetBSD__)
+ {
+ {
+ {
+@@ -193,6 +196,7 @@
+ }
+ }
+ }
++#endif /* !__NetBSD__ */
+ };
+
+ /*
diff --git a/sysutils/xentools30-hvm/patches/patch-ax b/sysutils/xentools30-hvm/patches/patch-ax
new file mode 100644
index 00000000000..28d05e7af88
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-ax
@@ -0,0 +1,14 @@
+$NetBSD: patch-ax,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/vnc.c.orig 2006-10-19 22:23:35.000000000 +0200
++++ ioemu/vnc.c 2006-10-19 22:26:50.000000000 +0200
+@@ -24,6 +24,9 @@
+ * THE SOFTWARE.
+ */
+
++#include <sys/stat.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
+ #include "vl.h"
+ #include "qemu_socket.h"
+ #include <assert.h>
diff --git a/sysutils/xentools30-hvm/patches/patch-ay b/sysutils/xentools30-hvm/patches/patch-ay
new file mode 100644
index 00000000000..b37ae4c5835
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-ay
@@ -0,0 +1,28 @@
+$NetBSD: patch-ay,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/patches/xen-build.orig 2006-10-04 04:28:11.000000000 +0200
++++ ioemu/patches/xen-build 2006-10-18 17:57:53.000000000 +0200
+@@ -139,7 +139,7 @@
+ ifeq ($(ARCH),alpha)
+ # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
+ # the address space (31 bit so sign extending doesn't matter)
+-@@ -528,10 +541,16 @@
++@@ -528,10 +541,14 @@
+ clean:
+ rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
+
+@@ -147,12 +147,10 @@
+ + rm -rf config.mak config.h
+ +
+ install: all
+-+ mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
+++ $(BSD_INSTALL_PROGRAM_DIR) $(INSTALL_DIR)
+ ifneq ($(PROGS),)
+- $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
++ $(BSD_INSTALL_PROGRAM) $(PROGS) $(INSTALL_DIR)
+ endif
+-+ install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
+-+ install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
+
+ ifneq ($(wildcard .depend),)
+ include .depend
diff --git a/sysutils/xentools30-hvm/patches/patch-ba b/sysutils/xentools30-hvm/patches/patch-ba
new file mode 100644
index 00000000000..d6dfced3aee
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-ba
@@ -0,0 +1,15 @@
+$NetBSD: patch-ba,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/target-i386-dm/exec-dm.c.orig 2006-10-18 18:19:27.000000000 +0200
++++ ioemu/target-i386-dm/exec-dm.c 2006-10-18 18:19:40.000000000 +0200
+@@ -163,8 +163,8 @@
+ #else
+ setvbuf(logfile, NULL, _IOLBF, 0);
+ #endif
+- stdout = logfile;
+- stderr = logfile;
++ dup2(fileno(logfile), 1);
++ dup2(fileno(logfile), 2);
+ }
+ }
+
diff --git a/sysutils/xentools30-hvm/patches/patch-bb b/sysutils/xentools30-hvm/patches/patch-bb
new file mode 100644
index 00000000000..1972658f419
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-bb
@@ -0,0 +1,19 @@
+$NetBSD: patch-bb,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- ioemu/Makefile.target.orig 2006-10-18 18:30:56.000000000 +0200
++++ ioemu/Makefile.target 2006-10-18 18:32:08.000000000 +0200
+@@ -553,12 +553,8 @@
+ rm -rf config.mak config.h
+
+ install: all
+- mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
+-ifneq ($(PROGS),)
+- $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
+-endif
+- install -m 755 $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
+- install -m 755 $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
++ $(BSD_INSTALL_PROGRAM_DIR) "$(bindir)"
++ $(BSD_INSTALL_PROGRAM) $(PROGS) "$(DESTDIR)$(bindir)"
+
+ ifneq ($(wildcard .depend),)
+ include .depend
diff --git a/sysutils/xentools30-hvm/patches/patch-bv b/sysutils/xentools30-hvm/patches/patch-bv
new file mode 100644
index 00000000000..2706b5c7e41
--- /dev/null
+++ b/sysutils/xentools30-hvm/patches/patch-bv
@@ -0,0 +1,33 @@
+$NetBSD: patch-bv,v 1.1.1.1 2006/10/19 22:58:21 bouyer Exp $
+
+--- libxc/xenctrl.h.orig 2006-10-04 04:28:16.000000000 +0200
++++ libxc/xenctrl.h 2006-10-16 23:54:46.000000000 +0200
+@@ -16,7 +16,12 @@
+
+ #include <stddef.h>
+ #include <stdint.h>
++#ifndef __NetBSD__
+ #include <sys/ptrace.h>
++#endif
++#undef uint8_t
++#undef uint16_t
++#undef uint32_t
+ #include <xen/xen.h>
+ #include <xen/domctl.h>
+ #include <xen/sysctl.h>
+@@ -106,6 +111,7 @@
+
+ #define XC_CORE_MAGIC 0xF00FEBED
+
++#ifndef __NetBSD__
+ long xc_ptrace_core(
+ int xc_handle,
+ enum __ptrace_request request,
+@@ -113,6 +119,7 @@
+ long addr,
+ long data,
+ vcpu_guest_context_t *ctxt);
++#endif
+ void * map_domain_va_core(
+ unsigned long domfd,
+ int cpu,