Revert "update_kernel: Learn arch from board build"

This reverts commit 3476ad8561f5930f84cbcc9e5e49bb421793e893, since it
breaks usage without a full .../build/images/${BOARD}/latest/boot.desc.
We previously were able to build just the relevant package(s) (e.g.,
kernel) and run update_kernel.sh without build_image.

BUG=chromium:997033
TEST=setup_board --board=$BOARD; emerge-${BOARD} chromeos-kernel-X_Y;
     ./update_kernel.sh --remote=${HOST}

Change-Id: I67ece6d3611ca121bec3aae8b6215d9ba280e0f9
Reviewed-on: https://chromium-review.googlesource.com/1767417
Tested-by: Brian Norris <briannorris@chromium.org>
Commit-Ready: Brian Norris <briannorris@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
diff --git a/remote_access.sh b/remote_access.sh
index 4e9f548..251621f 100644
--- a/remote_access.sh
+++ b/remote_access.sh
@@ -177,6 +177,17 @@
   info "Target reports board is ${FLAGS_board}"
 }
 
+learn_arch() {
+  [ -n "${FLAGS_arch}" ] && return
+  remote_sh uname -m
+  FLAGS_arch=$(echo "${REMOTE_OUT}" | sed -e s/armv7l/arm/ -e s/i686/x86/ )
+  if [ -z "${FLAGS_arch}" ]; then
+    error "Arch required"
+    exit 1
+  fi
+  info "Target reports arch is ${FLAGS_arch}"
+}
+
 # Discover partition numbers from the target.
 learn_partition_layout() {
   source <(remote_sh_raw cat /usr/sbin/write_gpt.sh)
diff --git a/update_kernel.sh b/update_kernel.sh
index 98165ef..4944535 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -139,17 +139,6 @@
   fi
 }
 
-learn_arch() {
-  [ -n "${FLAGS_arch}" ] && return
-  FLAGS_arch=$(sed -n -E 's/^ *--arch="(.*)"/\1/p' \
-         "${SRC_ROOT}/build/images/${FLAGS_board}/latest/boot.desc")
-  if [ -z "${FLAGS_arch}" ]; then
-    error "Arch required"
-    exit 1
-  fi
-  info "Target reports arch is ${FLAGS_arch}"
-}
-
 make_kernelimage() {
   local bootloader_path
   local kernel_image
@@ -282,10 +271,10 @@
 
   remote_access_init
 
-  learn_board
-
   learn_arch
 
+  learn_board
+
   learn_device
 
   learn_partition_layout