45 lines
990 B
Bash
Executable File
45 lines
990 B
Bash
Executable File
#!/bin/sh
|
|
# Download and build latest version of U-Boot
|
|
|
|
UBOOTDIR="${1}" # For example "u-boot"
|
|
DEFCONFIG="${2}" # For example "rpi_3_defconfig"
|
|
TUPLE="${3}" # For example "aarch64-linux-gnu"
|
|
|
|
set -e
|
|
|
|
# U-Boot version to build
|
|
VERSION=$(git ls-remote --tags --refs "git://git.denx.de/u-boot.git" "v????.??" | \
|
|
cut -f 2 | \
|
|
grep -o "v....\..." | \
|
|
tail -n 1)
|
|
|
|
# Download U-Boot
|
|
git clone --branch "$VERSION" \
|
|
--depth 1 \
|
|
--reference-if-able "/tmp/debimg/u-boot.git" \
|
|
--dissociate \
|
|
"git://git.denx.de/u-boot.git" "${UBOOTDIR}"
|
|
|
|
# Step into U-Boot directory
|
|
cd "${UBOOTDIR}"
|
|
|
|
# Setup ARCH
|
|
case "${TUPLE}" in
|
|
arm-*)
|
|
export ARCH="arm"
|
|
;;
|
|
aarch64-*)
|
|
export ARCH="aarch64"
|
|
;;
|
|
*)
|
|
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 "${DEFCONFIG}" && make
|