#!/bin/sh # Download and build latest version of U-Boot DEFCONFIG="${1}" # For example "rpi_3_defconfig" TUPLE="${2}" # For example "aarch64-linux-gnu" TARBALL="${U_BOOT_TARBALL}" GIT_REV="${U_BOOT_GIT_REV}" GIT_URL="${U_BOOT_GIT_URL:-git://git.denx.de/u-boot.git}" set -e if [ ! -s "${TARBALL}" ] then if [ -z "${GIT_REV}" ] then # U-Boot version to build GIT_REV=$(git ls-remote --tags \ --refs \ "${GIT_URL}" \ "v????.??" | \ cut -f 2 | \ grep -o "v....\..." | \ tail -n 1) fi # Download U-Boot git clone --branch "${GIT_REV}" \ --depth 1 \ "${GIT_URL}" u-boot else # Extract U-Boot tar -xf "${TARBALL}" mv u-boot-????.?? u-boot fi # Step into U-Boot directory cd u-boot # 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