Fix the source vmlinuz path during non-active partition kernel upgrade.

BUG=1075824
TEST=Deploy kernel to a device booted from a usb stick.

Change-Id: I4876e67ff2ea482d4d3fed0511d56397830905c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2163089
Tested-by: Daniil Lunev <dlunev@chromium.org>
Commit-Queue: Daniil Lunev <dlunev@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
diff --git a/update_kernel.sh b/update_kernel.sh
index 73acaf4..44b66f8 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -217,6 +217,7 @@
 }
 
 update_syslinux_kernel() {
+  local basedir="$1" # rootfs directory (could be in /tmp) or empty string
   # ARM does not have the syslinux directory, so skip it when the
   # partition is missing, the file system fails to mount, or the syslinux
   # vmlinuz target is missing.
@@ -231,7 +232,8 @@
       else
         target="/tmp/${PARTITION_NUM_EFI_SYSTEM}/syslinux/vmlinuz.B"
       fi
-      remote_sh "test ! -f $target || cp /boot/vmlinuz $target"
+      remote_sh "test ! -f ${target} || \
+                 cp ${basedir}/boot/vmlinuz ${target}"
 
       remote_sh umount /tmp/${PARTITION_NUM_EFI_SYSTEM}
     fi
@@ -308,7 +310,7 @@
       fi
       info "Copying syslinux and /boot"
       remote_send_to /build/"${FLAGS_board}"/boot/ "${remote_basedir}"/boot/
-      update_syslinux_kernel
+      update_syslinux_kernel "${remote_basedir}"
     else
       info "Skipping syslinux and /boot (per request)"
     fi