aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/build
diff options
context:
space:
mode:
authorFlorent Revest <revest@chromium.org>2024-10-02 15:25:51 +0200
committerAleksandr Nogikh <nogikh@google.com>2024-10-14 19:43:42 +0000
commit2e5c6a5c1c62461b69c6f50a123885b9910fce04 (patch)
treef2f92dc597a90cecf52bf5435a88959632f7fd77 /pkg/build
parent56381a3b0c5178a73a7ad714a54dab5ab47e0ffa (diff)
pkg/build/linux: support building with a custom make binary
Certain environments might need a specific make command or wrap make calls with extra logic. This lets users provide a path to a custom make binary.
Diffstat (limited to 'pkg/build')
-rw-r--r--pkg/build/build.go1
-rw-r--r--pkg/build/linux.go13
2 files changed, 9 insertions, 5 deletions
diff --git a/pkg/build/build.go b/pkg/build/build.go
index ec47822a6..764cc1ed5 100644
--- a/pkg/build/build.go
+++ b/pkg/build/build.go
@@ -31,6 +31,7 @@ type Params struct {
KernelDir string
OutputDir string
Compiler string
+ Make string
Linker string
Ccache string
UserspaceDir string
diff --git a/pkg/build/linux.go b/pkg/build/linux.go
index db629411d..5728005da 100644
--- a/pkg/build/linux.go
+++ b/pkg/build/linux.go
@@ -142,7 +142,7 @@ func (linux) createImage(params Params, kernelPath string) error {
}
func (linux) clean(kernelDir, targetArch string) error {
- return runMakeImpl(targetArch, "", "", "", kernelDir, runtime.NumCPU(), []string{"distclean"})
+ return runMakeImpl(targetArch, "", "", "", "", kernelDir, runtime.NumCPU(), []string{"distclean"})
}
func (linux) writeFile(file string, data []byte) error {
@@ -152,11 +152,14 @@ func (linux) writeFile(file string, data []byte) error {
return osutil.SandboxChown(file)
}
-func runMakeImpl(arch, compiler, linker, ccache, kernelDir string, jobs int, extraArgs []string) error {
+func runMakeImpl(arch, compiler, linker, ccache, makeBin, kernelDir string, jobs int, extraArgs []string) error {
target := targets.Get(targets.Linux, arch)
args := LinuxMakeArgs(target, compiler, linker, ccache, "", jobs)
args = append(args, extraArgs...)
- cmd := osutil.Command("make", args...)
+ if makeBin == "" {
+ makeBin = "make"
+ }
+ cmd := osutil.Command(makeBin, args...)
if err := osutil.Sandbox(cmd, true, true); err != nil {
return err
}
@@ -179,8 +182,8 @@ func runMakeImpl(arch, compiler, linker, ccache, kernelDir string, jobs int, ext
}
func runMake(params Params, extraArgs ...string) error {
- return runMakeImpl(params.TargetArch, params.Compiler, params.Linker, params.Ccache,
- params.KernelDir, params.BuildCPUs, extraArgs)
+ return runMakeImpl(params.TargetArch, params.Compiler, params.Linker,
+ params.Ccache, params.Make, params.KernelDir, params.BuildCPUs, extraArgs)
}
func LinuxMakeArgs(target *targets.Target, compiler, linker, ccache, buildDir string, jobs int) []string {