Skip syslinux installation when building MIPS images.

BUG=chromium:394983
TEST=`./build_image --board=mipsel-o32-generic dev test`
TEST=`./image_to_vm.sh --board=mipsel-o32-generic --test_image`
TEST=Trybot runs on paladin, release, and chromiumos-sdk builders.

Change-Id: I6f2cdac25d870a73edf8816f73c46d097275c300
Reviewed-on: https://chromium-review.googlesource.com/208838
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable
index ce5e38a..5de6f55 100755
--- a/bin/cros_make_image_bootable
+++ b/bin/cros_make_image_bootable
@@ -82,7 +82,7 @@
 DEFINE_string image "chromiumos_base.img" \
   "Full path to the chromiumos image to make bootable."
 DEFINE_string arch "x86" \
-  "Architecture to make bootable for: arm, x86, or amd64"
+  "Architecture to make bootable for: arm, mips, x86, or amd64"
 DEFINE_string usb_disk "/dev/sdb3" \
   "Path syslinux should use to do a usb boot."
 DEFINE_boolean cleanup_dirs ${FLAGS_TRUE} \
@@ -348,8 +348,8 @@
     kernel_part="--kernel_partition='${FLAGS_output_dir}/vmlinuz.image'"
     # Install syslinux on the EFI System Partition.
     kernel_part="${kernel_part} --install_syslinux"
-  elif [[ "${FLAGS_arch}" = "arm" ]]; then
-    # These flags are not used for ARM update_bootloaders.sh
+  elif [[ "${FLAGS_arch}" = "arm" || "${FLAGS_arch}" = "mips" ]]; then
+    # These flags are not used for ARM / MIPS update_bootloaders.sh
     kernel_part=""
   fi
 
diff --git a/image_to_vm.sh b/image_to_vm.sh
index ccffbee..b7a50a7 100755
--- a/image_to_vm.sh
+++ b/image_to_vm.sh
@@ -146,8 +146,12 @@
 mkdir -p "${TEMP_ESP_MNT}"
 sudo mount -o loop "${TEMP_ESP}" "${TEMP_ESP_MNT}"
 
-# Modify the unverified usb template which uses a default usb_disk of sdb3
-sudo sed -i -e 's/sdb3/sda3/g' "${TEMP_MNT}/boot/syslinux/usb.A.cfg"
+# Modify the unverified usb template, which uses a default usb_disk of sdb3,
+# for targets (e.g. x86 and amd64) that have syslinux installed.
+SYSLINUX_USB_A_CONFIG="${TEMP_MNT}/boot/syslinux/usb.A.cfg"
+if [ -e "${SYSLINUX_USB_A_CONFIG}" ]; then
+  sudo sed -i -e 's/sdb3/sda3/g' "${SYSLINUX_USB_A_CONFIG}"
+fi
 
 # Add loading of cirrus fb module
 if [ "${FLAGS_format}" = "qemu" ]; then
diff --git a/update_bootloaders.sh b/update_bootloaders.sh
index 3398ab7..ee214d9 100755
--- a/update_bootloaders.sh
+++ b/update_bootloaders.sh
@@ -18,7 +18,7 @@
 
 # Flags.
 DEFINE_string arch "x86" \
-  "The boot architecture: arm or x86. (Default: x86)"
+  "The boot architecture: arm, mips, x86, or amd64 (Default: x86)"
 # TODO(wad) once extlinux is dead, we can remove this.
 DEFINE_boolean install_syslinux ${FLAGS_FALSE} \
   "Controls whether syslinux is run on 'to'. (Default: false)"
@@ -196,7 +196,7 @@
     # mount again for cleanup to free resource gracefully
     sudo mount -o ro "${ESP_DEV}" "${ESP_FS_DIR}"
   fi
-elif [[ "${FLAGS_arch}" = "arm" ]]; then
+elif [[ "${FLAGS_arch}" = "arm" || "${FLAGS_arch}" = "mips" ]]; then
   # Copy u-boot script to ESP partition
   if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then
     sudo mkdir -p "${ESP_FS_DIR}/u-boot"