pass down board info to cros_setup_toolchains

If the board we're building includes extra toolchains that aren't part
of our official set, we need to make sure cros_setup_toolchains still
tries to set them up for us.

BUG=None
TEST=`cbuildbot chromiumos-sdk` works
TEST=`./setup_board --board=x32-generic` installs an extra toolchain

Change-Id: I85f70177f82bdf295eb2cd8668a031317a3b6e61
Reviewed-on: https://gerrit.chromium.org/gerrit/24336
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
diff --git a/setup_board b/setup_board
index 0199a15..7c502fc 100755
--- a/setup_board
+++ b/setup_board
@@ -342,8 +342,10 @@
   exit 1
 fi
 
+get_board_and_variant $FLAGS_board $FLAGS_variant
+
 # Before we can run any tools, we need to update chroot
-UPDATE_ARGS=""
+UPDATE_ARGS="--toolchain_boards=${BOARD}"
 if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
   UPDATE_ARGS+=" --fast"
 else
@@ -364,8 +366,6 @@
   "${SRC_ROOT}/scripts"/update_chroot ${UPDATE_ARGS}
 fi
 
-get_board_and_variant $FLAGS_board $FLAGS_variant
-
 #
 # Fetch the toolchain from the board overlay.
 #
diff --git a/update_chroot b/update_chroot
index 3b7879c..817ff40 100755
--- a/update_chroot
+++ b/update_chroot
@@ -31,6 +31,8 @@
   "How many packages to build in parallel at maximum."
 DEFINE_boolean skip_toolchain_update $FLAGS_FALSE \
   "Don't update the toolchains."
+DEFINE_string toolchain_boards "" \
+  "Extra toolchains to setup for the specified boards."
 
 # Parse command line flags
 FLAGS "$@" || exit 1
@@ -87,7 +89,7 @@
   # First update crossdev.
   sudo -E ${EMERGE_CMD} ${EMERGE_FLAGS} crossdev
 
-  TOOLCHAIN_FLAGS=""
+  TOOLCHAIN_FLAGS="--include-boards=${FLAGS_toolchain_boards}"
   # This should really only be skipped while bootstrapping.
   if [ "${FLAGS_usepkg}" -eq "${FLAGS_FALSE}" ]; then
     TOOLCHAIN_FLAGS="--nousepkg"