diff -Nuar u-boot-at91/build.sh u-boot-at91-sama5d4/build.sh --- u-boot-at91/build.sh 1970-01-01 08:00:00.000000000 +0800 +++ u-boot-at91-sama5d4/build.sh 2019-08-04 22:47:21.589680602 +0800 @@ -0,0 +1,66 @@ +#!/bin/bash + +BOARD=sama5d4 +TFTP_PATH=/tftp +IMGS_PATH=../images +IMG_NAME=u-boot-${BOARD}.bin + +CROSSTOOL=/opt/buildroot/cortex-a5/bin/arm-linux- +JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l` + + +function do_clean() +{ + make CROSS_COMPILE=${CROSSTOOL} distclean + rm -f ${IMG_NAME} +} + +function do_modify() +{ + grep "arm-linux-gnueabi" Makefile > /dev/null + + if [ $? == 0 ] ; then + return ; + fi + + echo "Modify Makefile for ARCH and cross compiler" + sed -i -e "s|^CROSS_COMPILE=.*|CROSS_COMPILE=${CROSSTOOL}|g" Makefile +} + +function do_build() +{ + make ${BOARD}_xplained_nandflash_config + + make -j${JOBS} + + cp u-boot.bin ${IMG_NAME} + + chmod a+x ${IMG_NAME} +} + +function do_install() +{ + if [ -d $TFTP_PATH ] ;then + cp ${IMG_NAME} $TFTP_PATH + fi + + if [ -d ${IMGS_PATH} ] ; then + cp ${IMG_NAME} $IMGS_PATH + fi +} + +if [ "$1" == "clean" ] ; then + + do_clean + exit 0; +fi + +do_modify + +set -e + +do_build + +do_install + + diff -Nuar u-boot-at91/Makefile u-boot-at91-sama5d4/Makefile --- u-boot-at91/Makefile 2019-08-04 21:52:12.000000000 +0800 +++ u-boot-at91-sama5d4/Makefile 2019-08-04 22:42:31.053675028 +0800 @@ -194,6 +194,9 @@ ######################################################################### +ARCH=arm +CROSS_COMPILE=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- + # set default to nothing for native builds ifeq ($(HOSTARCH),$(ARCH)) CROSS_COMPILE ?=