update_bootloaders.sh: Add board config into the mix

The update_bootloaders.sh script asks which partition numbers
certain labels live on. Though we never change this, it is technically
board-specific. Right now it works because it falls back to loading
legacy_disk_layout.json, and we simply get lucky because nobody has
reordered the partitions.

Remove our reliance on the existence of legacy_disk_layout.json by
passing the board info into update_bootloaders.sh. This causes the
overlay disk-info to get loaded, with the true partition numbers
for the board.

BUG=none
TEST=build_image --board=hatch

Change-Id: I55e7cfb2d507c7930f71d5ed1031f7e752e5c6d9
Reviewed-on: https://chromium-review.googlesource.com/1538303
Commit-Ready: Evan Green <evgreen@chromium.org>
Tested-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable
index bf4ffa0..6e5fef5 100755
--- a/bin/cros_make_image_bootable
+++ b/bin/cros_make_image_bootable
@@ -390,6 +390,7 @@
     # Update EFI partition
     ${SCRIPTS_DIR}/update_bootloaders.sh \
       --arch="${FLAGS_arch}" \
+      --board="${BOARD}" \
       --image_type="${FLAGS_image_type}" \
       --to="${bootloader_to}" \
       --from="${FLAGS_rootfs_mountpoint}"/boot \
diff --git a/update_bootloaders.sh b/update_bootloaders.sh
index b74b3c5..f9e308c 100755
--- a/update_bootloaders.sh
+++ b/update_bootloaders.sh
@@ -20,6 +20,8 @@
 # Flags.
 DEFINE_string arch "x86" \
   "The boot architecture: arm, mips, x86, or amd64 (Default: x86)"
+DEFINE_string board "${DEFAULT_BOARD}" \
+  "Board we're building for."
 DEFINE_string image_type "usb" \
   "Type of image we're building for."
 # TODO(wad) once extlinux is dead, we can remove this.
@@ -53,6 +55,9 @@
 eval set -- "${FLAGS_ARGV}"
 switch_to_strict_mode
 
+. "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1
+load_board_specific_script "board_specific_setup.sh"
+
 part_index_to_uuid() {
   local image="$1"
   local index="$2"