From 7fa29a58950476516166f4cd66d66036fb182be2 Mon Sep 17 00:00:00 2001 From: Siddharth M Date: Fri, 22 Feb 2019 17:48:44 +0530 Subject: pkg/build: added feature to copy kernel image for netbsd * Modified pkg/build/netbsd.go 1. Made kernel build incremental 2. Added code to copy kernel to disk image * Fix formating issues * Fixed basic issues * Fixed copy kernel to disk 1. Added CPU option to default 2. Added snapshot option to vm/qemu/qemu.go 3. Hacky solution to get the build working * Fixed issues and added vm.MonitorExecution * Added sync instead of poweroff --- vm/qemu/qemu.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vm') diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index 2e36edc07..65dce6764 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -37,6 +37,7 @@ type Config struct { ImageDevice string `json:"image_device"` // qemu image device (hda by default) CPU int `json:"cpu"` // number of VM CPUs Mem int `json:"mem"` // amount of VM memory in MBs + Snapshot bool `json:"snapshot"` // For building kernels without -snapshot (for pkg/build) } type Pool struct { @@ -181,9 +182,11 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { archConfig := archConfigs[env.OS+"/"+env.Arch] cfg := &Config{ Count: 1, + CPU: 1, ImageDevice: "hda", Qemu: archConfig.Qemu, QemuArgs: archConfig.QemuArgs, + Snapshot: true, } if err := config.LoadData(env.Config, cfg); err != nil { return nil, fmt.Errorf("failed to parse qemu vm config: %v", err) @@ -336,8 +339,10 @@ func (inst *instance) Boot() error { } else if inst.image != "" { args = append(args, "-"+inst.cfg.ImageDevice, inst.image, - "-snapshot", ) + if inst.cfg.Snapshot { + args = append(args, "-snapshot") + } } if inst.cfg.Initrd != "" { args = append(args, -- cgit mrf-deployment