From db7c31ca79638f50cbb920add433b46cd66e9890 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 1 Sep 2019 08:17:03 -0700 Subject: pkg/build: make linux builds more deterministic Kbuild inserts build timestamp into every build. This makes vmlinux change always even if no present. Make the build more deterministic. We plan to use it for detecting no-op changes during bisection. Update #1271 --- pkg/build/linux.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pkg') diff --git a/pkg/build/linux.go b/pkg/build/linux.go index 735118a1a..b9301d3d9 100644 --- a/pkg/build/linux.go +++ b/pkg/build/linux.go @@ -128,6 +128,16 @@ func runMake(kernelDir string, args ...string) error { return err } cmd.Dir = kernelDir + cmd.Env = append([]string{}, os.Environ()...) + // This makes the build [more] deterministic: + // 2 builds from the same sources should result in the same vmlinux binary. + // We plan to use it for detecting no-op changes during bisection. + cmd.Env = append(cmd.Env, + "KBUILD_BUILD_VERSION=0", + "KBUILD_BUILD_TIMESTAMP=now", + "KBUILD_BUILD_USER=syzkaller", + "KBUILD_BUILD_HOST=syzkaller", + ) _, err := osutil.Run(time.Hour, cmd) return err } -- cgit mrf-deployment