aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/build/linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/build/linux.go')
-rw-r--r--pkg/build/linux.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/pkg/build/linux.go b/pkg/build/linux.go
index 85575e621..3947463de 100644
--- a/pkg/build/linux.go
+++ b/pkg/build/linux.go
@@ -26,12 +26,17 @@ import (
type linux struct{}
func (linux linux) build(params Params) (ImageDetails, error) {
- if err := linux.buildKernel(params); err != nil {
- return ImageDetails{}, err
+ details := ImageDetails{}
+ err := linux.buildKernel(params)
+ // Even if the build fails, autogenerated files would still be present (unless the build is really broken).
+ if err != nil {
+ details.CompilerID, _ = queryLinuxCompiler(params.KernelDir)
+ return details, err
}
- compilerID, err := queryLinuxCompiler(params.KernelDir)
+
+ details.CompilerID, err = queryLinuxCompiler(params.KernelDir)
if err != nil {
- return ImageDetails{}, err
+ return details, err
}
kernelPath := filepath.Join(params.KernelDir, filepath.FromSlash(kernelBin(params.TargetArch)))
@@ -39,28 +44,22 @@ func (linux linux) build(params Params) (ImageDetails, error) {
// The old way of assembling the image from userspace dir.
// It should be removed once all syzbot instances are switched.
if err := linux.createImage(params, kernelPath); err != nil {
- return ImageDetails{}, err
+ return details, err
}
} else if params.VMType == "qemu" {
// If UserspaceDir is a file (image) and we use qemu, we just copy image and kernel to the output dir
// assuming that qemu will use injected kernel boot. In this mode we also assume password/key-less ssh.
if err := osutil.CopyFile(kernelPath, filepath.Join(params.OutputDir, "kernel")); err != nil {
- return ImageDetails{}, err
+ return details, err
}
if err := osutil.CopyFile(params.UserspaceDir, filepath.Join(params.OutputDir, "image")); err != nil {
- return ImageDetails{}, err
+ return details, err
}
} else if err := embedLinuxKernel(params, kernelPath); err != nil {
- return ImageDetails{}, err
- }
- signature, err := elfBinarySignature(filepath.Join(params.OutputDir, "obj", "vmlinux"))
- if err != nil {
- return ImageDetails{}, err
+ return details, err
}
- return ImageDetails{
- Signature: signature,
- CompilerID: compilerID,
- }, nil
+ details.Signature, err = elfBinarySignature(filepath.Join(params.OutputDir, "obj", "vmlinux"))
+ return details, err
}
func (linux linux) buildKernel(params Params) error {