53 lines
1.1 KiB
Bash
Executable File
53 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Download and build latest version of U-Boot
|
|
|
|
DEFCONFIG="${1}" # For example "rpi_3_defconfig"
|
|
TUPLE="${2}" # For example "aarch64-linux-gnu"
|
|
|
|
set -ex
|
|
|
|
U_BOOT_GIT_URL_DEFAULT="https://gitlab.denx.de/u-boot/u-boot.git"
|
|
|
|
if [ ! -z "${U_BOOT_GIT_REV}" ]
|
|
then
|
|
git clone --depth 1 \
|
|
--reference-if-able "${WORKDIR}/u-boot" \
|
|
--branch "${U_BOOT_GIT_REV}" \
|
|
"${U_BOOT_GIT_URL:-${U_BOOT_GIT_URL_DEFAULT}}" u-boot
|
|
else
|
|
git clone --depth 1 \
|
|
--reference-if-able "${WORKDIR}/u-boot" \
|
|
"${U_BOOT_GIT_URL:-${U_BOOT_GIT_URL_DEFAULT}}" u-boot
|
|
fi
|
|
|
|
# Step into U-Boot directory
|
|
cd u-boot
|
|
|
|
# Apply patches
|
|
if [ -d "${U_BOOT_PATCHES_DIR}" ]; then
|
|
git apply "${U_BOOT_PATCHES_DIR}"/*.patch || :
|
|
fi
|
|
|
|
# Setup ARCH
|
|
case "${TUPLE}" in
|
|
arm-*)
|
|
export ARCH="arm"
|
|
;;
|
|
aarch64-*)
|
|
export ARCH="aarch64"
|
|
;;
|
|
x86_64-*|i?86-*)
|
|
export ARCH="x86"
|
|
;;
|
|
*)
|
|
echo "Can't decide \$ARCH for tuple \"${TUPLE}\""
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# CROSS_COMPILE must point to a valid compiler path prefix
|
|
export CROSS_COMPILE=$(dirname $(which "${TUPLE}-gcc"))/"${TUPLE}-"
|
|
|
|
# Build U-Boot
|
|
make ${MAKEFLAGS} "${DEFCONFIG}" && make ${MAKEFLAGS}
|