19
19
# Example:
20
20
# CONFIG_AD5064=y
21
21
#
22
+ # If the option is required on all architectures, add it to the common section;
23
+ # if the option is only relevant to a specific architecture, add it to the
24
+ # section of the corresponding architecture.
22
25
23
26
# Configuration file to change
24
27
ARCH=amd64
@@ -29,39 +32,58 @@ case "$ARCH" in
29
32
amd64)
30
33
CONFIG_FILE_LOC=debian/build/build_amd64_none_amd64
31
34
;;
35
+ arm64)
36
+ CONFIG_FILE_LOC=debian/build/build_arm64_none_arm64
37
+ ;;
38
+ armhf)
39
+ CONFIG_FILE_LOC=debian/build/build_armhf_none_armmp
40
+ ;;
32
41
* )
33
42
CONFIG_FILE_LOC=debian/build/build_amd64_none_amd64
34
43
;;
35
44
esac
36
45
CONFIG_FILE=${CONFIG_FILE_LOC} /.config
37
46
47
+ function get_section_opts(){
48
+ file=$1
49
+ for(( i= 2 ;i<= $# ;i++ )) ; do
50
+ eval section=\$ $i
51
+ opts+=$( sed -n ' /^\[' ${section} ' \]/, /^\[.*\]/p' ${file} | grep -Ev ' \[.*\]|^$|[#;]' )
52
+ opts+=$' \n '
53
+ done
54
+ echo " $opts "
55
+ }
56
+
38
57
ret=0
39
- if [ -e ../patch/kconfig-exclusions -o -e ../patch/kconfig-inclusions ];
40
- then
58
+ exclusion_file=" ../patch/kconfig-exclusions"
59
+ inclusion_file=" ../patch/kconfig-inclusions"
60
+ if [ -e ${exclusion_file} -o -e ${inclusion_file} ]; then
41
61
42
62
# Process any exclusions in the kernel
43
- if [ -f ../patch/kconfig-exclusions ]; then
63
+ if [ -f ${exclusion_file} ]; then
64
+ exclusion_opts=$( get_section_opts ${exclusion_file} " common" ${ARCH} )
44
65
while read -r opt; do
45
66
if [ ! -z " $opt " ] && [[ ! " $opt " =~ ^# .* ]]; then
46
67
scripts/config --file ${CONFIG_FILE} -d $opt
47
68
fi
48
- done < ../patch/kconfig-exclusions ;
69
+ done <<< ${exclusion_opts} ;
49
70
fi
50
71
51
72
# Process any inclusions in the kernel
52
- if [ -f ../patch/kconfig-inclusions ]; then
73
+ if [ -f ${inclusion_file} ]; then
74
+ inclusion_opts=$( get_section_opts ${inclusion_file} " common" ${ARCH} )
53
75
while read -r opt; do
54
76
if [ ! -z " $opt " ] && [[ ! " $opt " =~ ^# .* ]]; then
55
77
echo $opt >> ${CONFIG_FILE}
56
78
fi
57
- done < ../patch/kconfig-inclusions ;
79
+ done <<< ${inclusion_opts} ;
58
80
fi
59
81
60
82
# Update the .config file to be sure it's consistent
61
83
make -C ${CONFIG_FILE_LOC} olddefconfig
62
84
63
85
# Verify that the kernel options we want to remove are not in the updated configuration
64
- if [ -f ../patch/kconfig-exclusions ]; then
86
+ if [ -f ${exclusion_file} ]; then
65
87
echo
66
88
echo " Checking removed kernel options..."
67
89
while read -r opt; do
72
94
echo " Option $opt should not be set, but is set to [$s ]"
73
95
fi
74
96
fi
75
- done < ../patch/kconfig-exclusions ;
97
+ done <<< ${exclusion_opts} ;
76
98
if [ $ret = 0 ]; then
77
99
echo " No error"
78
100
fi
79
101
fi
80
102
81
103
# Verify that the kernel options we want to add are now in the updated configuration
82
- if [ -f ../patch/kconfig-inclusions ]; then
104
+ if [ -f ${inclusion_file} ]; then
83
105
echo
84
106
echo " Checking added kernel options..."
85
107
while read -r opt; do
92
114
echo " Option $n should be set to [$v ] instead of [$s ]"
93
115
fi
94
116
fi
95
- done < ../patch/kconfig-inclusions ;
117
+ done <<< ${inclusion_opts} ;
96
118
if [ ! $ret = 2 ]; then
97
119
echo " No error"
98
120
fi
0 commit comments