Skip to content

Commit 3dc0de9

Browse files
committed
pkg/aflow/action/kernel/build: log build errors
Currently, when the kernel build fails, syz-aflow prints something along the line of: failed to run ["make" "KERNELVERSION=syzkaller" "KERNELRELEASE=syzkaller" "LOCALVERSION=-syzkaller" "-j" "36" "ARCH=x86_64" "CC=ccache clang" "LD=ld.lld" "O=workdir/cache/build/1c6c481ef478edbb8bf3afb9d73e9ff157b1a204" "bzImage" "compile_commands.json"]: exit status 2 Which is not particularly helpful, especially because the build directory gets immediately wiped out and the source directory does not contain the extracted .config which makes reproduction especially annoying. The -s flag makes make "silent", meaning that it only prints errors and not all successfully built compilation units, which keeps the logs more concise.
1 parent 31d0cb6 commit 3dc0de9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/aflow/action/kernel/build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ func buildKernel(ctx *aflow.Context, args buildArgs) (buildResult, error) {
4545
makeArgs := build.LinuxMakeArgs(target, targets.DefaultLLVMCompiler, targets.DefaultLLVMLinker,
4646
"ccache", dir, runtime.NumCPU())
4747
compileCommnads := "compile_commands.json"
48-
makeArgs = append(makeArgs, path.Base(image), compileCommnads)
49-
if _, err := osutil.RunCmd(time.Hour, args.KernelSrc, "make", makeArgs...); err != nil {
50-
return aflow.FlowError(err)
48+
makeArgs = append(makeArgs, "-s", path.Base(image), compileCommnads)
49+
if out, err := osutil.RunCmd(time.Hour, args.KernelSrc, "make", makeArgs...); err != nil {
50+
return aflow.FlowError(fmt.Errorf("make failed: %w\n%s", err, out))
5151
}
5252
// Remove main intermediate build files, we don't need them anymore
5353
// and they take lots of space. Keep generated source files.

0 commit comments

Comments
 (0)