diff options
| author | Greg Steuck <blackgnezdo@gmail.com> | 2019-03-05 09:08:17 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-05 09:08:17 -0800 |
| commit | 16559f86f52b7da53f9156685e32dde788dbe371 (patch) | |
| tree | d9742b9ebc666616623fae22d88a3955888dfeb7 /pkg | |
| parent | 78b7ec0fbe23a5c674401123053d6372ea3ca9c6 (diff) | |
ci-openbsd-multicore: enable PF (#1033)
* pkg/build/openbsd: copy overlay files from userspaceDir into image
Fixes #1030
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/build/openbsd.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/pkg/build/openbsd.go b/pkg/build/openbsd.go index 81f082b8c..0f40608db 100644 --- a/pkg/build/openbsd.go +++ b/pkg/build/openbsd.go @@ -51,7 +51,8 @@ func (ctx openbsd) build(targetArch, vmType, kernelDir, outputDir, compiler, use } } if vmType == "gce" { - return CopyKernelToImage(outputDir) + return CopyFilesToImage( + filepath.Join(userspaceDir, "overlay"), outputDir) } return nil } @@ -70,13 +71,17 @@ func (ctx openbsd) make(kernelDir string, args ...string) error { return err } -// The easiest way to make an openbsd image that boots the given -// kernel on GCE is to simply overwrite it inside the disk image. +// CopyFilesToImage populates the filesystem image in outputDir with +// run-specific files. The kernel is copied as /bsd and if overlayDir +// exists, its contents are copied into corresponding files in the +// image. +// // Ideally a user space tool capable of understanding FFS should -// implement this directly, but vnd(4) device would do in a pinch. -// Assumes that the outputDir contains the appropriately named files. -func CopyKernelToImage(outputDir string) error { - script := `set -eux +// interpret FFS inside the image file, but vnd(4) device would do in +// a pinch. +func CopyFilesToImage(overlayDir, outputDir string) error { + script := fmt.Sprintf(`set -eux +OVERLAY="%s" # Cleanup in case something failed before. doas umount /altroot || true doas vnconfig -u vnd0 || true @@ -84,9 +89,10 @@ doas vnconfig -u vnd0 || true doas /sbin/vnconfig vnd0 image doas mount /dev/vnd0a /altroot doas cp kernel /altroot/bsd +test -d "$OVERLAY" && doas cp -Rf "$OVERLAY"/. /altroot doas umount /altroot doas vnconfig -u vnd0 -` +`, overlayDir) debugOut, err := osutil.RunCmd(10*time.Minute, outputDir, "/bin/sh", "-c", script) if err != nil { log.Logf(0, "Error copying kernel into image %v\n%v\n", outputDir, debugOut) |
