aboutsummaryrefslogtreecommitdiffstats
path: root/sys/syz-extract/linux.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-09 16:08:22 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-09 16:08:22 +0200
commit8742a2b9dba1ce2869b29fff6c5359cc9116c719 (patch)
treede4103a046a664d13b9ced3c84ea7426d3f4ce6c /sys/syz-extract/linux.go
parent88cb3e92ba25303ab67aaceb083fe7304fccd32f (diff)
sys/syz-extract: run mrproper for all linux arches
We only run for the current arch, but it's not enough to clean a build for another arch. Run mrproper for all non-clean arches.
Diffstat (limited to 'sys/syz-extract/linux.go')
-rw-r--r--sys/syz-extract/linux.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/syz-extract/linux.go b/sys/syz-extract/linux.go
index 4105b8dc3..f40b634ea 100644
--- a/sys/syz-extract/linux.go
+++ b/sys/syz-extract/linux.go
@@ -16,7 +16,7 @@ import (
type linux struct{}
-func (*linux) prepare(sourcedir string, build bool, arches []string) error {
+func (*linux) prepare(sourcedir string, build bool, arches []*Arch) error {
if sourcedir == "" {
return fmt.Errorf("provide path to kernel checkout via -sourcedir flag (or make extract SOURCEDIR)")
}
@@ -24,14 +24,19 @@ func (*linux) prepare(sourcedir string, build bool, arches []string) error {
// Run 'make mrproper', otherwise out-of-tree build fails.
// However, it takes unreasonable amount of time,
// so first check few files and if they are missing hope for best.
- if osutil.IsExist(filepath.Join(sourcedir, ".config")) ||
- osutil.IsExist(filepath.Join(sourcedir, "init/main.o")) ||
- osutil.IsExist(filepath.Join(sourcedir, "include/generated/compile.h")) {
- fmt.Printf("make mrproper\n")
- out, err := osutil.RunCmd(time.Hour, sourcedir, "make", "mrproper",
- "-j", fmt.Sprint(runtime.NumCPU()))
- if err != nil {
- return fmt.Errorf("make mrproper failed: %v\n%s", err, out)
+ for _, a := range arches {
+ arch := a.target.KernelArch
+ if osutil.IsExist(filepath.Join(sourcedir, ".config")) ||
+ osutil.IsExist(filepath.Join(sourcedir, "init/main.o")) ||
+ osutil.IsExist(filepath.Join(sourcedir, "include/config")) ||
+ osutil.IsExist(filepath.Join(sourcedir, "include/generated/compile.h")) ||
+ osutil.IsExist(filepath.Join(sourcedir, "arch", arch, "include", "generated")) {
+ fmt.Printf("make mrproper ARCH=%v\n", arch)
+ out, err := osutil.RunCmd(time.Hour, sourcedir, "make", "mrproper", "ARCH="+arch,
+ "-j", fmt.Sprint(runtime.NumCPU()))
+ if err != nil {
+ return fmt.Errorf("make mrproper failed: %v\n%s", err, out)
+ }
}
}
} else {