From 91a2fe4aba27a2d85d9ba165580ba1f3f3252f70 Mon Sep 17 00:00:00 2001 From: Kees Jongenburger Date: Fri, 13 Dec 2013 13:36:47 +0100 Subject: [PATCH] arm:manage versioning of u-boot and upgrade u-boot Replaced the wget download of u-boot by a versioned git checkout this allows us to better manage the u-boot and MLO version we ship while still allowing us to build ofline. This changes replaces the BASE_URL setting by U_BOOT_BIN_DIR and also updates to a newer build of u-boot. --- releasetools/arm_sdimage.sh | 42 ++++++++++++++------------ releasetools/fetch_u-boot.sh | 57 ++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 18 deletions(-) create mode 100755 releasetools/fetch_u-boot.sh diff --git a/releasetools/arm_sdimage.sh b/releasetools/arm_sdimage.sh index f51da89bb..b8b40d75a 100755 --- a/releasetools/arm_sdimage.sh +++ b/releasetools/arm_sdimage.sh @@ -20,6 +20,7 @@ fi : ${CROSS_PREFIX=${CROSS_TOOLS}/arm-elf32-minix-} : ${JOBS=1} : ${DESTDIR=${OBJ}/destdir.$ARCH} +: ${RELEASETOOLSDIR=./releasetools/} : ${FSTAB=${DESTDIR}/etc/fstab} : ${BUILDVARS=} : ${BUILDSH=build.sh} @@ -33,17 +34,32 @@ fi : ${UBOOT=u-boot.img} -# beagleboard-xm -: ${BASE_URL=http://www.minix3.org/arm/beagleboard-xm} +# Beagleboard-xm +: ${U_BOOT_BIN_DIR=build/omap3_beagle/} : ${FLAG=-DDM37XX} : ${CONSOLE=tty02} -#beaglebone (and black) -#: ${BASE_URL=http://www.minix3.org/arm/beaglebone} +# BeagleBone (and black) +#: ${U_BOOT_BIN_DIR=build/am335x_evm/} #: ${FLAG=-DAM335X} #: ${CONSOLE=tty00} +# +# +# We host u-boot binaries. +U_BOOT_GIT_VERSION=cb5178f12787c690cb1c888d88733137e5a47b15 + +if [ -n "$BASE_URL" ] +then + #we no longer download u-boot but do a checkout + #BASE_URL used to be the base url for u-boot + #Downloads + echo "Warning:** Setting BASE_URL (u-boot) is no longer possible use U_BOOT_BIN_DIR" + echo "Look in ./releasetools/arm_sdimage.sh for suggested values" + exit 1 +fi + if [ ! -f ${BUILDSH} ] then echo "Please invoke me from the root source dir, where ${BUILDSH} is." exit 1 @@ -51,7 +67,7 @@ fi export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH -for needed in mcopy dd wget mkfs.vfat +for needed in mcopy dd mkfs.vfat git do if ! which $needed 2>&1 > /dev/null then @@ -68,19 +84,9 @@ mkdir -p $IMG_DIR # # Download the stage 1 bootloader and u-boot # -for i in ${MLO} ${UBOOT} -do - if [ ! -f ${IMG_DIR}/${i} ] - then - if ! wget -O ${IMG_DIR}/$i ${BASE_URL}/$i - then - echo "Failed to download $i" - rm -f ${IMG_DIR}/$i - exit 1 - fi - - fi -done +./releasetools/fetch_u-boot.sh -o ${RELEASETOOLSDIR}/u-boot -n $U_BOOT_GIT_VERSION +cp ${RELEASETOOLSDIR}/u-boot/${U_BOOT_BIN_DIR}/u-boot.img ${IMG_DIR}/ +cp ${RELEASETOOLSDIR}/u-boot/${U_BOOT_BIN_DIR}/MLO ${IMG_DIR}/ # # Call build.sh using a sloppy file list so we don't need to remove the installed /etc/fstag diff --git a/releasetools/fetch_u-boot.sh b/releasetools/fetch_u-boot.sh new file mode 100755 index 000000000..140346402 --- /dev/null +++ b/releasetools/fetch_u-boot.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Perform a checkout / update the MINIX u-boot git repo if needed +# +# -o output dir +OUTPUT_DIR="" +GIT_VERSION="" +while getopts "o:n:?" c +do + case "$c" in + \?) + echo "Usage: $0 -o output dir -n version " >&2 + exit 1 + ;; + o) + OUTPUT_DIR=$OPTARG + ;; + n) + GIT_VERSION=$OPTARG + ;; + esac +done + + +# +# check arguments +# +if [ -z "$OUTPUT_DIR" -o -z "$GIT_VERSION" ] +then + echo "Missing required parameters OUTPUT_DIR=$OUTPUT_DIR GIT_VERSION=$GIT_VERSION" + echo "Usage: $0 -o output dir -n version " >&2 + exit 1 +fi + + +# +# if the file doesn't exist it's easy , to a checkout +# +if [ ! -e "$OUTPUT_DIR" ] +then + git clone git://git.minix3.org/u-boot -b minix $OUTPUT_DIR +fi + +( + cd "$OUTPUT_DIR" + + # + # perform an update + # + CURRENT_VERSION=`git rev-parse HEAD` + if [ "$CURRENT_VERSION" != "$GIT_VERSION" ] + then + echo "Current version $CURRENT_VERSION does not match wanted $GIT_VERSION performing update and checkout" + git fetch -v + git checkout $GIT_VERSION + fi +) -- 2.44.0