summaryrefslogtreecommitdiff
path: root/scripts/sprd_custom_config_kernel.sh
blob: c51b0dfb965a25ff58783b5cca2e6f6e657d69bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash

FN="$2"
if [ -f $FN ];then
	echo -e "==== modify kernel custom configs ===="
	for line in `cat "$FN"`
	do
		head=`expr substr "$line" 1 1`
		if [ "$head" = "#" ]; then
			continue
		fi

		config_head=`expr substr "$line" 1 6`
		if [ "$config_head" = "KERNEL" ]; then
			echo "config kernel" >/dev/null
		else
		#not kernel config,by pass it
			continue
		fi
		line=${line:7}
		value=${line#*=}
		tag=${line%%=*}
		config=${tag:7}
		echo -e $tag"="$value
		value_l=`tr '[A-Z]' '[a-z]' <<<"$value"` #value little

		#is yes or no
		if [ "$value_l" = "y" ]; then
			echo -e "is y"
			#echo -e $config
			./kernel/scripts/config --file $1 -e $config
			continue
		else
			if [ "$value_l" = "yes" ]; then
				echo -e "is yes"
				#echo -e $config
				./kernel/scripts/config --file $1 -e $config
				continue
			fi
		fi

		if [ "$value_l" = "n" ]; then
			echo -e "is n"
			echo -e $config
			./kernel/scripts/config --file $1 -d $config
			continue
		else
			if [ "$value_l" = "no" ]; then
				echo -e "is no"
				echo -e $config
				./kernel/scripts/config --file $1 -d $config
				continue
			fi
		fi

		#is str
		value_f=`expr substr "$value" 1 1`  #value first
		len=${#value}
		value_l=`expr substr "$value" $len 1` #value last
		if [ "$value_f" = "\"" ]; then
			if [ "$value_l" = "\"" ]; then
				str=`expr substr "$value" 2 $[$len-2]`
				echo "is str"
				#echo $config"="$str
				./kernel/scripts/config --file $1 --set-str $config $str
				continue
			fi
			#str may be error,bybass it,config next
			continue
		fi

		#is integer
		#echo $config"="$value
		./kernel/scripts/config --file $1 --set-val $config $value
	done
fi