From ea6cf50b8df53c662018f5668073819475163623 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Wed, 1 Apr 2015 10:58:57 -0700 Subject: [PATCH] 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 [marineam: fixed a copy/paste error] --- build_library/catalyst_toolchains.sh | 3 ++- build_library/toolchain_util.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build_library/catalyst_toolchains.sh b/build_library/catalyst_toolchains.sh index 32b16b48b7..4106b6af42 100644 --- a/build_library/catalyst_toolchains.sh +++ b/build_library/catalyst_toolchains.sh @@ -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}" diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index 87e5a25df4..388a7c58fa 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -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