From b246ecf956b34bd7f349891cead7c5db1708c9e2 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Wed, 15 Feb 2023 16:54:46 +0000 Subject: [PATCH] Support make targets --- config/config.go | 4 ++++ pew.go | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 0ab31f0..09d076a 100644 --- a/config/config.go +++ b/config/config.go @@ -140,6 +140,10 @@ type Artifact struct { DisableKpti bool } + Make struct { + Target string + } + StandardModules bool Preload []PreloadModule diff --git a/pew.go b/pew.go index a4a994f..1d0032a 100644 --- a/pew.go +++ b/pew.go @@ -179,13 +179,17 @@ func build(tmp string, ka config.Artifact, ki config.KernelInfo, kernel = ki.KernelSource } + buildCommand := "make KERNEL=" + kernel + " TARGET=" + target + if ka.Make.Target != "" { + buildCommand += " " + ka.Make.Target + } + if ki.ContainerName != "" { output, err = dockerRun(dockerTimeout, ki.ContainerName, - tmpSourcePath, "make KERNEL="+kernel+" TARGET="+target+ - " && chmod -R 777 /work") + tmpSourcePath, buildCommand+" && chmod -R 777 /work") } else { - command := "make KERNEL=" + kernel + " TARGET=" + target - cmd := exec.Command("bash", "-c", "cd "+tmpSourcePath+" && "+command) + cmd := exec.Command("bash", "-c", "cd "+tmpSourcePath+" && "+ + buildCommand) timer := time.AfterFunc(dockerTimeout, func() { cmd.Process.Kill() }) @@ -195,7 +199,7 @@ func build(tmp string, ka config.Artifact, ki config.KernelInfo, raw, err = cmd.CombinedOutput() if err != nil { e := fmt.Sprintf("error `%v` for cmd `%v` with output `%v`", - err, command, string(raw)) + err, buildCommand, string(raw)) err = errors.New(e) return }