rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | |
| 4 | MOLYCFG=$1 |
| 5 | INS_FILE="EXT_BOOTLOADER" |
| 6 | GEN_FILE="$MOLYCFG.tmp" |
| 7 | OPTION_TMP_PATH="$WORKDIR/bootloader_lte/out" |
| 8 | TMP_FOLDER="$OUTDIR/tmp/$PRJ_FILENAME" |
| 9 | LOGDIR="$OUTDIR/log" |
| 10 | NOWDIR="`pwd`" |
| 11 | |
| 12 | #Copy again for the new *.cfg file. |
| 13 | TARGETFOLDER="$WORKDIR/install/$CROSS_PREFIX/out" |
| 14 | |
| 15 | if [ $# -ge 2 ]; then |
| 16 | PRJ_FILENAME=$2 |
| 17 | else |
| 18 | PRJ_FILENAME=`cat build.sdk | grep PRJ_FILENAME | head -n 1 | sed -e 's/\$PRJ_FILENAME=\"//g' -e 's/\";//g'` |
| 19 | fi |
| 20 | CUSTOMDIR="$WORKDIR/custom/$PRJ_FILENAME/build" |
| 21 | CUSSYS_DIR="$WORKDIR/custom/$PRJ_FILENAME/system" |
| 22 | |
| 23 | if [ ! -d $CUSTOMDIR ]; then |
| 24 | CUSTOMDIR="$WORKDIR/custom/DEFAULT/build" |
| 25 | fi |
| 26 | |
| 27 | if [ "$PLATFORM_CHIP" == "MT6735" ]; then |
| 28 | perl tools/cfgGen_sp.pl $CUSTOMDIR |
| 29 | CFGS=`ls $CUSTOMDIR | grep .txt` |
| 30 | else |
| 31 | perl tools/cfgGen.pl $CUSTOMDIR |
| 32 | CFGS=`ls $CUSTOMDIR | grep .cfg` |
| 33 | fi |
| 34 | |
| 35 | cd $TARGETFOLDER |
| 36 | |
| 37 | if [ "$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 |
| 49 | else |
| 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 |
| 57 | fi |
| 58 | |
| 59 | if [ ! -f $TARGETFOLDER/$MOLYCFG ]; then |
| 60 | echo "$TARGETFOLDER/$MOLYCFG not found!" |
| 61 | exit 1 |
| 62 | fi |
| 63 | rm -f $MOLYCFG |
| 64 | |
| 65 | for cfgfile in $CFGS |
| 66 | do |
| 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 |
| 79 | done |
| 80 | |
| 81 | rm -f $GEN_FILE |
| 82 | |