diff --git a/hyperkit.1 b/hyperkit.1 index 897b1ea9..b7cd934d 100644 --- a/hyperkit.1 +++ b/hyperkit.1 @@ -331,9 +331,9 @@ hyperkit -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\ -A -H -P -m 24G -f fbsd,userboot.so,bootvolume.img,"" \\ .Ed .Pp -Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI -CD-ROM, a single virtio network port, an AMD hostbridge, and the console -port connected to an +Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, a raw AHCI SATA volume, +an AHCI ATAPI CD-ROM, a single virtio network port, an AMD hostbridge, +and the console port connected to an .Xr nmdm 4 null-modem device. .Bd -literal -offset indent @@ -347,6 +347,7 @@ hyperkit -c 4 \\ -s 1:5,ahci-hd,/images/disk.6 \\ -s 1:6,ahci-hd,/images/disk.7 \\ -s 1:7,ahci-hd,/images/disk.8 \\ + -s 1:8,ahci-hd,/dev/rdisk2 \\ -s 2,ahci-cd,/images/install.iso \\ -s 3,virtio-net,tap0 \\ -l com1,/dev/nmdm0A \\ diff --git a/src/lib/block_if.c b/src/lib/block_if.c index ec385025..c51d551b 100644 --- a/src/lib/block_if.c +++ b/src/lib/block_if.c @@ -535,7 +535,7 @@ blockif_open(const char *optstr, const char *ident) struct blockif_ctxt *bc; struct stat sbuf; // struct diocgattr_arg arg; - off_t size, psectsz, psectoff; + off_t size, psectsz, psectoff, blocks; int extra, fd, i, sectsz; int nocache, sync, ro, candelete, geom, ssopt, pssopt; mirage_block_handle mbh; @@ -653,8 +653,17 @@ blockif_open(const char *optstr, const char *ident) if (ioctl(fd, DIOCGPROVIDERNAME, name) == 0) geom = 1; #else - perror("xhyve: raw device support unimplemented"); - goto err; + blocks = 0; + if (ioctl(fd, DKIOCGETBLOCKCOUNT, &blocks) < 0 || + ioctl(fd, DKIOCGETBLOCKSIZE, §sz)) { + perror("Could not fetch dev blk/sector size"); + goto err; + } + + assert(blocks != 0); + assert(sectsz != 0); + + size = blocks * sectsz; #endif } else psectsz = sbuf.st_blksize; @@ -667,7 +676,6 @@ blockif_open(const char *optstr, const char *ident) goto err; } -#ifdef __FreeBSD__ /* * Some backend drivers (e.g. cd0, ada0) require that the I/O * size be a multiple of the device's sector size. @@ -683,7 +691,6 @@ blockif_open(const char *optstr, const char *ident) goto err; } } -#endif sectsz = ssopt; psectsz = pssopt;