diff --git a/Makefile b/Makefile index d5b30d4..06299ef 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,7 @@ OCAML_LDLIBS := -L $(OCAML_WHERE) \ -lasmrun -lbigarray -lunix CGO_CFLAGS += -DHAVE_OCAML=1 -DHAVE_OCAML_QCOW=1 -DHAVE_OCAML=1 -I$(OCAML_WHERE) CGO_LDFLAGS += $(OCAML_LDLIBS) -bin/docker-machine-driver-xhyve: vendor/github.com/zchee/libhyperkit/mirage_block_ocaml.syso +bin/docker-machine-driver-xhyve: vendor/github.com/zchee/libhyperkit/mirage_block_ocaml.o endif endif @@ -174,7 +174,7 @@ default: build build: bin/docker-machine-driver-xhyve -vendor/github.com/zchee/libhyperkit/mirage_block_ocaml.syso: +vendor/github.com/zchee/libhyperkit/mirage_block_ocaml.o: $(VERBOSE) $(GO_CMD) generate $(GO_BUILD_FLAG) $(GO_VERBOSE) ./vendor/github.com/zchee/libhyperkit bin/docker-machine-driver-xhyve: diff --git a/xhyve/xhyve.go b/xhyve/xhyve.go index 5e4e42a..f4291f9 100644 --- a/xhyve/xhyve.go +++ b/xhyve/xhyve.go @@ -54,20 +54,25 @@ const ( type Driver struct { *drivers.BaseDriver *b2d.B2dUtils + Boot2DockerURL string - BootCmd string - CPU int CaCertPath string + PrivateKeyPath string + + CPU int + Memory int DiskSize int64 + DiskNumber int MacAddr string - Memory int - PrivateKeyPath string UUID string - NFSShare bool - DiskNumber int + Qcow2 bool Virtio9p bool Virtio9pFolder string - Qcow2 bool + NFSShare bool + + BootCmd string + Initrd string + Vmlinuz string } var ( @@ -209,6 +214,10 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { d.Virtio9p = flags.Bool("xhyve-virtio-9p") d.Virtio9pFolder = "/Users" + // assume the boot2docker.iso + d.Vmlinuz = "vmlinuz64" + d.Initrd = "initrd.img" + return nil } @@ -367,7 +376,7 @@ func (d *Driver) Create() error { return err } - log.Infof("Extracting vmlinuz64 and initrd.img from %s...", isoFilename) + log.Infof("Extracting kernel and initrd from %s...", isoFilename) if err := d.extractKernelImages(); err != nil { return err } @@ -588,21 +597,21 @@ func (d *Driver) publicSSHKeyPath() string { func (d *Driver) extractKernelImages() error { log.Debugf("Mounting %s", isoFilename) - err := hdiutil("attach", d.ResolveStorePath(isoFilename), "-mountpoint", d.ResolveStorePath("b2d-image")) + err := hdiutil("attach", d.ResolveStorePath(isoFilename), "-mountpoint", d.ResolveStorePath(isoMountPath)) if err != nil { return err } volumeRootDir := d.ResolveStorePath(isoMountPath) - vmlinuz64 := volumeRootDir + "/boot/vmlinuz64" - initrd := volumeRootDir + "/boot/initrd.img" + vmlinuz := filepath.Join(volumeRootDir, "boot", d.Vmlinuz) + initrd := filepath.Join(volumeRootDir, "boot", d.Initrd) - log.Debugf("Extracting vmlinuz64 into %s", d.ResolveStorePath(".")) - if err := mcnutils.CopyFile(vmlinuz64, d.ResolveStorePath("vmlinuz64")); err != nil { + log.Debugf("Extracting kernel into %s", d.ResolveStorePath(".")) + if err := mcnutils.CopyFile(vmlinuz, d.ResolveStorePath(d.Vmlinuz)); err != nil { return err } - log.Debugf("Extracting initrd.img into %s", d.ResolveStorePath(".")) - if err := mcnutils.CopyFile(initrd, d.ResolveStorePath("initrd.img")); err != nil { + log.Debugf("Extracting initrd into %s", d.ResolveStorePath(".")) + if err := mcnutils.CopyFile(initrd, d.ResolveStorePath(d.Initrd)); err != nil { return err } log.Debugf("Unmounting %s", isoFilename) @@ -905,8 +914,8 @@ func (d *Driver) xhyveArgs() []string { diskImage = fmt.Sprintf("4:0,ahci-hd,%s", imgPath) } - vmlinuz := d.ResolveStorePath("vmlinuz64") - initrd := d.ResolveStorePath("initrd.img") + vmlinuz := d.ResolveStorePath(d.Vmlinuz) + initrd := d.ResolveStorePath(d.Initrd) return []string{ "xhyve",