pkg/build: copy image to output dir

For vmm we need a pre-created image.
So if one is provided in the userspace dir,
copy it to output. This should be enough
to get vmm working.

Update #712
This commit is contained in:
Dmitry Vyukov 2018-09-15 13:30:23 +02:00
parent 3805b76483
commit a0be1d1210

View File

@ -30,16 +30,16 @@ func (ctx openbsd) build(targetArch, vmType, kernelDir, outputDir, compiler, use
}
for src, dst := range map[string]string{
"obj/bsd": "kernel",
"obj/bsd.gdb": "obj/bsd.gdb",
filepath.Join(compileDir, "obj/bsd"): "kernel",
filepath.Join(compileDir, "obj/bsd.gdb"): "obj/bsd.gdb",
filepath.Join(userspaceDir, "image"): "image",
filepath.Join(userspaceDir, "key"): "key",
} {
fullSrc := filepath.Join(compileDir, src)
fullDst := filepath.Join(outputDir, dst)
if err := osutil.CopyFile(fullSrc, fullDst); err != nil {
return fmt.Errorf("failed to copy %v -> %v: %v", fullSrc, fullDst, err)
if err := osutil.CopyFile(src, fullDst); err != nil {
return fmt.Errorf("failed to copy %v -> %v: %v", src, fullDst, err)
}
}
return nil
}