diff options
author | bouyer <bouyer@pkgsrc.org> | 2011-05-20 17:09:21 +0000 |
---|---|---|
committer | bouyer <bouyer@pkgsrc.org> | 2011-05-20 17:09:21 +0000 |
commit | 6b999e07812cc8987b27d7b8b0024e6efedd7435 (patch) | |
tree | 5a2524e8f420dd1fb2b9947c487e1531cf7d5938 /sysutils | |
parent | 23766b97d1008f104d831c1ae46240deed84d606 (diff) | |
download | pkgsrc-6b999e07812cc8987b27d7b8b0024e6efedd7435.tar.gz |
Add a patch which fixes 2 problems:
- use the correct way to get the size of a disk device or partition (from
haad@NetBSD.org)
- if given a block device, use the character device instead (the block device
is already in use by the backend driver).
With this I could succeffully boot a HVMPV FreeBSD kernel using a phy:
virtual disk.
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/xentools33/Makefile | 4 | ||||
-rw-r--r-- | sysutils/xentools33/distinfo | 3 | ||||
-rw-r--r-- | sysutils/xentools33/patches/patch-qemu-phy-devices | 91 | ||||
-rw-r--r-- | sysutils/xentools41/Makefile | 4 | ||||
-rw-r--r-- | sysutils/xentools41/distinfo | 3 | ||||
-rw-r--r-- | sysutils/xentools41/patches/patch-qemu-phy-devices | 97 |
6 files changed, 196 insertions, 6 deletions
diff --git a/sysutils/xentools33/Makefile b/sysutils/xentools33/Makefile index 10d7d1946f5..adb8b6d970a 100644 --- a/sysutils/xentools33/Makefile +++ b/sysutils/xentools33/Makefile @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.25 2011/05/12 15:39:05 bouyer Exp $ +# $NetBSD: Makefile,v 1.26 2011/05/20 17:09:21 bouyer Exp $ # VERSION= 3.3.2 DISTNAME= xen-${VERSION} PKGNAME= xentools33-${VERSION} -PKGREVISION= 7 +PKGREVISION= 8 CATEGORIES= sysutils MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/ EXTRACT_SUFX= .tar.gz diff --git a/sysutils/xentools33/distinfo b/sysutils/xentools33/distinfo index 1c31f8a2593..ced2e616a47 100644 --- a/sysutils/xentools33/distinfo +++ b/sysutils/xentools33/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.23 2011/05/12 15:39:05 bouyer Exp $ +$NetBSD: distinfo,v 1.24 2011/05/20 17:09:21 bouyer Exp $ SHA1 (xen-3.3.2.tar.gz) = 7f438e73ac81b25cf5e1570709e87001066bafe4 RMD160 (xen-3.3.2.tar.gz) = 28faa56286f2a418e35dcba6079570ea871d6c7b @@ -54,3 +54,4 @@ SHA1 (patch-fd) = 619b865b2f17814e6e62ebab21de9183474dd075 SHA1 (patch-fe) = 85d42672766fe8ce2dc7f745938722710c6ee5a3 SHA1 (patch-ff) = 6ff97fa4f34f29c276e4aaab4b4db9ccf7b09957 SHA1 (patch-fg) = 913295d341c1dd5bf4d1ef78f27520920f138d4c +SHA1 (patch-qemu-phy-devices) = 29790e45372ae16157e906dc39a667229e8a0ba5 diff --git a/sysutils/xentools33/patches/patch-qemu-phy-devices b/sysutils/xentools33/patches/patch-qemu-phy-devices new file mode 100644 index 00000000000..ffbb50af99c --- /dev/null +++ b/sysutils/xentools33/patches/patch-qemu-phy-devices @@ -0,0 +1,91 @@ +$NetBSD: patch-qemu-phy-devices,v 1.1 2011/05/20 17:09:21 bouyer Exp $ + +This does 2 things: +- use the correct way to get the size of a disk device or partition (from + haad@NetBSD.org) +- if given a block device, use the character device instead. + +--- ioemu/block-raw.c.orig 2009-08-06 14:56:33.000000000 +0200 ++++ ioemu/block-raw.c 2011-05-20 18:55:59.000000000 +0200 +@@ -63,6 +63,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> ++#include <sys/disk.h> ++#include <sys/param.h> ++#endif + + //#define DEBUG_FLOPPY + +@@ -101,6 +108,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 + + s->lseek_err_cnt = 0; + +@@ -533,7 +567,7 @@ + return 0; + } + +-#ifdef __OpenBSD__ ++#if defined(__OpenBSD__) || defined(__NetBSD__) + static int64_t raw_getlength(BlockDriverState *bs) + { + int fd = ((BDRVRawState*)bs->opaque)->fd; +@@ -541,11 +575,24 @@ + if(fstat(fd, &st)) + return -1; + if(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)){ ++#ifdef __OpenBSD__ + struct disklabel dl; + if(ioctl(fd, DIOCGDINFO, &dl)) + return -1; + return (uint64_t)dl.d_secsize * + dl.d_partitions[DISKPART(st.st_rdev)].p_size; ++#else ++ struct dkwedge_info dkw; ++ if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1) { ++ return dkw.dkw_size * 512; ++ } else { ++ struct disklabel dl; ++ if(ioctl(fd, DIOCGDINFO, &dl)) ++ return -1; ++ return (uint64_t)dl.d_secsize * ++ dl.d_partitions[DISKPART(st.st_rdev)].p_size; ++ } ++#endif + }else + return st.st_size; + } diff --git a/sysutils/xentools41/Makefile b/sysutils/xentools41/Makefile index 6572b5832b6..91d9052dde6 100644 --- a/sysutils/xentools41/Makefile +++ b/sysutils/xentools41/Makefile @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.7 2011/05/12 15:57:38 bouyer Exp $ +# $NetBSD: Makefile,v 1.8 2011/05/20 17:09:21 bouyer Exp $ # VERSION= 4.1.0 DISTNAME= xen-${VERSION} PKGNAME= xentools41-${VERSION} -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= sysutils MASTER_SITES= http://bits.xensource.com/oss-xen/release/${VERSION}/ diff --git a/sysutils/xentools41/distinfo b/sysutils/xentools41/distinfo index 22a20445e3a..873c3814679 100644 --- a/sysutils/xentools41/distinfo +++ b/sysutils/xentools41/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.6 2011/05/12 15:57:38 bouyer Exp $ +$NetBSD: distinfo,v 1.7 2011/05/20 17:09:21 bouyer Exp $ SHA1 (ipxe-git-v1.0.0.tar.gz) = da052c8de5f3485fe0253c19cf52ed6d72528485 RMD160 (ipxe-git-v1.0.0.tar.gz) = dcd9b6eaafa1ce05c1ebf2a15f2f73ad7a8c5547 @@ -35,4 +35,5 @@ SHA1 (patch-db) = 4766f9925462023332793bcea4321072758e289d SHA1 (patch-dc) = d860fe3725978227278d58f09e7d5157001e463e SHA1 (patch-dd) = b0c6253a77c09c8625bc9425742b395d1ce67010 SHA1 (patch-de) = b118ff85070cac7cd81375d2f59ad10b719ae263 +SHA1 (patch-qemu-phy-devices) = fef90e50ef0a58db2f2b49b6c23218f371791de5 SHA1 (patch-xm-test_ramdisk_make-release.sh) = 0844f1e022182d91dc04df552828820f4c946b5f diff --git a/sysutils/xentools41/patches/patch-qemu-phy-devices b/sysutils/xentools41/patches/patch-qemu-phy-devices new file mode 100644 index 00000000000..fd1ec60fc65 --- /dev/null +++ b/sysutils/xentools41/patches/patch-qemu-phy-devices @@ -0,0 +1,97 @@ +$NetBSD: patch-qemu-phy-devices,v 1.1 2011/05/20 17:09:21 bouyer Exp $ + +This does 2 things: +- use the correct way to get the size of a disk device or partition (from + haad@NetBSD.org) +- if given a block device, use the character device instead. + +--- ioemu-qemu-xen/block-raw-posix.c.orig 2011-05-20 16:47:37.000000000 +0200 ++++ ioemu-qemu-xen/block-raw-posix.c 2011-05-20 18:06:44.000000000 +0200 +@@ -66,6 +66,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 + +@@ -120,6 +127,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(); + +@@ -749,7 +783,7 @@ + return 0; + } + +-#ifdef __OpenBSD__ ++#if defined(__OpenBSD__) || defined(__NetBSD__) + static int64_t raw_getlength(BlockDriverState *bs) + { + BDRVRawState *s = bs->opaque; +@@ -759,16 +793,29 @@ + if (fstat(fd, &st)) + return -1; + if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { ++#if defined(__OpenBSD__) + struct disklabel dl; + + if (ioctl(fd, DIOCGDINFO, &dl)) + return -1; + return (uint64_t)dl.d_secsize * + dl.d_partitions[DISKPART(st.st_rdev)].p_size; ++#else ++ struct dkwedge_info dkw; ++ if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1) { ++ return dkw.dkw_size * 512; ++ } else { ++ struct disklabel dl; ++ if(ioctl(fd, DIOCGDINFO, &dl)) ++ return -1; ++ return (uint64_t)dl.d_secsize * ++ dl.d_partitions[DISKPART(st.st_rdev)].p_size; ++ } ++#endif + } else + return st.st_size; + } +-#else /* !__OpenBSD__ */ ++#else /* !__OpenBSD__ && ! __NetBSD__ */ + static int64_t raw_getlength(BlockDriverState *bs) + { + BDRVRawState *s = bs->opaque; |