1919# Example:
2020# CONFIG_AD5064=y
2121#
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.
2225
2326# Configuration file to change
2427ARCH=amd64
@@ -29,39 +32,58 @@ case "$ARCH" in
2932 amd64)
3033 CONFIG_FILE_LOC=debian/build/build_amd64_none_amd64
3134 ;;
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+ ;;
3241 * )
3342 CONFIG_FILE_LOC=debian/build/build_amd64_none_amd64
3443 ;;
3544esac
3645CONFIG_FILE=${CONFIG_FILE_LOC} /.config
3746
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+
3857ret=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
4161
4262 # 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} )
4465 while read -r opt; do
4566 if [ ! -z " $opt " ] && [[ ! " $opt " =~ ^# .* ]]; then
4667 scripts/config --file ${CONFIG_FILE} -d $opt
4768 fi
48- done < ../patch/kconfig-exclusions ;
69+ done <<< ${exclusion_opts} ;
4970 fi
5071
5172 # 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} )
5375 while read -r opt; do
5476 if [ ! -z " $opt " ] && [[ ! " $opt " =~ ^# .* ]]; then
5577 echo $opt >> ${CONFIG_FILE}
5678 fi
57- done < ../patch/kconfig-inclusions ;
79+ done <<< ${inclusion_opts} ;
5880 fi
5981
6082 # Update the .config file to be sure it's consistent
6183 make -C ${CONFIG_FILE_LOC} olddefconfig
6284
6385 # 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
6587 echo
6688 echo " Checking removed kernel options..."
6789 while read -r opt; do
7294 echo " Option $opt should not be set, but is set to [$s ]"
7395 fi
7496 fi
75- done < ../patch/kconfig-exclusions ;
97+ done <<< ${exclusion_opts} ;
7698 if [ $ret = 0 ]; then
7799 echo " No error"
78100 fi
79101 fi
80102
81103 # 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
83105 echo
84106 echo " Checking added kernel options..."
85107 while read -r opt; do
92114 echo " Option $n should be set to [$v ] instead of [$s ]"
93115 fi
94116 fi
95- done < ../patch/kconfig-inclusions ;
117+ done <<< ${inclusion_opts} ;
96118 if [ ! $ret = 2 ]; then
97119 echo " No error"
98120 fi
0 commit comments