diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-10-24 04:11:47 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-10-24 16:45:33 -0700 |
| commit | c34508de34e986c7bb3dbc3e070e47b29350d6b0 (patch) | |
| tree | 873c6aaf65e90aa7c9f9f1cdc9569effd9e6a7cf /pkg/build/linux.go | |
| parent | 6134fb9117297871eac5683c6413b1a7b5362fd6 (diff) | |
pkg/build: copy the kernel image to the output folder
This will let it be uploaded to the asset storage.
Diffstat (limited to 'pkg/build/linux.go')
| -rw-r--r-- | pkg/build/linux.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/build/linux.go b/pkg/build/linux.go index 61880d6d0..1e64c0c4e 100644 --- a/pkg/build/linux.go +++ b/pkg/build/linux.go @@ -40,6 +40,13 @@ func (linux linux) build(params Params) (ImageDetails, error) { } kernelPath := filepath.Join(params.KernelDir, filepath.FromSlash(kernelBin(params.TargetArch))) + + // Copy the kernel image to let it be uploaded to the asset storage. If the asset storage is not enabled, + // let the file just stay in the output folder -- it is usually very small compared to vmlinux anyway. + if err := osutil.CopyFile(kernelPath, filepath.Join(params.OutputDir, "kernel")); err != nil { + return details, err + } + if fileInfo, err := os.Stat(params.UserspaceDir); err == nil && fileInfo.IsDir() { // The old way of assembling the image from userspace dir. // It should be removed once all syzbot instances are switched. @@ -49,9 +56,6 @@ func (linux linux) build(params Params) (ImageDetails, error) { } 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 details, err - } if err := osutil.CopyFile(params.UserspaceDir, filepath.Join(params.OutputDir, "image")); err != nil { return details, err } |
