build_kernel_image.sh: Fix shellcheck warnings

Let shellcheck now that the variable can contain multiple files.

BUG=b:283830492
TEST=Pass pre-commit test

Change-Id: Idb39f1d9c819e9f4e951010a41e030239bb3c1b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/4553596
Commit-Queue: Ricardo Ribalda <ribalda@chromium.org>
Tested-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Cindy Lin <xcl@google.com>
diff --git a/build_kernel_image.sh b/build_kernel_image.sh
index 4e26a7f..97aebe7 100755
--- a/build_kernel_image.sh
+++ b/build_kernel_image.sh
@@ -254,7 +254,7 @@
 kern_guid=%U
 EOF
 
-WORK="${WORK} ${FLAGS_working_dir}/boot.config"
+WORK=("${FLAGS_working_dir}/boot.config")
 info "Emitted cross-platform boot params to ${FLAGS_working_dir}/boot.config"
 
 # Add common boot options first.
@@ -290,6 +290,7 @@
 drm.trace=0x106
 EOF
 
+WORK+=("${config}")
 if [[ "${FLAGS_arch}" == "x86" || "${FLAGS_arch}" == "amd64" ]]; then
   # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will
   # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS
@@ -301,15 +302,12 @@
 noswap
 i915.modeset=1
 EOF
-  WORK="${WORK} ${config}"
 
   bootloader_path="/lib64/bootstub/bootstub.efi"
 elif [[ "${FLAGS_arch}" == "arm" || "${FLAGS_arch}" == "mips"  || "${FLAGS_arch}" == "arm64" ]]; then
-  WORK="${WORK} ${config}"
-
   # arm does not need/have a bootloader in kernel partition
   dd if="/dev/zero" of="${FLAGS_working_dir}/bootloader.bin" bs=512 count=1
-  WORK="${WORK} ${FLAGS_working_dir}/bootloader.bin"
+  WORK+=("${FLAGS_working_dir}/bootloader.bin")
 
   bootloader_path="${FLAGS_working_dir}/bootloader.bin"
 else
@@ -377,8 +375,8 @@
 set +e  # cleanup failure is a-ok
 
 if [[ ${FLAGS_keep_work} -eq ${FLAGS_FALSE} ]]; then
-  info "Cleaning up temporary files: ${WORK}"
-  rm ${WORK}
+  info "Cleaning up temporary files: ${WORK[*]}"
+  rm "${WORK[@]}"
   rmdir "${FLAGS_working_dir}"
 fi