Xiaobo Gu | d935a95 | 2017-06-13 15:20:20 +0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | #------------IMPORTANT------------# |
| 4 | #--RUN THIS SCRIPT BEFOR COMMIT---# |
| 5 | #---------------------------------# |
| 6 | |
| 7 | # Author: xiaobo.gu@amlogic.com |
| 8 | # Init version: 20160329 |
| 9 | # Update for bootloader.repo: 2017.01.01 |
| 10 | |
| 11 | #usage: |
| 12 | # |
| 13 | #./check_compile.sh -check amlogic board configs |
| 14 | #./check_compile.sh cus -check customer board configs |
| 15 | #./check_compile.sh all -check both amlogic and customer boards |
| 16 | |
| 17 | function check_compile() { |
| 18 | # $1: filter |
| 19 | folder_board="bl33/board/amlogic" |
| 20 | customer_folder="bl33/customer/board" |
| 21 | |
| 22 | echo "************** Amlogic Compile Check Tool **************" |
| 23 | |
| 24 | # filters define: |
| 25 | # cus: all customer board |
| 26 | # all: all boards |
| 27 | # other: |
| 28 | # gxb: all gxbaby board |
| 29 | # gxtvbb: all gxtvbb board |
| 30 | # skt: all socket board |
| 31 | # p200: p200 board |
| 32 | # etc..... |
| 33 | declare filter="$1" |
| 34 | |
| 35 | # ARRAY_CFG store config names |
| 36 | declare -a ARRAY_CFG |
| 37 | declare -a ARRAY_CFG_C |
| 38 | # TOTAL_CFG store config total num |
| 39 | declare -i TOTAL_CFG |
| 40 | declare -i TOTAL_CFG_C |
| 41 | |
| 42 | # if filter!=cus, then include amlogic configs |
| 43 | # get all configs name from board folder |
| 44 | if [ "$1" != "cus" ] |
| 45 | then |
| 46 | filter=$1 |
| 47 | for file in ${folder_board}/*; do |
| 48 | temp_file=`basename $file` |
| 49 | #echo "$temp_file" |
| 50 | if [ -d ${folder_board}/${temp_file} ] && [ "$temp_file" != "defconfigs" ] && [ "$temp_file" != "configs" ];then |
| 51 | #echo " \c" |
| 52 | #echo $temp_file |
| 53 | ARRAY_CFG[$TOTAL_CFG]=$temp_file |
| 54 | TOTAL_CFG=$TOTAL_CFG+1 |
| 55 | fi |
| 56 | done |
| 57 | fi |
| 58 | |
| 59 | # if filter==all || filter==cus, then include customer configs |
| 60 | # get all customer configs name from customer board folder |
| 61 | if [ "$1" == "cus" ] || [ "$1" == "all" ] |
| 62 | then |
| 63 | filter="" |
| 64 | if [ -e ${customer_folder} ];then |
| 65 | for file in ${customer_folder}/*; do |
| 66 | temp_file=`basename $file` |
| 67 | if [ -d ${customer_folder}/${temp_file} ] && [ "$temp_file" != "defconfigs" ] && [ "$temp_file" != "configs" ];then |
| 68 | #echo " \c" |
| 69 | #echo $temp_file |
| 70 | ARRAY_CFG_C[$TOTAL_CFG_C]=$temp_file |
| 71 | TOTAL_CFG_C=$TOTAL_CFG_C+1 |
| 72 | fi |
| 73 | done |
| 74 | fi |
| 75 | fi |
| 76 | |
| 77 | echo "************************ START *************************" |
| 78 | |
| 79 | # compile check start |
| 80 | # RESULT store compile result |
| 81 | declare RESULT="" |
| 82 | declare -i LOOP_NUM=0 |
| 83 | # counter variables |
| 84 | declare -i PASS_COUNTER=0 |
| 85 | declare -i FAIL_COUNTER=0 |
| 86 | |
| 87 | # print bar and alignment |
| 88 | declare -i BAR_TOTAL=30 |
| 89 | declare -i BAR_LOOP |
| 90 | |
| 91 | RESULT=$RESULT"########### Compile Check Result ###########\n" |
| 92 | |
| 93 | if [ "$1" != "cus" ] |
| 94 | then |
| 95 | RESULT=$RESULT"--------------------------------------------\n" |
| 96 | RESULT=$RESULT"############## Amlogic Boards ##############\n" |
| 97 | # loop all cfgs |
| 98 | for cfg in ${ARRAY_CFG[@]} |
| 99 | do |
| 100 | # find filter in config name |
| 101 | if [[ $(echo $cfg | grep "${filter}") == "" ]] |
| 102 | then |
| 103 | # skip !filter configs |
| 104 | continue |
| 105 | fi |
| 106 | LOOP_NUM=$LOOP_NUM+1 |
| 107 | RESULT=$RESULT' ' |
| 108 | # print '0' charactors for alignment |
| 109 | BAR_LOOP=3-`expr length $LOOP_NUM` |
| 110 | if [ "$BAR_LOOP" -gt "0" ] |
| 111 | then |
| 112 | for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'0';done |
| 113 | fi |
| 114 | RESULT=$RESULT$LOOP_NUM' ' |
| 115 | RESULT=$RESULT$cfg' ' |
| 116 | # print '-' charactors for alignment |
| 117 | BAR_LOOP=BAR_TOTAL-`expr length $cfg` |
| 118 | if [ "$BAR_LOOP" -gt "0" ] |
| 119 | then |
| 120 | for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'-';done |
| 121 | fi |
| 122 | # compile |
| 123 | #make distclean |
| 124 | #make $cfg'_defconfig' |
| 125 | #make -j |
| 126 | fip/mk_script.sh $cfg |
| 127 | # check last 'make -j' result |
| 128 | if [ $? != 0 ] |
| 129 | then |
| 130 | RESULT=$RESULT'- failed\n' |
| 131 | FAIL_COUNTER=$FAIL_COUNTER+1 |
| 132 | else |
| 133 | RESULT=$RESULT'- pass\n' |
| 134 | PASS_COUNTER=$PASS_COUNTER+1 |
| 135 | fi |
| 136 | # print result |
| 137 | echo -e $RESULT |
| 138 | #echo $cfg |
| 139 | done |
| 140 | fi |
| 141 | |
| 142 | # check customer configs |
| 143 | if [ "$1" == "cus" ] || [ "$1" == "all" ] |
| 144 | then |
| 145 | RESULT=$RESULT"--------------------------------------------\n" |
| 146 | RESULT=$RESULT"############## Customer Boards #############\n" |
| 147 | for cfg in ${ARRAY_CFG_C[@]} |
| 148 | do |
| 149 | LOOP_NUM=$LOOP_NUM+1 |
| 150 | RESULT=$RESULT' ' |
| 151 | BAR_LOOP=3-`expr length $LOOP_NUM` |
| 152 | if [ "$BAR_LOOP" -gt "0" ] |
| 153 | then |
| 154 | for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'0';done |
| 155 | fi |
| 156 | RESULT=$RESULT$LOOP_NUM' ' |
| 157 | RESULT=$RESULT$cfg' ' |
| 158 | BAR_LOOP=BAR_TOTAL-`expr length $cfg` |
| 159 | if [ "$BAR_LOOP" -gt "0" ] |
| 160 | then |
| 161 | for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'-';done |
| 162 | fi |
| 163 | make distclean |
| 164 | make $cfg'_defconfig' |
| 165 | make -j |
| 166 | if [ $? != 0 ] |
| 167 | then |
| 168 | RESULT=$RESULT'- failed\n' |
| 169 | FAIL_COUNTER=$FAIL_COUNTER+1 |
| 170 | else |
| 171 | RESULT=$RESULT'- pass\n' |
| 172 | PASS_COUNTER=$PASS_COUNTER+1 |
| 173 | fi |
| 174 | echo -e $RESULT |
| 175 | done |
| 176 | fi |
| 177 | |
| 178 | echo -e "#################### END ###################\n" |
| 179 | } |