1
0

Support make targets

This commit is contained in:
dump_stack() 2023-02-15 16:54:46 +00:00
parent c9618be454
commit b246ecf956
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
2 changed files with 13 additions and 5 deletions

View File

@ -140,6 +140,10 @@ type Artifact struct {
DisableKpti bool DisableKpti bool
} }
Make struct {
Target string
}
StandardModules bool StandardModules bool
Preload []PreloadModule Preload []PreloadModule

14
pew.go
View File

@ -179,13 +179,17 @@ func build(tmp string, ka config.Artifact, ki config.KernelInfo,
kernel = ki.KernelSource kernel = ki.KernelSource
} }
buildCommand := "make KERNEL=" + kernel + " TARGET=" + target
if ka.Make.Target != "" {
buildCommand += " " + ka.Make.Target
}
if ki.ContainerName != "" { if ki.ContainerName != "" {
output, err = dockerRun(dockerTimeout, ki.ContainerName, output, err = dockerRun(dockerTimeout, ki.ContainerName,
tmpSourcePath, "make KERNEL="+kernel+" TARGET="+target+ tmpSourcePath, buildCommand+" && chmod -R 777 /work")
" && chmod -R 777 /work")
} else { } else {
command := "make KERNEL=" + kernel + " TARGET=" + target cmd := exec.Command("bash", "-c", "cd "+tmpSourcePath+" && "+
cmd := exec.Command("bash", "-c", "cd "+tmpSourcePath+" && "+command) buildCommand)
timer := time.AfterFunc(dockerTimeout, func() { timer := time.AfterFunc(dockerTimeout, func() {
cmd.Process.Kill() cmd.Process.Kill()
}) })
@ -195,7 +199,7 @@ func build(tmp string, ka config.Artifact, ki config.KernelInfo,
raw, err = cmd.CombinedOutput() raw, err = cmd.CombinedOutput()
if err != nil { if err != nil {
e := fmt.Sprintf("error `%v` for cmd `%v` with output `%v`", e := fmt.Sprintf("error `%v` for cmd `%v` with output `%v`",
err, command, string(raw)) err, buildCommand, string(raw))
err = errors.New(e) err = errors.New(e)
return return
} }