scripts: fastboot adaptation AW402. [1/1]
PD#SWPL-107181
Problem:
fastboot on AW402.
Solution:
add adaptation code for AW402
Verify:
N/A
Change-Id: I8f1a4c4c35cced9ad373ca8c64759acbeded45d9
Signed-off-by: shijie.xiong <shijie.xiong@amlogic.com>
diff --git a/c3_fastboot.sh b/c3_fastboot.sh
index 27b8da4..cf93777 100755
--- a/c3_fastboot.sh
+++ b/c3_fastboot.sh
@@ -15,12 +15,15 @@
## external resource path ##
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]; then
echo -e "\033[41;33m Notice: parameter error !!! \033[0m"
- echo -e "\033[33m usage: ./c3_fastboot.sh bl22_path u-boot_path board_type\033[0m"
+ echo -e "\033[33m usage: ./c3_fastboot.sh bl22_path u-boot_path board_type (optional:load_address)\033[0m"
exit 1
else
BL22_DIR=$1
UBOOT_DIR=$2
BOARD_TYPE=$3
+ if [ $4 ] && [[ "$4" =~ ^0x.* ]]; then
+ RTOS_TARGET_ADDRESS=$4
+ fi
fi
#Parse the specified hardware type
@@ -38,6 +41,25 @@
exit 1
fi
+#Get the rtos target address (The configuration needs to be consistent with the lscript.h file)
+if [ -z $RTOS_TARGET_ADDRESS ]; then
+ case $BOARD_TYPE_MAPPING in
+ 'c3_aw409')
+ RTOS_TARGET_ADDRESS=0x5400000
+ ;;
+ 'c3_aw402')
+ RTOS_TARGET_ADDRESS=0x3000000
+ ;;
+ *)
+ RTOS_TARGET_ADDRESS=0x9000000
+ ;;
+ esac
+fi
+
+#Get the loading address of rtos2
+let "RTOS2_TARGET_ADDRESS=$RTOS_TARGET_ADDRESS+0x200000"
+RTOS2_TARGET_ADDRESS=$(printf '0x%x\n' $RTOS2_TARGET_ADDRESS)
+
#Clear cache files
[ -d $RTOS_BASE_DIR/output ] && rm -rf $RTOS_BASE_DIR/output
@@ -49,16 +71,28 @@
RTOS_IMAGE_A=$RTOS_BUILD_DIR/rtos_1.bin
RTOS_IMAGE_B=$RTOS_BUILD_DIR/rtos_2.bin
+function toolchain_prepare() {
+ echo "<============ TOOLCHAIN INFO RTOS ============>"
+ CROSSTOOL=$RTOS_BASE_DIR/arch/$ARCH/toolchain/$COMPILER*$TOOLCHAIN_KEYWORD
+ rm -rf $RTOS_BASE_DIR/output/toolchains
+ mkdir $RTOS_BASE_DIR/output/toolchains
+ tar -xf $CROSSTOOL.tar.xz -C $RTOS_BASE_DIR/output/toolchains --strip-components=1
+ ls -la $RTOS_BASE_DIR/output/toolchains/bin
+ $RTOS_BASE_DIR/output/toolchains/bin/aarch64-none-elf-gcc -v
+ echo "<============ TOOLCHAIN INFO RTOS ============>"
+}
+
+function rtos_config_prepare() {
+ CONFIG_FILE=$RTOS_BASE_DIR/boards/$ARCH/$BOARD/lscript.h
+ sed -i '/.*#define configTEXT_BASE*/c\#define configTEXT_BASE '${RTOS_TARGET_ADDRESS}'' $CONFIG_FILE
+ sed -i '/.*#define CONFIG_SCATTER_LOAD_ADDRESS*/c\#define CONFIG_SCATTER_LOAD_ADDRESS '${RTOS2_TARGET_ADDRESS}'' $CONFIG_FILE
+}
+
function lz4_rtos() {
pushd $RTOS_BASE_DIR/lib/utilities/lz4
cp $RTOS_IMAGE_A .
- if [ "c3_aw409" == $BOARD_TYPE_MAPPING ]; then
- ./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j 0x05400000 -d 0
- elif [ "c3_aw402" == $BOARD_TYPE_MAPPING ]; then
- ./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j 0x05400000 -d 0
- else
- ./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j 0x09000000 -d 0
- fi
+ #Get the rtos target address
+ ./self_decompress_tool.sh -a ./self_decompress_head.bin -b ./rtos_1.bin -l 0x04c00000 -j $RTOS_TARGET_ADDRESS -d 0 -s $RTOS2_TARGET_ADDRESS
cp ./self_decompress_firmware.bin $RTOS_IMAGE_A
popd
}
@@ -67,7 +101,7 @@
if [ -d $BL22_DIR ]; then
pushd $BL22_DIR
if [ -f ./mk ]; then
- ./mk c3
+ ./mk c3 $BOARD_TYPE
fi
cp ./bl22.bin $RTOS_BUILD_DIR/bl22.bin
popd
@@ -102,17 +136,11 @@
echo "<============ JENKINS FOR RTOS ============>"
}
-function toolchain_prepare() {
- echo "<============ TOOLCHAIN INFO RTOS ============>"
- CROSSTOOL=$RTOS_BASE_DIR/arch/$ARCH/toolchain/$COMPILER*$TOOLCHAIN_KEYWORD
- rm -rf $RTOS_BASE_DIR/output/toolchains
- mkdir $RTOS_BASE_DIR/output/toolchains
- tar -xf $CROSSTOOL.tar.xz -C $RTOS_BASE_DIR/output/toolchains --strip-components=1
- ls -la $RTOS_BASE_DIR/output/toolchains/bin
- $RTOS_BASE_DIR/output/toolchains/bin/aarch64-none-elf-gcc -v
- echo "<============ TOOLCHAIN INFO RTOS ============>"
-}
-
+#Configure the RTOS environment
+if [ $4 ] && [[ "$4" =~ ^0x.* ]]; then
+ rtos_config_prepare
+fi
+#Compile toolchain preparation
toolchain_prepare
#compile the rtos image
cd $RTOS_BASE_DIR && make scatter