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
}
Make struct {
Target string
}
StandardModules bool
Preload []PreloadModule

14
pew.go
View File

@ -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
}