blob: 094e610ce4705f0f61d2f1a8aebc069bbfb16329 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#!/bin/bash
2
3
4MOLYCFG=$1
5INS_FILE="EXT_BOOTLOADER"
6GEN_FILE="$MOLYCFG.tmp"
7OPTION_TMP_PATH="$WORKDIR/bootloader_lte/out"
8TMP_FOLDER="$OUTDIR/tmp/$PRJ_FILENAME"
9LOGDIR="$OUTDIR/log"
10NOWDIR="`pwd`"
11
12#Copy again for the new *.cfg file.
13TARGETFOLDER="$WORKDIR/install/$CROSS_PREFIX/out"
14
15if [ $# -ge 2 ]; then
16 PRJ_FILENAME=$2
17else
18 PRJ_FILENAME=`cat build.sdk | grep PRJ_FILENAME | head -n 1 | sed -e 's/\$PRJ_FILENAME=\"//g' -e 's/\";//g'`
19fi
20CUSTOMDIR="$WORKDIR/custom/$PRJ_FILENAME/build"
21CUSSYS_DIR="$WORKDIR/custom/$PRJ_FILENAME/system"
22
23if [ ! -d $CUSTOMDIR ]; then
24 CUSTOMDIR="$WORKDIR/custom/DEFAULT/build"
25fi
26
27if [ "$PLATFORM_CHIP" == "MT6735" ]; then
28perl tools/cfgGen_sp.pl $CUSTOMDIR
29CFGS=`ls $CUSTOMDIR | grep .txt`
30else
31perl tools/cfgGen.pl $CUSTOMDIR
32CFGS=`ls $CUSTOMDIR | grep .cfg`
33fi
34
35cd $TARGETFOLDER
36
37if [ "$PLATFORM_CHIP" != "MT6291" ] && [ "$PLATFORM_CHIP" != "MT6292" ] && [ "$PLATFORM_CHIP" != "MT6293" ] && [ "$PLATFORM_CHIP" != "MT6295" ] && [ "$PLATFORM_CHIP" != "MT6297" ] && [ "$PLATFORM_CHIP" != "MT6298" ]; then
38 if [ "$PLATFORM_CHIP" == "MT6735" ]; then
39 perl $NOWDIR/tools/preCfgGen_sp.pl . $PROJECT_FLAVOR
40 cp $MOLYCFG $GEN_FILE
41 else
42 INS_LINE=`grep -n $INS_FILE $MOLYCFG |awk -F":" '{ print $1 }'`
43 AFTER_INS_LINE=$((`tac $MOLYCFG | grep -n $INS_FILE |awk -F":" '{ print $1 }'` - 1))
44
45 head -n $INS_LINE $MOLYCFG > $GEN_FILE
46 echo " - file: preloader_gfh.bin" >> $GEN_FILE
47 tail -n $AFTER_INS_LINE $MOLYCFG >> $GEN_FILE
48 fi
49else
50 cat "$OPTION_TMP_PATH/~customIncDef.tmp" | sed -e 's|-I\.\/|-I'"$WORKDIR"'\/bootloader_lte\/|g' -e 's|-I\.\.\/|-I'"$WORKDIR"'\/|g' > $OPTION_TMP_PATH/customIncDef.tmp
51 if [ "$PLATFORM_CHIP" == "MT6297" ] || [ "$PLATFORM_CHIP" == "MT6298" ]; then
52 perl $NOWDIR/tools/preCfgGen.pl . `cd $TARGETFOLDER && ls *_BOOTLOADER_*` $CUSTOMDIR/customer_feature_option $CUSSYS_DIR "arm-linux-gcc -mthumb" @ $OPTION_TMP_PATH/customIncDef.tmp $TMP_FOLDER lk_gfh.bin > "$LOGDIR/cfggen.log"
53 else
54 perl $NOWDIR/tools/preCfgGen.pl . `cd $TARGETFOLDER && ls TK6291_BOOTLOADER_*` $CUSTOMDIR/customer_feature_option $CUSSYS_DIR "arm-linux-gcc -mthumb" @ $OPTION_TMP_PATH/customIncDef.tmp $TMP_FOLDER preloader_gfh.bin > "$LOGDIR/cfggen.log"
55 fi
56 cp $MOLYCFG $GEN_FILE
57fi
58
59if [ ! -f $TARGETFOLDER/$MOLYCFG ]; then
60 echo "$TARGETFOLDER/$MOLYCFG not found!"
61 exit 1
62fi
63rm -f $MOLYCFG
64
65for cfgfile in $CFGS
66do
67 if [ "$PLATFORM_CHIP" != "MT6291" ] && [ "$PLATFORM_CHIP" != "MT6292" ] && [ "$PLATFORM_CHIP" != "MT6293" ] && [ "$PLATFORM_CHIP" != "MT6295" ] && [ "$PLATFORM_CHIP" != "MT6297" ] && [ "$PLATFORM_CHIP" != "MT6298" ]; then
68 if [ "$PLATFORM_CHIP" = "MT6735" ]; then
69 cp -f $GEN_FILE "$PLATFORM_CHIP"_$cfgfile
70 cat $CUSTOMDIR/$cfgfile >> "$PLATFORM_CHIP"_$cfgfile
71 else
72 cp -f $GEN_FILE MT6290_$cfgfile
73 cat $CUSTOMDIR/$cfgfile >> MT6290_$cfgfile
74 fi
75 else
76 cp -f $GEN_FILE "$PLATFORM_CHIP"_$cfgfile
77 cat $CUSTOMDIR/$cfgfile >> "$PLATFORM_CHIP"_$cfgfile
78 fi
79done
80
81rm -f $GEN_FILE
82