update_kernel: Make ab_update swap kernel slots

The new flag --ab_update installs the kernel to the other slot. However
the device will reboot to the current slot. Most developers are likely
using --bootonce, which does swap to the other slot. This patch makes
the swapping to the other slot explicit.

BUG=None
TEST=./update_kernel --ab_update # before, doesnt update, after, does
TEST=./update_kernel --ab_update --bootonce # still works

Change-Id: I47cd92c2ae16907a3ffc7369b715a42ef57e5ee3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/3434926
Tested-by: Evan Benn <evanbenn@chromium.org>
Auto-Submit: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Commit-Queue: Evan Benn <evanbenn@chromium.org>
diff --git a/update_kernel.sh b/update_kernel.sh
index 95999c5..dd69f1b 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -360,7 +360,8 @@
     info "Skipping update of vboot (per request)"
   fi
 
-  if [ ${FLAGS_bootonce} -eq ${FLAGS_TRUE} ]; then
+  if [[ "${FLAGS_bootonce}" -eq "${FLAGS_TRUE}" || \
+        "${FLAGS_ab_update}" -eq "${FLAGS_TRUE}" ]]; then
     info "Marking kernel partition ${FLAGS_partition} as boot once"
     mark_boot_once
   fi