From c34508de34e986c7bb3dbc3e070e47b29350d6b0 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 24 Oct 2022 04:11:47 +0000 Subject: pkg/build: copy the kernel image to the output folder This will let it be uploaded to the asset storage. --- pkg/build/linux.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pkg/build/linux.go') 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 } -- cgit mrf-deployment