diff options
| author | Kris Alder <kalder@google.com> | 2023-02-22 10:20:49 -0800 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2023-03-08 08:03:06 +0100 |
| commit | f6ef8c9d1dbba2449eec47d79ae047c30476dff2 (patch) | |
| tree | e07a7e97494322adb0bdfdff8dfc27ee96a022b6 /vm/vm.go | |
| parent | d2b001709254b71636892f5b9d0ed14a4ca04f61 (diff) | |
pkg/build: add build code for Android devices
Booting physical Android devices requires building a few artifacts, as described
at https://source.android.com/docs/setup/build/building-kernels.
When a ProxyVM type is used, we need to differentiate whether or not to
use the Android build logic, so we add an additional mapping which uses
a different name but the same VM logic.
Diffstat (limited to 'vm/vm.go')
| -rw-r--r-- | vm/vm.go | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -14,6 +14,7 @@ import ( "io" "os" "path/filepath" + "strings" "sync/atomic" "time" @@ -65,6 +66,14 @@ type BootErrorer interface { BootError() (string, []byte) } +// vmType splits the VM type from any suffix (separated by ":"). This is mostly +// useful for the "proxyapp" type, where pkg/build needs to specify/handle +// sub-types. +func vmType(fullName string) string { + name, _, _ := strings.Cut(fullName, ":") + return name +} + // AllowsOvercommit returns if the instance type allows overcommit of instances // (i.e. creation of instances out-of-thin-air). Overcommit is used during image // and patch testing in syz-ci when it just asks for more than specified in config @@ -74,12 +83,12 @@ type BootErrorer interface { // override resource limits specified in config (e.g. can OOM). But it works and // makes lots of things much simpler. func AllowsOvercommit(typ string) bool { - return vmimpl.Types[typ].Overcommit + return vmimpl.Types[vmType(typ)].Overcommit } // Create creates a VM pool that can be used to create individual VMs. func Create(cfg *mgrconfig.Config, debug bool) (*Pool, error) { - typ, ok := vmimpl.Types[cfg.Type] + typ, ok := vmimpl.Types[vmType(cfg.Type)] if !ok { return nil, fmt.Errorf("unknown instance type '%v'", cfg.Type) } |
