[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/boot/common/scripts/Makefile b/boot/common/scripts/Makefile
new file mode 100755
index 0000000..ffa5724
--- /dev/null
+++ b/boot/common/scripts/Makefile
@@ -0,0 +1,214 @@
+::------------------------------------------------------------------------------------------	

+::							makefile for project

+::------------------------------------------------------------------------------------------

+BOOTLOADER_PATH=..

+BOOTLOADER_PRJ_PATH=../../prj

+	

+ECHO=@

+

+TIMER_START = $(shell date)

+SRCROOT = $(word $(words $(subst /, ,$(subst /common/scripts,,$(shell pwd)))),$(subst /, ,$(subst /common/scripts,,$(shell pwd))))

+

+

+ifeq ($(CHIP_TYPE),ZX297520V3)

+chip=zx297520v3

+endif

+

+

+ifeq ($(BOARD_TYPE),EVB)

+board=evb

+endif

+

+ifeq ($(BOARD_TYPE),MIFI)

+board=mifi

+endif

+

+ifeq ($(BOARD_TYPE),MIFI_MINI)

+board=mifi_mini

+endif

+

+ifeq ($(BOARD_TYPE),MIFI_MINI_XR819)

+board=mifi_mini_xr819

+endif

+

+ifeq ($(BOARD_TYPE),MIFI_MINI_64)

+board=mifi_mini_64

+endif

+

+ifeq ($(BOARD_TYPE),UFI_MINI)

+board=ufi_mini

+endif

+

+ifeq ($(BOARD_TYPE),CPE)

+board=cpe

+endif

+

+ifeq ($(BOARD_TYPE),CPE_SWITCH)

+board=cpe_switch

+endif

+

+ifeq ($(BOARD_TYPE),PHONE)

+board=phone

+endif

+

+ifeq ($(BOARD_TYPE),FWP)

+board=fwp

+endif

+

+ifeq ($(BOARD_TYPE),MDL)

+board=mdl

+endif

+

+ifeq ($(BOARD_TYPE),MDL_AB)

+board=mdl_ab

+endif

+

+ifeq ($(BOARD_TYPE),VEHICLE_DC)

+board=vehicle_dc

+endif

+

+ifeq ($(BOARD_TYPE),MDL_MINI)

+board=mdl_mini

+endif

+

+ifeq ($(BOARD_TYPE),MDL_MINI_64)

+board=mdl_mini_64

+endif

+

+ifeq ($(BOARD_TYPE),WATCH)

+board=watch

+endif

+

+ifeq ($(BOARD_TYPE),WATCH_CAP)

+board=watch_cap

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),))

+	ram_text=0x23EF0000

+	V3T_RAM_TEXT_64M_UBOOT=y

+else

+	ram_text=0x21EF0000

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),mdl_ab))

+	key_path=$(subst _ab,,$(board))

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),vehicle_dc))

+	key_path=mdl

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),mdl_mini mifi_mini ufi_mini))

+	key_path=$(subst _mini,,$(board))

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),mifi_mini_xr819))

+	key_path=$(subst _mini_xr819,,$(board))

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),mdl_mini_64 mifi_mini_64))

+	key_path=$(subst _mini_64,,$(board))

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),watch_cap))

+	key_path=$(subst _cap,,$(board))

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),cpe_switch))

+	key_path=$(subst _switch,,$(board))

+endif

+

+ifeq ($(strip $(board)),$(filter $(board),cpe evb fwp mdl mifi phone watch))

+	key_path=$(board)

+endif

+

+export chip board key_path ram_text V3T_RAM_TEXT_64M_UBOOT

+

+default: help

+

+help:

+	@echo "================== Make help ==================="

+	@echo "make [help]         	     help"

+	@echo "make all[clean]           compile all && link"

+	@echo "make zloader[clean]       build zloader"

+	@echo "make tloader[clean]       build tloader"

+	@echo "make uboot[clean]         build uboot"	

+

+tloader:

+	chmod -R 777 ../../../$(SRCROOT)

+	cp -rf $(BOOTLOADER_PRJ_PATH)/../../tools/SignImage/test_key/$(key_path)/key.h $(BOOTLOADER_PATH)/src/loader/include

+	cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_tloader.sh

+	@cp $(BOOTLOADER_PATH)/src/loader/z-load  $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/z-load 

+	@cp $(BOOTLOADER_PATH)/src/loader/z-load.map  $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/z-load.map

+	@echo "$(TIMER_START)"

+	@date

+

+zloader: 

+	chmod -R 777 ../../../$(SRCROOT)

+	cp -rf $(BOOTLOADER_PRJ_PATH)/../../tools/SignImage/test_key/$(key_path)/key.h $(BOOTLOADER_PATH)/src/loader/include

+	cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_zloader_dlon.sh 

+	@cp $(BOOTLOADER_PATH)/src/loader/z-load  $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_on/z-load 

+	@cp $(BOOTLOADER_PATH)/src/loader/z-load.map  $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_on/z-load.map

+	

+	cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_zloader_dloff.sh 

+	@cp $(BOOTLOADER_PATH)/src/loader/z-load  $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_off/z-load 

+	@cp $(BOOTLOADER_PATH)/src/loader/z-load.map  $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_off/z-load.map

+	@echo "$(TIMER_START)"

+	@date

+

+::------------------------------------------------------------------------------------------	

+::	º¯Êý¶¨Ò壬עÒ⺯Êý¶¨Òå»»ÐкóÊǿոñ£¬²»ÊÇtab

+::------------------------------------------------------------------------------------------

+make-uboot = \

+    chmod -R 777 ../../../$(SRCROOT);   \

+    cp -rf $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/config/uboot/* $(BOOTLOADER_PATH)/src/uboot; \

+    cd $(BOOTLOADER_PATH)/scripts/build && sh ./$(1); \

+    echo "$(TIMER_START)"; \

+    date;

+

+uboot: 

+	$(call make-uboot,build_uboot.sh)

+

+::------------------------------------------------------------------------------------------	

+::							 clean

+::------------------------------------------------------------------------------------------

+zloaderclean:

+	rm -fr $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_off/*load* 

+	rm -fr $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_on/*load* 

+tloaderclean:

+	rm -fr $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/*load*

+loadersrcclean:

+	cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_loader_clean.sh

+

+ubootclean:

+ifeq ($(strip $(board)),$(filter $(board),fwp phone))

+	rm -fr $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/$(lcd)/*boot*

+else

+	rm -fr $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/*boot*

+endif

+

+ubootsrcclean:

+	cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_uboot_clean.sh 	

+

+::------------------------------------------------------------------------------------------	

+::							all

+::------------------------------------------------------------------------------------------	

+all: zloader tloader uboot

+allclean: zloaderclean tloaderclean ubootclean

+bootclean: loadersrcclean ubootsrcclean

+

+klocwork:

+	bash $(KLOCWORK_SCRIPT_PATH)/0_flush.sh  $(KLOCWORK_WEBUI_PRJ_NAME) allclean all

+

+covall:

+	bash $(COVERITY_SCRIPT_PATH)/flush.sh  allclean all

+	make cov_upload

+

+coverity:

+	bash $(COVERITY_SCRIPT_PATH)/flush.sh $(COV_TARGET)

+

+cov_upload:

+	bash $(COVERITY_SCRIPT_PATH)/upload.sh $(COVERITY_PRJ_STREAM_NAME)

+

+cov_report:

+	bash $(COVERITY_SCRIPT_PATH)/report2.sh

diff --git a/boot/common/scripts/build/build_loader_clean.sh b/boot/common/scripts/build/build_loader_clean.sh
new file mode 100644
index 0000000..8aa96cc
--- /dev/null
+++ b/boot/common/scripts/build/build_loader_clean.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+cd ../..
+SRC_PATH=`pwd`
+
+echo "...loader src clean begin...";
+
+cd $SRC_PATH/src/loader
+
+make mrproper
+rm -f ./z-load*
+
+echo "........Finished........";
diff --git a/boot/common/scripts/build/build_tloader.sh b/boot/common/scripts/build/build_tloader.sh
new file mode 100755
index 0000000..a670737
--- /dev/null
+++ b/boot/common/scripts/build/build_tloader.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+cd ../../..
+SRC_PATH=`pwd`
+KEYS_PATH=$SRC_PATH/../tools/SignImage
+
+cd $SRC_PATH/common/src/loader
+
+make mrproper
+rm -f ./z-load*
+
+is_ok=0
+
+if 
+	make "$chip"_tloader_config;
+then
+	if	make platform; then
+		if make together; then
+			is_ok=1
+		fi		
+	fi
+fi
+
+if [ $is_ok -eq 1 ];then
+
+	echo "";
+	echo "Configuring ["$chip"_"$board"_tloader_config] for ["$chip" "$board" "$key_path"] board ...";
+		
+	mkdir -p $KEYS_PATH/Input
+	mkdir -p $KEYS_PATH/Output
+	chmod -R 777 $SRC_PATH/
+	cp z-load.bin $KEYS_PATH/Input/tloader.bin
+	cd $KEYS_PATH
+	./SignImage -z ./Input/tloader.bin ./test_key/$key_path/private.k
+	cp ./Input/tloader.bin $SRC_PATH/prj/$chip/$board/bin/tloader.bin
+	rm -rf Input
+	rm -rf Output
+	
+	echo "--Finished build [tloader.bin ] ...";
+	echo "................................................OK....";		
+fi
+
+
diff --git a/boot/common/scripts/build/build_uboot.sh b/boot/common/scripts/build/build_uboot.sh
new file mode 100755
index 0000000..17ce8d3
--- /dev/null
+++ b/boot/common/scripts/build/build_uboot.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+cd ../../..
+SRC_PATH=`pwd`
+KEYS_PATH=$SRC_PATH/../tools/SignImage
+BIN_PATH=$SRC_PATH/prj/"$chip"/"$board"/bin
+
+cd $SRC_PATH/common/src/uboot
+
+make mrproper
+rm -f ./u-boot*
+rm -fr ./compressed_bin
+
+
+echo "--Configuring [ "$chip"_boot_config ] for [ "$chip" "$board" "$key_path"] board ...";
+
+############################################################
+# project setting
+############################################################
+
+is_ok=0
+
+if
+	make "$chip"_boot_config;
+then
+	if	make platform; then
+		if make together; then
+			is_ok=1
+		fi
+	fi
+fi
+
+if [ $is_ok -eq 1 ];then	
+	echo "";
+	echo "--Configuring [ "$chip"_boot_config ] for [ "$chip" "$board" "$key_path"] board ...";
+	echo "--Finished build [ u-boot.bin ] ...";
+
+	if
+		cp compressed_bin/compressed.bin $SRC_PATH/common/scripts/tools;
+		cd $SRC_PATH/common/scripts/tools;
+		./mkimage -A arm -O u-boot -C none -a "$ram_text" -e "$ram_text" \
+					-n ZX297520 -d compressed.bin compressed.bin.head;
+	then
+		echo "Finished add head to [ u-boot.bin.head ] ...";
+
+		rm compressed.bin;
+		mv compressed.bin.head uboot.bin;
+		cp uboot.bin tboot.bin
+		mv tboot.bin $BIN_PATH/tboot.bin
+		
+		mkdir -p $KEYS_PATH/Input
+		mkdir -p $KEYS_PATH/Output
+		chmod -R 777 $SRC_PATH/
+		cp uboot.bin $KEYS_PATH/Input/uboot.bin
+		rm uboot.bin;
+		chmod -R a+x $KEYS_PATH/
+		cd $KEYS_PATH/
+		./SignImage -s ./Input/uboot.bin ./Output/uboot.bin ./test_key/"$key_path"/private.k
+		cp ./Output/uboot.bin $BIN_PATH/uboot.bin
+		cp $BIN_PATH/uboot.bin $BIN_PATH/uboot-mirr.bin
+		rm -rf Input
+		rm -rf Output
+		
+		cd $SRC_PATH/common/src/uboot;
+		cp ./u-boot $BIN_PATH
+		cp ./u-boot.map $BIN_PATH
+
+		echo "--Finished build [uboot.bin] ...";
+		echo "...............................................OK....";
+	fi
+fi
diff --git a/boot/common/scripts/build/build_uboot_clean.sh b/boot/common/scripts/build/build_uboot_clean.sh
new file mode 100644
index 0000000..eaec85c
--- /dev/null
+++ b/boot/common/scripts/build/build_uboot_clean.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+cd ../..
+SRC_PATH=`pwd`
+
+echo "...uboot src clean begin...";
+
+cd $SRC_PATH/src/uboot
+
+make mrproper
+rm -f ./u-boot*
+rm -fr ./compressed_bin
+
+echo "........Finished........";
\ No newline at end of file
diff --git a/boot/common/scripts/build/build_zloader_dloff.sh b/boot/common/scripts/build/build_zloader_dloff.sh
new file mode 100755
index 0000000..9f90a34
--- /dev/null
+++ b/boot/common/scripts/build/build_zloader_dloff.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+cd ../../..
+SRC_PATH=`pwd`
+KEYS_PATH=$SRC_PATH/../tools/SignImage
+
+cd $SRC_PATH/common/src/loader
+
+make mrproper
+rm -f ./z-load*
+
+is_ok=0
+
+if 
+	make "$chip"_zloader_dloff_config;
+then
+	if	make platform; then
+		if make together; then
+			is_ok=1
+		fi		
+	fi
+fi
+
+if [ $is_ok -eq 1 ];then	
+	echo "";
+	echo "Configuring ["$chip"_"$board"_zloader_dloff_config] for ["$chip" "$board" "$key_path"] board ...";
+	
+		cp z-load.bin $SRC_PATH/common/scripts/tools;
+		cd $SRC_PATH/common/scripts/tools;
+		./expand z-load.bin;
+
+		mkdir -p $KEYS_PATH/Input
+		mkdir -p $KEYS_PATH/Output
+		chmod -R 777 $SRC_PATH/
+		mv z-load.bin $KEYS_PATH/Input/zloader.bin
+		cd $KEYS_PATH
+		./SignImage -z ./Input/zloader.bin ./test_key/$key_path/private.k
+		cp ./Input/zloader.bin $SRC_PATH/prj/$chip/$board/bin/dl_off/zloader.bin
+		rm -rf Input
+		rm -rf Output
+
+		echo "--Finished build [zloader.bin] ...";
+		echo "................................................OK....";	
+		echo "";
+fi
diff --git a/boot/common/scripts/build/build_zloader_dlon.sh b/boot/common/scripts/build/build_zloader_dlon.sh
new file mode 100755
index 0000000..bfc6394
--- /dev/null
+++ b/boot/common/scripts/build/build_zloader_dlon.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+cd ../../..
+SRC_PATH=`pwd`
+KEYS_PATH=$SRC_PATH/../tools/SignImage
+
+cd $SRC_PATH/common/src/loader
+
+make mrproper
+rm -f ./z-load*
+
+is_ok=0
+
+if 
+	make "$chip"_zloader_dlon_config;
+then
+	if	make platform; then
+		if make together; then
+			is_ok=1
+		fi
+	fi
+fi
+
+if [ $is_ok -eq 1 ];then	
+	echo "";
+	echo "Configuring ["$chip"_"$board"_zloader_dlon_config] for ["$chip" "$board" "$key_path"] board ...";
+	
+		cp z-load.bin $SRC_PATH/common/scripts/tools;
+		cd $SRC_PATH/common/scripts/tools;
+		./expand z-load.bin;
+		
+		mkdir -p $KEYS_PATH/Input
+		mkdir -p $KEYS_PATH/Output
+		chmod -R 777 $SRC_PATH/
+		mv z-load.bin $KEYS_PATH/Input/zloader.bin
+		cd $KEYS_PATH
+		./SignImage -z ./Input/zloader.bin ./test_key/$key_path/private.k
+		cp ./Input/zloader.bin $SRC_PATH/prj/$chip/$board/bin/dl_on/zloader.bin
+		rm -rf Input
+		rm -rf Output
+		
+		echo "--Finished build [zloader.bin] ...";
+		echo "................................................OK....";	
+		echo "";
+fi
diff --git a/boot/common/scripts/tools/expand b/boot/common/scripts/tools/expand
new file mode 100755
index 0000000..0ccd8f5
--- /dev/null
+++ b/boot/common/scripts/tools/expand
Binary files differ
diff --git a/boot/common/scripts/tools/expand.exe b/boot/common/scripts/tools/expand.exe
new file mode 100644
index 0000000..84d1ee7
--- /dev/null
+++ b/boot/common/scripts/tools/expand.exe
Binary files differ
diff --git a/boot/common/scripts/tools/expand_4k.exe b/boot/common/scripts/tools/expand_4k.exe
new file mode 100644
index 0000000..cbdf949
--- /dev/null
+++ b/boot/common/scripts/tools/expand_4k.exe
Binary files differ
diff --git a/boot/common/scripts/tools/mkimage b/boot/common/scripts/tools/mkimage
new file mode 100755
index 0000000..add7a3c
--- /dev/null
+++ b/boot/common/scripts/tools/mkimage
Binary files differ
diff --git a/boot/common/scripts/tools/mkimage.exe b/boot/common/scripts/tools/mkimage.exe
new file mode 100644
index 0000000..245c92c
--- /dev/null
+++ b/boot/common/scripts/tools/mkimage.exe
Binary files differ