From 90ac30b163b47769695ba247b2d5cb7c43226815 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 21 Dec 2023 10:48:07 +0000 Subject: update/trees: simplified crossgcc handling only call crossgcc for coreboot and u-boot, but use hostcc for everything else. simplify the checking of which architecture to compile for. "arch" in target.cfg files has been modified, to allow further simplification. without this patch, the logic currently only *barely* avoids using crossgcc on things like utils, and only works in practise because, in practise, lbmk only works on x86_64 anyway. the new logic, as per this patch, is simpler and more robust. Signed-off-by: Leah Rowe --- script/update/trees | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'script/update/trees') diff --git a/script/update/trees b/script/update/trees index 67455a3b..44a63263 100755 --- a/script/update/trees +++ b/script/update/trees @@ -174,45 +174,28 @@ handle_src_tree() # (seabios and grub currently use hostcc, not crossgcc) check_cross_compiler() { + [ "$project" = "u-boot" ] || [ "$project" = "coreboot" ] || return 0 + [ -z "${arch}" ] && return 0 + + _arch="${arch}" + [ "${arch}" = "aarch64-elf" ] && _arch="aarch64-elf arm-eabi" + [ "${crossgcc_ada}" = "y" ] || [ "${crossgcc_ada}" = "n" ] || \ crossgcc_ada="y" [ "${crossgcc_ada}" = "y" ] || export BUILD_LANGUAGES=c cbdir="src/coreboot/${tree}" [ "${project}" != "coreboot" ] && cbdir="src/coreboot/default" + x_ ./update trees -f coreboot ${cbdir#src/coreboot/} - # only true if not building coreboot: - ctarget="${cbdir#src/coreboot/}" - [ -d "${cbdir}" ] || x_ ./update trees -f coreboot ${ctarget} - - if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then - [ -d "${cbdir}/util/crossgcc/xgcc/i386-elf/" ] || \ - x_ make -C "${cbdir}" crossgcc-i386 CPUS=$(nproc) - case "$(uname -m)" in - x86*|i*86|amd64) : ;; - *) export CROSS_COMPILE=i386-elf- ;; - esac - elif [ "${arch}" = "ARMv7" ]; then - [ -d "${cbdir}/util/crossgcc/xgcc/arm-eabi/" ] || \ - x_ make -C "${cbdir}" crossgcc-arm CPUS=$(nproc) - case "$(uname -m)" in - arm|arm32|armv6*|armv7*) : ;; - *) export CROSS_COMPILE=arm-eabi- ;; - esac - elif [ "${arch}" = "AArch64" ]; then - [ -d "${cbdir}/util/crossgcc/xgcc/aarch64-elf/" ] || \ - x_ make -C "${cbdir}" crossgcc-aarch64 CPUS=$(nproc) - # aarch64 also needs armv7 toolchain for arm-trusted-firmware - [ -d "${cbdir}/util/crossgcc/xgcc/arm-eabi/" ] || \ - x_ make -C "${cbdir}" crossgcc-arm CPUS=$(nproc) - case "$(uname -m)" in - arm64|aarch64) : ;; - *) export CROSS_COMPILE=aarch64-elf- ;; - esac - fi + for xarch in ${_arch}; do + [ -d "${cbdir}/util/crossgcc/xgcc/${xarch}/" ] && continue + x_ make -C "${cbdir}" crossgcc-${xarch%-*} CPUS=$(nproc) + done # we *must* ensure that u-boot's build system uses crossgcc first export PATH="${PWD}/${cbdir}/util/crossgcc/xgcc/bin:$PATH" + export CROSS_COMPILE="${_arch% *}-" } check_config() -- cgit v1.2.1