| #!/bin/bash |
| |
| copy_rename_files() { |
| OUTDIR=$1 |
| OUTSUBDIR=$2 |
| COPY_FILE_LIST=$3 |
| RENAME_FILE_LIST=$4 |
| |
| for file in $COPY_FILE_LIST |
| do |
| if [ -e $OUTDIR/$file ]; then |
| cp -f $OUTDIR/$file $OUTSUBDIR/ |
| else |
| echo "[MODULE GEN] $file not exist!" |
| fi |
| done |
| for file in $RENAME_FILE_LIST |
| do |
| if [ "$file" = "BOOTLOADER" ]; then |
| name=`cd $OUTDIR; ls *.bin | grep -v _ext | grep $file` |
| if [ "$name" != "" ]; then |
| cp -f $OUTDIR/$name $OUTSUBDIR/bootloader.bin |
| else |
| echo "[MODULE GEN] $file not exist!" |
| fi |
| fi |
| if [ "$file" = "MDBIN" ]; then |
| name=`cd $OUTDIR; ls *.bin | grep "^MT" | grep $file` |
| if [ "$name" != "" ]; then |
| cp -f $OUTDIR/$name $OUTSUBDIR/md.bin |
| else |
| echo "[MODULE GEN] $file not exist!" |
| fi |
| fi |
| if [ "$file" = "DSP" ]; then |
| name=`cd $OUTDIR; ls *.bin | grep "^MT" | grep $file` |
| if [ "$name" != "" ]; then |
| cp -f $OUTDIR/$name $OUTSUBDIR/dsp.bin |
| else |
| echo "[MODULE GEN] $file not exist!" |
| fi |
| fi |
| if [ "$file" = "BPLGUInfo" ]; then |
| name=`cd $OUTDIR; ls | grep -v _sec | grep "^$file"` |
| if [ "$name" != "" ]; then |
| cp -f $OUTDIR/$name $OUTSUBDIR/modem.database |
| else |
| echo "[MODULE GEN] $file not exist!" |
| fi |
| fi |
| done |
| } |
| |
| gen_general_setting() { |
| cat << EOF |
| ############################################################################################################ |
| # |
| # General Setting |
| # |
| ############################################################################################################ |
| |
| general: |
| config_version : alpha # config file version ("alpha", "beta" is used before SQC done.) |
| # After SQC done, the version should be "1" for the first release version. |
| platform: $1 # It is used for tool to identify the right setting for specific target |
| EOF |
| echo "" |
| } |
| |
| gen_boot_region_setting() { |
| cat << EOF |
| ############################################################################################################ |
| # |
| # Boot Region Setting |
| # |
| ############################################################################################################ |
| |
| boot_region: |
| alignment: block # block[default], page(NAND:2K/512B, NOR: 1KB, eMMC: 512B, SF: 256B) |
| rom: |
| EOF |
| for i in $* |
| do |
| echo " - file: "$i |
| done |
| echo "" |
| } |
| |
| gen_control_block_region_setting() { |
| cat << EOF |
| ############################################################################################################ |
| # |
| # Control Block Region Setting |
| # |
| ############################################################################################################ |
| |
| control_block_region: |
| rom: |
| EOF |
| echo "" |
| } |
| |
| gen_main_region_setting() { |
| cat << EOF |
| ############################################################################################################ |
| # |
| # Main Region Setting |
| # |
| ############################################################################################################ |
| |
| main_region: |
| alignment: block # block[default], page(NAND:2K/512B, NOR: 1KB, eMMC: 512B, SF: 256B) |
| rom: |
| EOF |
| for i in $* |
| do |
| echo " - file: "$i |
| done |
| echo "" |
| } |
| |
| gen_fs_region_setting() { |
| cat << EOF |
| ############################################################################################################ |
| # |
| # File System Region Setting |
| # |
| ############################################################################################################ |
| |
| file_system_region: |
| rom: |
| EOF |
| echo "" |
| } |
| |
| gen_external_memory_setting() { |
| cat $1 |
| echo "" |
| } |
| |
| gen_nf_fda_cfg() { |
| GEN_FILE=$1 |
| EMI_CFG=$CUSTOMDIR/$TYPE/emi.cfg |
| gen_general_setting $PLATFORM_CHIP >> $GEN_FILE |
| gen_boot_region_setting cmdScript.bin bootloader.bin preloader_gfh.bin >> $GEN_FILE |
| gen_control_block_region_setting >> $GEN_FILE |
| gen_main_region_setting md.bin dsp.bin >> $GEN_FILE |
| gen_fs_region_setting >> $GEN_FILE |
| gen_external_memory_setting $EMI_CFG >> $GEN_FILE |
| } |
| |
| if [ $# -ge 2 ]; then |
| PRJ_FILENAME=$1 |
| OUTFOLDER=$2 |
| else |
| PRJ_FILENAME=`cat build.sdk | grep PRJ_FILENAME | head -n 1 | sed -e 's/\$PRJ_FILENAME=\"//g' -e 's/\";//g'` |
| OUTFOLDER="`pwd`/out" |
| fi |
| CUSTOMDIR="$WORKDIR/custom/$PRJ_FILENAME/build" |
| |
| if [ ! -d $CUSTOMDIR ]; then |
| CUSTOMDIR="`$WORKDIR/custom/DEFAULT/build" |
| fi |
| |
| COPY_FILE_LIST="cmdScript.bin preloader_gfh.bin catcher_filter.bin catcher_filter_ext.bin" |
| RENAME_FILE_LIST="BOOTLOADER MDBIN DSP BPLGUInfo" |
| |
| #for TYPE in nf sf |
| for TYPE in nf |
| do |
| rm -rf $OUTFOLDER/$TYPE |
| mkdir -p $OUTFOLDER/$TYPE |
| copy_rename_files $OUTFOLDER $OUTFOLDER/$TYPE "$COPY_FILE_LIST" "$RENAME_FILE_LIST" |
| perl tools/cfgGen_module.pl $CUSTOMDIR $TYPE $OUTFOLDER |
| |
| CFGS=`ls $OUTFOLDER/$TYPE | grep .cfg` |
| |
| for CFGFILE in $CFGS |
| do |
| if [ "$TYPE" = "nf" ] && [ "$CFGFILE" = "FDA.cfg" ] ; then |
| GEN_FILE=$OUTFOLDER/$TYPE/$PRJ_FILENAME"_FDA.cfg" |
| gen_nf_fda_cfg $GEN_FILE |
| cat $OUTFOLDER/$TYPE/$CFGFILE >> $GEN_FILE |
| rm -f $OUTFOLDER/$TYPE/$CFGFILE |
| fi |
| done |
| done |
| |