build/roms: Make coreboot crossgcc usable for payloads and modules

Add the coreboot-built cross-architecture toolchains to the PATH so that
modules and payloads can use them. When building for a foreign-arch
board, also export CROSS_COMPILE pointing to the appropriate prefix.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
fsdg20230625
Alper Nebi Yasak 2022-12-07 20:53:18 +03:00
parent a586356164
commit bee5054077
2 changed files with 14 additions and 8 deletions

View File

@ -184,12 +184,20 @@ if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then
# 32-bit ROM images, so we only need to worry about i386-elf # 32-bit ROM images, so we only need to worry about i386-elf
) )
fi fi
case "$(uname -m)" in
x86*|i*86|amd64) : ;;
*) export CROSS_COMPILE=i386-elf- ;;
esac
elif [ "${arch}" = "ARMv7" ]; then elif [ "${arch}" = "ARMv7" ]; then
( (
cat version > "${cbdir}/.coreboot-version" cat version > "${cbdir}/.coreboot-version"
cd "${cbdir}" cd "${cbdir}"
make crossgcc-arm CPUS=$(nproc) # This is for armv7, doesn't apply to aarch64 make crossgcc-arm CPUS=$(nproc) # This is for armv7, doesn't apply to aarch64
) )
case "$(uname -m)" in
arm|arm32|armv6*|armv7*) : ;;
*) export CROSS_COMPILE=arm-eabi- ;;
esac
elif [ "${arch}" = "AArch64" ]; then elif [ "${arch}" = "AArch64" ]; then
( (
cat version > "${cbdir}/.coreboot-version" cat version > "${cbdir}/.coreboot-version"
@ -197,8 +205,14 @@ elif [ "${arch}" = "AArch64" ]; then
# aarch64 needs armv7 toolchain for arm-trusted-firmware # aarch64 needs armv7 toolchain for arm-trusted-firmware
make crossgcc-arm crossgcc-aarch64 CPUS=$(nproc) make crossgcc-arm crossgcc-aarch64 CPUS=$(nproc)
) )
case "$(uname -m)" in
arm64|aarch64) : ;;
*) export CROSS_COMPILE=aarch64-elf- ;;
esac
fi fi
export PATH="$(pwd)/${cbdir}/util/crossgcc/xgcc/bin:$PATH"
if [ ! -f "${cbfstool}" ]; then if [ ! -f "${cbfstool}" ]; then
./build module cbutils ${cbtree} ./build module cbutils ${cbtree}
fi fi

View File

@ -94,14 +94,6 @@ for board in "$@"; do
continue continue
fi fi
if [ "${arch}" = "x86_32" ] || [ "${arch}" = "x86_64" ]; then
export CROSS_COMPILE=x86_64-linux-
elif [ "${arch}" = "ARMv7" ]; then
export CROSS_COMPILE=arm-linux-gnueabi-
elif [ "${arch}" = "AArch64" ]; then
export CROSS_COMPILE=aarch64-linux-gnu-
fi
for config in "${board_dir}/config"/*; do for config in "${board_dir}/config"/*; do
if [ ! -f "${config}" ]; then if [ ! -f "${config}" ]; then
printf "%s: Target %s has no configs to build for. Skipping build.\n" \ printf "%s: Target %s has no configs to build for. Skipping build.\n" \