aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/build/fuchsia.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2019-11-13 16:43:16 -0800
committerMarco Vanotti <mvanotti@users.noreply.github.com>2019-12-09 15:13:49 -0800
commit0c158fbe77264b813a08d2d72ffe3242ce39159c (patch)
tree9b60d1cbb767d7e72b7baabc05b72312517f432d /pkg/build/fuchsia.go
parent06ff1e48eece6065d24cc1f6dfa18ae42562e605 (diff)
pkg/build: include syz-executor in Fuchsia base image
Also, build using source from our own copy of syz-executor instead of what's currently rolled into Fuchsia.
Diffstat (limited to 'pkg/build/fuchsia.go')
-rw-r--r--pkg/build/fuchsia.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/pkg/build/fuchsia.go b/pkg/build/fuchsia.go
index dc8e80b4d..a0d8d13ed 100644
--- a/pkg/build/fuchsia.go
+++ b/pkg/build/fuchsia.go
@@ -4,8 +4,10 @@
package build
import (
+ "errors"
"fmt"
"path/filepath"
+ "runtime"
"time"
"github.com/google/syzkaller/pkg/osutil"
@@ -14,15 +16,35 @@ import (
type fuchsia struct{}
+// syzRoot returns $GOPATH/src/github.com/google/syzkaller.
+func syzRoot() (string, error) {
+ _, selfPath, _, ok := runtime.Caller(0)
+ if !ok {
+ return "", errors.New("runtime.Caller failed")
+ }
+
+ return filepath.Abs(filepath.Join(filepath.Dir(selfPath), "../.."))
+}
+
func (fu fuchsia) build(params *Params) error {
+ syzDir, err := syzRoot()
+ if err != nil {
+ return err
+ }
+
sysTarget := targets.Get("fuchsia", params.TargetArch)
if sysTarget == nil {
return fmt.Errorf("unsupported fuchsia arch %v", params.TargetArch)
}
arch := sysTarget.KernelHeaderArch
product := fmt.Sprintf("%s.%s", "core", arch)
- if _, err := runSandboxed(time.Hour, params.KernelDir, "scripts/fx", "--dir", "out/"+arch,
- "set", product, "--with-base", "//bundles:tools"); err != nil {
+ if _, err := runSandboxed(time.Hour, params.KernelDir,
+ "scripts/fx", "--dir", "out/"+arch,
+ "set", product,
+ "--args", fmt.Sprintf(`syzkaller_dir="%s"`, syzDir),
+ "--with-base", "//bundles:tools",
+ "--with-base", "//src/testing/fuzzing/syzkaller",
+ ); err != nil {
return err
}
if _, err := runSandboxed(time.Hour*2, params.KernelDir, "scripts/fx", "clean-build"); err != nil {