diff options
author | Leah Rowe <leah@libreboot.org> | 2023-12-21 10:48:07 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-12-21 14:18:51 +0000 |
commit | 90ac30b163b47769695ba247b2d5cb7c43226815 (patch) | |
tree | 3d48c3e2347a2b6a815ea3b75820b82c5a85ba72 /script/update | |
parent | 4711098e94b35dc1bdbad470443f56bb83aa1eb1 (diff) |
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 <leah@libreboot.org>
Diffstat (limited to 'script/update')
-rwxr-xr-x | script/update/trees | 41 |
1 files changed, 12 insertions, 29 deletions
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() |