aboutsummaryrefslogtreecommitdiff
path: root/cros_utils/toolchain_utils.sh
blob: 5e9a2a327f61540f9b27fbd17d0fdcf86e6826de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# TODO: Convert this to python.

get_all_board_toolchains()
{
  cros_setup_toolchains --show-board-cfg="$1" | sed 's:,: :g'
}

get_ctarget_from_board()
{
  local all_toolchains=( $(get_all_board_toolchains "$@") )
  echo "${all_toolchains[0]}"
}

get_board_arch()
{
  local ctarget=$(get_ctarget_from_board "$@")

  # Ask crossdev what the magical portage arch is!
  local arch=$(eval $(crossdev --show-target-cfg "${ctarget}"); echo ${arch})
  if [[ -z ${arch} ]] ; then
    error "Unable to determine ARCH from toolchain: ${ctarget}"
    return 1
  fi

  echo "${arch}"
  return 0
}