Skip to content

Commit 9ee25c6

Browse files
committed
pkg/aflow/action/kernel: keep few more files in build outputs
Keep vmlinux for debug info/addr2line. Keep compile_commands.json, we need it for codesearch.
1 parent 4682573 commit 9ee25c6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/aflow/action/kernel/build.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ func buildKernel(ctx *aflow.Context, args buildArgs) (buildResult, error) {
4444
image := filepath.FromSlash(build.LinuxKernelImage(targets.AMD64))
4545
makeArgs := build.LinuxMakeArgs(target, targets.DefaultLLVMCompiler, targets.DefaultLLVMLinker,
4646
"ccache", dir, runtime.NumCPU())
47-
makeArgs = append(makeArgs, path.Base(image), "compile_commands.json")
47+
compileCommnads := "compile_commands.json"
48+
makeArgs = append(makeArgs, path.Base(image), compileCommnads)
4849
if _, err := osutil.RunCmd(time.Hour, args.KernelSrc, "make", makeArgs...); err != nil {
4950
return err
5051
}
5152
// Remove main intermediate build files, we don't need them anymore
5253
// and they take lots of space. Keep generated source files.
5354
keepExt := map[string]bool{"h": true, "c": true, "s": true, "S": true}
54-
keepFiles := map[string]bool{image: true}
55+
keepFiles := map[string]bool{
56+
image: true,
57+
target.KernelObject: true,
58+
compileCommnads: true,
59+
}
5560
return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
5661
if err != nil || d.IsDir() || keepFiles[path] || keepExt[filepath.Ext(d.Name())] {
5762
return err

0 commit comments

Comments
 (0)