]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wilink8-wlan/build-utilites.git/blobdiff - build_wl18xx.sh
General bug fixes
[wilink8-wlan/build-utilites.git] / build_wl18xx.sh
index ee6143d9ca7f72c835279131237a4bd023f44568..7148484842a2a97ff4c0f4c398861497af3009bb 100755 (executable)
@@ -25,10 +25,11 @@ function usage ()
     echo "Usage : "
     echo ""
     echo "Building full package : "
-    echo "        ./wl18xx_build.sh init         <head|TAG>  [ Download and Update w/o build  ] "
+    echo "        ./build_wl18xx.sh init         <head|TAG>  [ Download and Update w/o build  ] "
     echo "                          update       <head|TAG>  [ Update to specific TAG & Build ] "
     echo "                          clean                    [ Clean & Build                  ] "
     echo "                          <empty>                  [ Build w/o update               ] "
+    echo "                          check_updates            [ Check for build script updates ] "
     echo ""
     echo "Building specific component :"
     echo "                          hostapd                  [ Clean & Build hostapd          ] "
@@ -113,6 +114,7 @@ function cd_back()
 
 function check_for_build_updates()
 {
+        git fetch
         count=`git status -uno | grep behind | wc -l`
         if [ $count -ne 0 ]
         then
@@ -271,7 +273,7 @@ function build_uimage()
        [ -z $NO_CONFIG ] && cp `path configuration`/kernel_$KERNEL_VERSION.$KERNEL_PATCHLEVEL.config `repo_path kernel`/.config
        [ -z $NO_CLEAN ] && make clean
        [ -z $NO_CLEAN ] && assert_no_error
-       
+
     if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
     then
         make -j${PROCESSORS_NUMBER} uImage
@@ -286,7 +288,7 @@ function build_uimage()
            make -j${PROCESSORS_NUMBER} modules
            INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} modules_install
             cp `repo_path kernel`/arch/arm/boot/zImage `path tftp`/zImage
-            cp `repo_path kernel`/arch/arm/boot/dts/*.dtb `path tftp`/
+            cp `repo_path kernel`/arch/arm/boot/dts/am335x-*.dtb `path tftp`/
         else
             LOADADDR=0x80008000 make -j${PROCESSORS_NUMBER} uImage.am335x-evm 
             cp `repo_path kernel`/arch/arm/boot/uImage.am335x-evm `path tftp`/uImage
@@ -376,7 +378,7 @@ function build_wpa_supplicant()
 }
 
 function build_hostapd()
-{             
+{
     cd `repo_path hostap`/hostapd
        [ -z $NO_CONFIG ] && cp android.config .config
        [ -n "$UPNP_EN" ] && echo "Enable UPNP config" && sed -i "/#CONFIG_WPS_UPNP=y/ s/# *//" .config
@@ -488,18 +490,22 @@ function build_outputs()
         tar cpjf `path outputs`/${tar_filesystem[0]} .
         cd_back
                
-        if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
-        then
-            cp `path tftp`/uImage `path outputs`/uImage
-        else
-            if [ -z $NO_DTB ]
-            then
-                cp `path tftp`/zImage `path outputs`/zImage
-                cp `path tftp`/*.dtb `path outputs`/
-            else
-                cp `path tftp`/uImage `path outputs`/uImage
-            fi
-        fi             
+               # Copy kernel files only if default kernel is used(for now)
+               if [ "$DEFAULT_KERNEL" -eq 1 ]
+               then
+                       if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
+                       then
+                               cp `path tftp`/uImage `path outputs`/uImage
+                       else
+                               if [ -z $NO_DTB ]
+                               then
+                                       cp `path tftp`/zImage `path outputs`/zImage
+                                       cp `path tftp`/*.dtb `path outputs`/*.dtb
+                               else
+                                       cp `path tftp`/uImage `path outputs`/uImage
+                               fi
+                       fi
+               fi
     fi
 }
 
@@ -652,11 +658,37 @@ function verify_skeleton()
        fi
 }
 
+function verify_installs()
+{
+    apps_to_verify=(
+     libtool     
+     python-m2crypto
+     bison
+     flex
+    )
+
+    i="0"
+       while [ $i -lt ${#apps_to_verify[@]} ]; do
+        if !( dpkg-query -s ${apps_to_verify[i]} 2>/dev/null | grep -q ^"Status: install ok installed"$ )then
+            echo  "${apps_to_verify[i]} is missing"
+            echo  "Please use 'sudo apt-get install ${apps_to_verify[i]}'"
+            read -p "Do you want to install it now [y/n] ? (requires sudo) " yn
+            case $yn in
+                [Yy]* )  sudo apt-get install ${apps_to_verify[i]} ;;
+                [Nn]* ) echo -e "${PURPLE}${apps_to_verify[i]} was not installed. leaving build. ${NORMAL} " ; exit 0 ;;
+                * ) echo "Please answer y or n.";;
+            esac
+        fi
+        i=$[$i + 1]
+    done
+}
+
 function setup_workspace()
 {
        setup_directories       
        setup_repositories
        setup_branches
+    verify_installs
     #Download toolchain only if it was not set
     [ DEFAULT_TOOLCHAIN ] && setup_toolchain   
 }
@@ -696,7 +728,6 @@ function setup_and_build()
 function main()
 {
        [[ "$1" == "-h" || "$1" == "--help"  ]] && usage
-    check_for_build_updates
     setup_environment
     setup_directories
     read_kernel_version
@@ -809,7 +840,11 @@ function main()
         'admin_tag')        
                admin_tag $2
                ;;
-        
+
+        'check_updates')
+               check_for_build_updates
+               ;;
+
         '')
         print_highlight " building all (No clean & no source code update) "  
                #clean_outputs