configuration : add verification for kernel .config flags
authorYaniv Machani <yanivma@ti.com>
Mon, 16 Feb 2015 14:03:02 +0000 (16:03 +0200)
committerYaniv Machani <yanivma@ti.com>
Mon, 16 Feb 2015 14:05:11 +0000 (16:05 +0200)
Add an automated test to verify the .config contains the
required flags for the basic WLAN build.

For adding enhanced options, please refer to the new script.

verify_kernel_config.sh

Signed-off-by: Yaniv Machani <yanivma@ti.com>
build_wl18xx.sh
verify_kernel_config.sh [new file with mode: 0755]

index 4c40c731b2976bae90dd6637bcef2268475e2879..d92dddf6f951fc28cd8b44a57a93edb712252670 100755 (executable)
@@ -148,6 +148,8 @@ function read_kernel_version()
             KERNEL_SUBLEVEL=$(echo $sublevel|sed 's/[^0-9]//g')
             echo "Makefile was found. Kernel version was set to $KERNEL_VERSION.$KERNEL_PATCHLEVEL.$KERNEL_SUBLEVEL." 
         fi
+
+       ./verify_kernel_config.sh $KERNEL_PATH/.config
 }
 
 #----------------------------------------------------------j
diff --git a/verify_kernel_config.sh b/verify_kernel_config.sh
new file mode 100755 (executable)
index 0000000..8ed7f3e
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+function usage ()
+{
+    echo "Usage: <option=1> `basename $0` <kernel_config_file>"
+       echo "options:"
+       echo "IP_TABLES - add ip tables support"
+       echo "NO_DEVICE_TREE - add support for non device tree compilation"
+       echo "BT_HCI - add support for BT HCI"
+       exit 1
+}
+
+base_config=(
+    CONFIG_WLAN=y
+    CONFIG_WIRELESS=y
+    CONFIG_WIRELESS_EXT=y
+    CONFIG_KEYS=y
+    CONFIG_SECURITY=y
+    CONFIG_CRYPTO=y
+    CONFIG_WIRELESS_EXT=y
+    CONFIG_CRYPTO_ARC4=y
+    CONFIG_CRYPTO_ECB=y
+    CONFIG_CRYPTO_AES=y
+    CONFIG_CRYPTO_MICHAEL_MIC=y
+    CONFIG_CRYPTO_CCM=y
+    CONFIG_RFKILL=y
+    CONFIG_REGULATOR_FIXED_VOLTAGE=y
+    CONFIG_CRC7=y
+    CONFIG_INPUT_UINPUT=y
+)
+
+ip_table_config=(
+    CONFIG_NF_CONNTRACK=y
+    CONFIG_NF_CONNTRACK_IPV4=y
+    CONFIG_IP_NF_IPTABLES=y
+    CONFIG_IP_NF_FILTER=y
+    CONFIG_NF_NAT_IPV4=y
+    CONFIG_IP_NF_TARGET_MASQUERADE=y
+)
+
+no_dt_config=(
+    CONFIG_WL12XX_PLATFORM_DATA=y
+)
+
+bt_hci_config=(
+    CONFIG_ST_HCI=y
+)
+function verify_configuration()
+{
+    conf_list=("${!1}")
+    echo ""
+    echo "Validating kernel .config ($1) "
+    echo ""
+    
+    i="0"
+       while [ $i -lt ${#conf_list[@]} ]; do
+        cat $kernel_config_file 2> /dev/null | grep ${conf_list[i]} > /dev/null 2>&1        
+        STATUS=$?
+        if [ $STATUS  -eq 1 ] ; then
+            echo "Missing - ${conf_list[i]}" 
+            read -p "Do you want to add it [y/n] ? " yn
+            case $yn in
+                [Yy]* ) echo "${conf_list[i]}" >> ${kernel_config_file} && echo "${conf_list[i]} - Was Added!" && echo "";;
+                [Nn]* ) echo "${conf_list[i]} was not added.";;
+                * ) echo "Please answer y or n.";;
+            esac   
+        fi       
+        i=$[$i + 1]
+    done
+    #echo "$1 scan completed"
+}
+
+if [ $# -lt 1 ]
+then
+       usage
+fi
+kernel_config_file=$1
+
+if ! [ -f $kernel_config_file ];
+then
+   echo "Configuration file $kernel_config_file does not exists" 
+   exit 1
+fi
+
+verify_configuration base_config[@]
+[ $IP_TABLES ] && verify_configuration ip_table_config[@]
+[ $NO_DEVICE_TREE ] && verify_configuration no_dt_config[@]
+[ $BT_HCI ] && verify_configuration hci_config[@]
+exit
\ No newline at end of file