mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-23 13:10:44 +00:00
pkg/build: save kernel config early
Currently we don't capture kernel config for broken builds because the config is saved as the last step. Save it as early as possible.
This commit is contained in:
parent
9b6bfa3fe8
commit
375a3e31e1
@ -33,6 +33,12 @@ func Image(targetOS, targetArch, vmType, kernelDir, outputDir, compiler, userspa
|
||||
if err := osutil.MkdirAll(filepath.Join(outputDir, "obj")); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(config) != 0 {
|
||||
// Write kernel config early, so that it's captured on build failures.
|
||||
if err := osutil.WriteFile(filepath.Join(outputDir, "kernel.config"), config); err != nil {
|
||||
return fmt.Errorf("failed to write config file: %v", err)
|
||||
}
|
||||
}
|
||||
return builder.build(targetArch, vmType, kernelDir, outputDir, compiler, userspaceDir, cmdlineFile, sysctlFile, config)
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,11 @@ func (linux) buildKernel(kernelDir, outputDir, compiler string, config []byte) e
|
||||
if _, err := osutil.Run(10*time.Minute, cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
// Write updated kernel config early, so that it's captured on build failures.
|
||||
outputConfig := filepath.Join(outputDir, "kernel.config")
|
||||
if err := osutil.CopyFile(configFile, outputConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
// We build only bzImage as we currently don't use modules.
|
||||
cpu := strconv.Itoa(runtime.NumCPU())
|
||||
cmd = osutil.Command("make", "bzImage", "-j", cpu, "CC="+compiler)
|
||||
@ -64,10 +69,6 @@ func (linux) buildKernel(kernelDir, outputDir, compiler string, config []byte) e
|
||||
if _, err := osutil.Run(time.Hour, cmd); err != nil {
|
||||
return extractRootCause(err)
|
||||
}
|
||||
outputConfig := filepath.Join(outputDir, "kernel.config")
|
||||
if err := osutil.CopyFile(configFile, outputConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
vmlinux := filepath.Join(kernelDir, "vmlinux")
|
||||
outputVmlinux := filepath.Join(outputDir, "obj", "vmlinux")
|
||||
if err := os.Rename(vmlinux, outputVmlinux); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user