1#!/bin/bash 2# Copyright 2012 The ChromiumOS Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6# TODO: Convert this to python. 7 8get_all_board_toolchains() 9{ 10 cros_setup_toolchains --show-board-cfg="$1" | sed 's:,: :g' 11} 12 13get_ctarget_from_board() 14{ 15 local all_toolchains=( $(get_all_board_toolchains "$@") ) 16 echo "${all_toolchains[0]}" 17} 18 19get_board_arch() 20{ 21 local ctarget=$(get_ctarget_from_board "$@") 22 23 # Ask crossdev what the magical portage arch is! 24 local arch=$(eval $(crossdev --show-target-cfg "${ctarget}"); echo ${arch}) 25 if [[ -z ${arch} ]] ; then 26 error "Unable to determine ARCH from toolchain: ${ctarget}" 27 return 1 28 fi 29 30 echo "${arch}" 31 return 0 32} 33