diff -Nuar u-boot-2011.09/build.sh u-boot-2011.09-ok335x/build.sh --- u-boot-2011.09/build.sh 1970-01-01 08:00:00.000000000 +0800 +++ u-boot-2011.09-ok335x/build.sh 2019-07-29 13:42:52.862123947 +0800 @@ -0,0 +1,66 @@ +#!/bin/bash + +TFTP_PATH=/tftp +IMGS_PATH=../images +IMG_NAME="u-boot.img MLO" + +CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- +JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l` + + +function do_clean() +{ + make CROSS_COMPILE=${CROSSTOOL} distclean + rm -f MLO tags +} + +function do_modify() +{ + grep "export ARCH=arm" Makefile > /dev/null + + if [ $? == 0 ] ; then + return ; + fi + + echo "Modify Makefile for ARCH and cross compiler" + sed -i "/ARCH CPU BOARD VENDOR SOC/a\export CROSS_COMPILE=${CROSSTOOL}" Makefile + sed -i '/ARCH CPU BOARD VENDOR SOC/a\export ARCH=arm' Makefile +} + +function do_build() +{ + make ok335x_config + + make -j${JOBS} + + chmod a-x u-boot + + 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-2011.09/Makefile u-boot-2011.09-ok335x/Makefile --- u-boot-2011.09/Makefile 2013-11-20 14:14:16.000000000 +0800 +++ u-boot-2011.09-ok335x/Makefile 2019-07-29 13:39:47.514120392 +0800 @@ -155,6 +155,8 @@ # load ARCH, BOARD, and CPU configuration include $(obj)include/config.mk export ARCH CPU BOARD VENDOR SOC +export ARCH=arm +export CROSS_COMPILE=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi- # set default to nothing for native builds ifeq ($(HOSTARCH),$(ARCH))