scripts: fix C3 compile flow. [1/1]

PD#SWPL-97754

Problem:
fix c3 compile flow.

Solution:
fix c3 compile flow.

Verify:
N/A.

Change-Id: I05c55f610fce42fff45f8012df502e342208c4e5
Signed-off-by: shijie.xiong <shijie.xiong@amlogic.com>
diff --git a/c3_fastboot.sh b/c3_fastboot.sh
index ff5b5a0..32b1685 100755
--- a/c3_fastboot.sh
+++ b/c3_fastboot.sh
@@ -9,9 +9,14 @@
 RTOS_BASE_DIR=$(realpath $(dirname $(readlink -f ${BASH_SOURCE[0]:-$0}))/..)
 
 ## external resource path ##
-BL22_DIR=$RTOS_BASE_DIR/bl22
-UBOOT_DIR=$RTOS_BASE_DIR/boot
-LZ4_DIR=$RTOS_BASE_DIR/lib/utilities/lz4
+if [ -z $1 ] || [ -z $2 ]; then
+	echo -e "\033[41;33m Notice: parameter error !!! \033[0m"
+	echo -e "\033[33m usage: ./c3_fastboot.sh bl22_path u-boot_path \033[0m"
+	exit 1
+else
+	BL22_DIR=$1
+	UBOOT_DIR=$2
+fi
 
 #Get the current project environment variables
 source $RTOS_BASE_DIR/scripts/env.sh arm64 c3 aw419_c308l fastboot
@@ -21,38 +26,38 @@
 RTOS_IMAGE_A=$RTOS_BUILD_DIR/rtos_1.bin
 RTOS_IMAGE_B=$RTOS_BUILD_DIR/rtos_2.bin
 
+function lz4_rtos() {
+	pushd $RTOS_BASE_DIR/lib/utilities/lz4
+	cp $RTOS_IMAGE_A .
+	./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j 0x04e00000 -d 0
+	cp ./self_decompress_firmware.bin $RTOS_IMAGE_A
+	popd
+}
+
 function bl22_compile() {
 	if [ -d $BL22_DIR ]; then
 		pushd $BL22_DIR
-		./mk c3
+		if [ -f ./mk ]; then
+			echo aaaaaaa
+			./mk c3
+		fi
 		cp ./bl22.bin $RTOS_BUILD_DIR/bl22.bin
 		popd
 	fi
 }
 
-function lz4_rtos() {
-	if [ -d $LZ4_DIR ]; then
-		pushd $LZ4_DIR
-		cp $RTOS_IMAGE_A .
-		./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j 0x04e00000 -d 0
-		cp ./self_decompress_firmware.bin $RTOS_IMAGE_A
-		popd
-	fi
-}
-
 function package_fastboot() {
-	if [ -d $UBOOT_DIR ]; then
-		if [ -d $UBOOT_DIR/fastboot ]; then
-			rm -rf $UBOOT_DIR/fastboot
-		fi
-		mkdir -p $UBOOT_DIR/fastboot
-	fi
 	pushd $UBOOT_DIR
-	cp $RTOS_IMAGE_A $UBOOT_DIR/fastboot
-	cp $RTOS_IMAGE_B $UBOOT_DIR/fastboot
-	cp $RTOS_BUILD_DIR/bl22.bin $UBOOT_DIR/fastboot
+	if [ -d ./fastboot ]; then
+		rm -rf ./fastboot
+	fi
+	mkdir -p ./fastboot
+	cp $RTOS_IMAGE_A ./fastboot
+	cp $RTOS_IMAGE_B ./fastboot
+	cp $RTOS_BUILD_DIR/bl22.bin ./fastboot
 	#./mk c3_aw419 --update-bl2 --bl31 ./blob-bl31.bin.signed
 	./mk c3_aw419 --update-bl2 --update-bl2e --bl31 ./blob-bl31.bin.signed
+	#./mk c3_aw419 ./blob-bl31.bin.signed
 	popd
 }