fix gcc6 build error
[profile/mobile/platform/kernel/u-boot-tm1.git] / sprd_custom_config_uboot.sh
1 #!/bin/bash
2
3 FN="$2"
4 if [ -f $FN ];then
5         echo -e "==== modify u-boot custom configs ===="
6         for line in `cat "$FN"`
7         do
8                 head=`expr substr "$line" 1 1`
9                 if [ "$head" = "#" ]; then
10                         continue
11                 fi
12
13                 config_head=`expr substr "$line" 1 6`
14                 if [ "$config_head" = "U-BOOT" ]; then
15                         echo "config u-boot" >/dev/null
16                 else
17                 #not u-boot config,by pass it
18                         continue
19                 fi
20                 line=${line:7}
21                 value=${line#*=}
22                 tag=${line%%=*}
23                 config=$tag
24                 echo -e $tag"="$value
25                 value_l=`tr '[A-Z]' '[a-z]' <<<"$value"` #value little
26                 #is yes or no
27                 if [ "$value_l" = "y" ]; then
28                         echo -e "is y"
29                         echo "#define $config" >> $1
30                         continue
31                 else
32                         if [ "$value_l" = "yes" ]; then
33                                 echo -e "is yes"
34                                 echo "#define $config" >> $1
35                                 continue
36                         fi
37                 fi
38                 if [ "$value_l" = "n" ]; then
39                         echo -e "is n"
40                         echo "#undef $config" >> $1
41                         continue
42                 else
43                         if [ "$value_l" = "no" ]; then
44                                 echo -e "is no"
45                                 echo "#undef $config" >> $1
46                                 continue
47                         fi
48                 fi
49
50                 #is str
51                 value_f=`expr substr "$value" 1 1`  #value first
52                 len=${#value}
53                 value_l=`expr substr "$value" $len 1` #value last
54                 if [ "$value_f" = "\"" ]; then
55                         if [ "$value_l" = "\"" ]; then
56                                 echo "is str"
57                                 echo "#define $config $value" >> $1
58                                 continue
59                         fi
60                         #str may be error,bybass it,config next
61                         continue
62                 fi
63
64                 echo "is integer"
65                 echo "#define $config $value" >> $1
66         done
67 fi