aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/build
diff options
context:
space:
mode:
authorJouni Hogander <jouni.hogander@unikie.com>2020-09-01 16:13:50 +0300
committerDmitry Vyukov <dvyukov@google.com>2020-09-21 11:23:04 +0200
commitbbb921d248befbb1bf3970cc8d680403f255de97 (patch)
treec3ef61c8727b2548f1fb4e80da9e3b9fe7a58b82 /pkg/build
parent5e8f0f25faceb9346ebfb1a31d49fb4cb0b76507 (diff)
pkg/bisect: add ccache option
Add option to use ccache in kernel builds. Signed-off-by: Jouni Hogander <jouni.hoegander@partner.bmw.de>
Diffstat (limited to 'pkg/build')
-rw-r--r--pkg/build/build.go1
-rw-r--r--pkg/build/linux.go19
2 files changed, 19 insertions, 1 deletions
diff --git a/pkg/build/build.go b/pkg/build/build.go
index af2aa91a5..348a18555 100644
--- a/pkg/build/build.go
+++ b/pkg/build/build.go
@@ -26,6 +26,7 @@ type Params struct {
KernelDir string
OutputDir string
Compiler string
+ Ccache string
UserspaceDir string
CmdlineFile string
SysctlFile string
diff --git a/pkg/build/linux.go b/pkg/build/linux.go
index 34a980b20..6acf6f347 100644
--- a/pkg/build/linux.go
+++ b/pkg/build/linux.go
@@ -65,7 +65,24 @@ func (linux) buildKernel(params *Params) error {
case "ppc64le":
target = "zImage"
}
- if err := runMake(params.KernelDir, target, "CC="+params.Compiler); err != nil {
+
+ ccParam := params.Compiler
+ if params.Ccache != "" {
+ ccParam = params.Ccache + " " + ccParam
+ // Ensure CONFIG_GCC_PLUGIN_RANDSTRUCT doesn't prevent ccache usage.
+ // See /Documentation/kbuild/reproducible-builds.rst.
+ gccPluginsDir := filepath.Join(params.KernelDir, "scripts", "gcc-plugins")
+ if osutil.IsExist(gccPluginsDir) {
+ err := osutil.WriteFile(filepath.Join(gccPluginsDir,
+ "randomize_layout_seed.h"),
+ []byte("const char *randstruct_seed = "+
+ "\"e9db0ca5181da2eedb76eba144df7aba4b7f9359040ee58409765f2bdc4cb3b8\";"))
+ if err != nil {
+ return err
+ }
+ }
+ }
+ if err := runMake(params.KernelDir, target, "CC="+ccParam); err != nil {
return err
}
vmlinux := filepath.Join(params.KernelDir, "vmlinux")