toolchain_util.sh: Fix _configure_sysroot CBUILD

The portage CBUILD and HOSTCC variables need to be set to the SDK host to get
a proper cross build when building target binaries.

Change _configure_sysroot to use the CBUILD environment variable to set the
CBUILD and HOSTCC variables of ${ROOT}/etc/portage/make.conf.  Also, fix up all
calls to _configure_sysroot to set the CBUILD environment variable.

Fixes setup_board failure when the host and target architectures differ.

Signed-off-by: Geoff Levand <geoff@infradead.org>

[marineam: fixed a copy/paste error]
This commit is contained in:
Geoff Levand 2015-04-01 10:58:57 -07:00 committed by Michael Marineau
parent 46f5478991
commit ea6cf50b8d
2 changed files with 8 additions and 3 deletions

View File

@ -16,7 +16,8 @@ configure_target_root() {
local cross_chost=$(get_board_chost "$1")
local profile=$(get_board_profile "${board}")
CHOST="${cross_chost}" \
CBUILD="$(portageq envvar CBUILD)" \
CHOST="${cross_chost}" \
ROOT="/build/${board}" \
SYSROOT="/usr/${cross_chost}" \
_configure_sysroot "${profile}"

View File

@ -187,7 +187,8 @@ _get_dependency_list() {
# Configure a new ROOT
# Values are copied from the environment or the current host configuration.
# Usage: ROOT=/foo/bar SYSROOT=/foo/bar configure_portage coreos:some/profile
# Usage: CBUILD=foo-bar-linux-gnu ROOT=/foo/bar SYSROOT=/foo/bar configure_portage coreos:some/profile
# Note: if using portageq to get CBUILD it must be called before CHOST is set.
_configure_sysroot() {
local profile="$1"
@ -279,7 +280,10 @@ install_cross_libs() {
sudo="sudo -E"
fi
CHOST="${cross_chost}" ROOT="$ROOT" SYSROOT="$ROOT" \
CBUILD="$(portageq envvar CBUILD)" \
CHOST="${cross_chost}" \
ROOT="$ROOT" \
SYSROOT="$ROOT" \
_configure_sysroot "${CROSS_PROFILES[${cross_chost}]}"
# In order to get a dependency list we must calculate it before