mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-21 12:01:00 +00:00

1. Implement clean since we do incremental build we actually need no-op clean. 2. Don't copy netbsd to output dir, we don't need it there (we create full-fledged image). 3. Copy netbsd.gdb to obj/ dir, that's where it is expected. 4. Fix boot disk name for gce (it's sd0 instead of wd0).
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
// Copyright 2018 syzkaller project authors. All rights reserved.
|
|
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
|
|
|
package build
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/google/syzkaller/pkg/osutil"
|
|
)
|
|
|
|
type gvisor struct{}
|
|
|
|
func (gvisor gvisor) build(targetArch, vmType, kernelDir, outputDir, compiler, userspaceDir,
|
|
cmdlineFile, sysctlFile string, config []byte) error {
|
|
outBinary := ""
|
|
args := []string{"build", "--verbose_failures"}
|
|
if strings.Contains(" "+string(config)+" ", " -race ") {
|
|
args = append(args, "--features=race", "//runsc:runsc-race")
|
|
outBinary = "bazel-bin/runsc/linux_amd64_static_race_stripped/runsc-race"
|
|
} else {
|
|
args = append(args, "//runsc:runsc")
|
|
outBinary = "bazel-bin/runsc/linux_amd64_pure_stripped/runsc"
|
|
}
|
|
outBinary = filepath.Join(kernelDir, filepath.FromSlash(outBinary))
|
|
if _, err := osutil.RunCmd(20*time.Minute, kernelDir, compiler, args...); err != nil {
|
|
return err
|
|
}
|
|
if err := osutil.CopyFile(outBinary, filepath.Join(outputDir, "image")); err != nil {
|
|
return err
|
|
}
|
|
osutil.RunCmd(10*time.Minute, kernelDir, compiler, "shutdown")
|
|
return nil
|
|
}
|
|
|
|
func (gvisor) clean(kernelDir, targetArch string) error {
|
|
// Let's assume that bazel always properly handles build without cleaning (until proven otherwise).
|
|
return nil
|
|
}
|