]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wilink8-wlan/build-utilites.git/blobdiff - build_wl18xx.sh
Build wl18xx: copy dtb file to output folder
[wilink8-wlan/build-utilites.git] / build_wl18xx.sh
index 168f420700fa6d0da85a33b0dfb16899ccb3a24d..a3dd9afd449f3d47c21217195bf9aa1f4e0a0a07 100755 (executable)
@@ -19,26 +19,29 @@ function print_highlight()
 function usage ()
 {
     echo ""
-    echo "This script compiles one/all of the following utilities: kernel, libnl, openssl, hostapd, wpa_supplicant,wl18xx_modules,firmware,crda,calibrator"
-    echo "by calling specific utility name and action."
+    echo "This script build all/one of the relevent wl18xx software package."
+    echo "A web guide can be found here : http://processors.wiki.ti.com/index.php/WL18xx_System_Build_Scripts"
     echo ""
-    echo " Usage: ./wl18xx_build.sh init         <head|TAG>  [ Update w/o build        ] "
-    echo "                          update       <head|TAG>  [ Update & build          ] "
-    echo "                          rebuild                  [ Build w/o update        ] "
-    echo "                          clean                    [ Clean, Update & build   ] "
-    echo "                              "
-    echo " Building a specific module usage "
-    echo "       ./build.sh    hostapd "
-    echo "                     wpa_supplicant "
-    echo "                     modules(driver) "
-    echo "                     firmware "
-    echo "                     scripts "
-    echo "                     calibrator "
-    echo "                     wlconf "
-    echo "                     uimage "
-    echo "                     openssl "
-    echo "                     libnl "
-    echo "                     crda "
+    echo "Usage : "
+    echo ""
+    echo "Building full package : "
+    echo "        ./wl18xx_build.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          ] "
+    echo "                          wpa_supplicant           [ Clean & Build wpa_supplicant   ] "
+    echo "                          modules                  [ Clean & Build driver modules   ] "
+    echo "                          firmware                 [ Install firmware file          ] "
+    echo "                          scripts                  [ Install scripts                ] "
+    echo "                          utils                    [ Clean & Build scripts          ] "
+    echo "                          iw                       [ Clean & Build iw               ] "
+    echo "                          openssl                  [ Clean & Build openssll         ] "
+    echo "                          libnl                    [ Clean & Build libnl            ] "
+    echo "                          crda                     [ Clean & Build crda             ] "
 
     exit 1
 }
@@ -109,9 +112,23 @@ function cd_back()
        cd - > /dev/null
 }
 
+function check_for_build_updates()
+{
+        git fetch
+        count=`git status -uno | grep behind | wc -l`
+        if [ $count -ne 0 ]
+        then
+                echo ""
+               echo "*** Please note, there is an updated build script avilalable ***"
+               echo "*** Use 'git pull' to get the latest update. ***" 
+               echo ""
+               sleep 5
+        fi
+}
+
 function read_kernel_version()
 {
-        filename=`repo_path kernel`/Makefile
+        filename=$KERNEL_PATH/Makefile
 
         if [ ! -f $filename ]
         then
@@ -172,7 +189,7 @@ function setup_environment()
        export PKG_CONFIG_PATH=`path filesystem`/lib/pkgconfig
        export INSTALL_PREFIX=`path filesystem`
        export LIBNL_PATH=`repo_path libnl`     
-       export KLIB=${KERNEL_PATH}
+       export KLIB=`path filesystem`
        export KLIB_BUILD=${KERNEL_PATH}
         export GIT_TREE=`repo_path driver`
         export PATH=$TOOLCHAIN_PATH:$PATH
@@ -264,10 +281,14 @@ function build_uimage()
     else
         if [ -z $NO_DTB ] 
         then
-            make -j${PROCESSORS_NUMBER} uImage
+            make -j${PROCESSORS_NUMBER} zImage
             make -j${PROCESSORS_NUMBER} am335x-evm.dtb
+            make -j${PROCESSORS_NUMBER} am335x-bone.dtb
+            make -j${PROCESSORS_NUMBER} am335x-boneblack.dtb
+           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/am335x-evm.dtb `path tftp`/am335x-evm.dtb
+            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
@@ -286,20 +307,19 @@ function generate_compat()
 
 function build_modules()
 {
-    generate_compat
+       generate_compat
        cd_repo compat_wireless
        if [ -z $NO_CLEAN ]; then
                make clean
        fi
        make defconfig-wl18xx
-    make -j${PROCESSORS_NUMBER} 
+       make -j${PROCESSORS_NUMBER}
        assert_no_error
-       find . -name \*.ko -exec cp {} `path debugging`/ \;
+       #find . -name \*.ko -exec cp {} `path debugging`/ \;
        find . -name \*.ko -exec ${CROSS_COMPILE}strip -g {} \;
     
-       make -C ${KERNEL_PATH} M=`pwd` "INSTALL_MOD_PATH=`path filesystem`" modules_install
+       make  modules_install
        assert_no_error
-       #chmod -R 0777 ${PATH__FILESYSTEM}/lib/modules/
        cd_back
 }
 
@@ -316,12 +336,24 @@ function build_openssl()
        cd_back
 }
 
+
+function build_iw()
+{
+       cd_repo iw
+       [ -z $NO_CLEAN ] && make clean
+       [ -z $NO_CLEAN ] && assert_no_error
+       CC=${CROSS_COMPILE}gcc LIBS+=" -lpthread -lm" make V=1
+       assert_no_error
+       DESTDIR=`path filesystem` make install
+       assert_no_error
+       cd_back
+}
 function build_libnl()
 {
        cd_repo libnl
        [ -z $NO_CONFIG ] && ./autogen.sh
        [ -z $NO_CONFIG ] && ./configure --prefix=`path filesystem` --host=${ARCH} CC=${CROSS_COMPILE}gcc AR=${CROSS_COMPILE}ar
-       [ -z $NO_CLEAN ] && make clean
+       ([ -z $NO_CONFIG ] || [ -z $NO_CLEAN ]) && make clean
        [ -z $NO_CLEAN ] && assert_no_error
        make
        assert_no_error
@@ -334,6 +366,7 @@ function build_wpa_supplicant()
 {
        cd `repo_path hostap`/wpa_supplicant
        [ -z $NO_CONFIG ] && cp android.config .config
+    [ -n "$SYSLOG_EN" ] && echo "Enable DEBUG_SYSLOG config" && sed -i "/#CONFIG_DEBUG_SYSLOG=y/ s/# *//" .config
        CONFIG_LIBNL32=y DESTDIR=`path filesystem` make clean
        assert_no_error
        CONFIG_LIBNL32=y DESTDIR=`path filesystem` CFLAGS+="-I`path filesystem`/usr/local/ssl/include -I`repo_path libnl`/include" LIBS+="-L`path filesystem`/lib -L`path filesystem`/usr/local/ssl/lib -lssl -lcrypto -lm -ldl -lpthread" LIBS_p+="-L`path filesystem`/lib -L`path filesystem`/usr/local/ssl/lib -lssl -lcrypto -lm -ldl -lpthread" make -j${PROCESSORS_NUMBER} CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar
@@ -345,9 +378,10 @@ 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
        CONFIG_LIBNL32=y DESTDIR=`path filesystem` make clean
        assert_no_error
        CONFIG_LIBNL32=y DESTDIR=`path filesystem` CFLAGS+="-I`path filesystem`/usr/local/ssl/include -I`repo_path libnl`/include" LIBS+="-L`path filesystem`/lib -L`path filesystem`/usr/local/ssl/lib -lssl -lcrypto -lm -ldl -lpthread" LIBS_p+="-L`path filesystem`/lib -L`path filesystem`/usr/local/ssl/lib -lssl -lcrypto -lm -ldl -lpthread" make -j${PROCESSORS_NUMBER} CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar
@@ -405,6 +439,7 @@ function build_wlconf()
        chmod 755 `path filesystem`/usr/sbin/wlconf
        for file_to_copy in $files_to_copy; do
                cp $file_to_copy `path filesystem`/usr/sbin/wlconf/$file_to_copy
+               echo "echoying files $file_to_copy"
        done
        cp official_inis/* `path filesystem`/usr/sbin/wlconf/official_inis/
        cd_back
@@ -431,18 +466,19 @@ function build_scripts_download()
 
 function clean_kernel()
 {
-       echo "Cleaning kernel folder"
-       cd_repo kernel
-       git clean -fdx > /dev/null      
+       [ "$DEFAULT_KERNEL" ] && echo "Cleaning kernel folder"
+       [ "$DEFAULT_KERNEL" ] && cd_repo kernel
+       [ "$DEFAULT_KERNEL" ] && git clean -fdx > /dev/null
 }
 
 function clean_outputs()
 {
-       echo "Cleaning outputs"   
-    rm -rf `path filesystem`/*
-    rm -f `path outputs`/${tar_filesystem[0]}
-       rm -f `path outputs`/uImage
-       
+    if [[ "$ROOTFS" == "DEFAULT" ]]
+    then
+        echo "Cleaning outputs"
+        rm -rf `path filesystem`/*
+        rm -f `path outputs`/*
+   fi
 }
 
 function build_outputs()
@@ -461,7 +497,7 @@ function build_outputs()
             if [ -z $NO_DTB ]
             then
                 cp `path tftp`/zImage `path outputs`/zImage
-                cp `path tftp`/am335x-evm.dtb `path outputs`/am335x-evm.dtb
+                cp `path tftp`/*.dtb `path outputs`/*.dtb
             else
                 cp `path tftp`/uImage `path outputs`/uImage
             fi
@@ -516,11 +552,11 @@ function set_files_to_verify()
         `repo_path fw_download`/wl18xx-fw-4.bin
         "data"
 
-        `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/extra/drivers/net/wireless/ti/wl18xx/wl18xx.ko
+        `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/updates/drivers/net/wireless/ti/wl18xx/wl18xx.ko
         `path compat_wireless`/drivers/net/wireless/ti/wl18xx/wl18xx.ko
         "ELF 32-bit LSB relocatable, ARM"
 
-        `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/extra/drivers/net/wireless/ti/wlcore/wlcore.ko
+        `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/updates/drivers/net/wireless/ti/wlcore/wlcore.ko
         `path compat_wireless`/drivers/net/wireless/ti/wlcore/wlcore.ko
         "ELF 32-bit LSB relocatable, ARM"
 
@@ -618,11 +654,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 !( hash ${apps_to_verify[i]} 2>/dev/null; )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   
 }
@@ -641,6 +703,7 @@ function build_all()
     if [ -z $NO_TI ] 
     then
         build_modules
+        build_iw
         build_wpa_supplicant
         build_hostapd  
         build_calibrator
@@ -661,29 +724,11 @@ function setup_and_build()
 function main()
 {
        [[ "$1" == "-h" || "$1" == "--help"  ]] && usage
-
     setup_environment
     setup_directories
     read_kernel_version
     
        case "$1" in
-               'update')                
-        print_highlight " setting up workspace and building all "       
-               if [  -n "$2" ]
-        then
-            print_highlight "Using tag $2 " 
-            USE_TAG=$2
-        else
-            print_highlight "Updating all to head (this will revert local changes)" 
-            RESET=1    
-        fi
-        clean_kernel
-        clean_outputs        
-        setup_workspace
-        read_kernel_version #####read kernel version again after update#####
-        build_all
-               ;;
-        
         'init')                
         print_highlight " initializing workspace (w/o build) "       
                [[  -n "$2" ]] && echo "Using tag $2 " && USE_TAG=$2                
@@ -699,22 +744,40 @@ function main()
         build_all        
                ;;
 
-               'rebuild')
-        print_highlight " building all (w/o clean) "       
-               NO_CLEAN=1 build_all
+        'update')
+        print_highlight " setting up workspace and building all "
+               if [  -n "$2" ]
+        then
+            print_highlight "Using tag $2 "
+            USE_TAG=$2
+        else
+            print_highlight "Updating all to head (this will revert local changes)"
+            RESET=1
+        fi
+        #clean_kernel
+        clean_outputs
+        setup_workspace
+        read_kernel_version #####read kernel version again after update#####
+        build_all
                ;;
         
                'openlink')
         print_highlight " building all (w/o clean) "       
                NO_EXTERNAL=1 setup_and_build
                ;;
+
         #################### Building single components #############################
                'kernel')
                print_highlight " building only Kernel "
-                clean_kernel
+                #clean_kernel
                build_uimage
                ;;
-
+               
+                'kernel_modules')
+        print_highlight " building only Driver modules "
+                build_uimage
+               build_modules
+                ;;
                'modules')
         print_highlight " building only Driver modules "
                build_modules
@@ -735,16 +798,35 @@ function main()
                build_crda
                ;;
         
-        'scripts')
-        print_highlight " Copying scripts "
+               'libnl')
+               print_highlight " building only libnl"
+               build_libnl
+               ;;
+
+               'iw')
+               print_highlight " building only iw"
+               build_iw
+               ;;
+
+               'openssl')
+               print_highlight " building only openssl"
+               build_openssl
+               ;;
+
+               'scripts')
+               print_highlight " Copying scripts "
                build_scripts_download
                ;;
                
-        'utils')
-        print_highlight " building only ti-utils "
-        build_calibrator
-        build_wlconf           
+               'utils')
+               print_highlight " building only ti-utils "
+               build_calibrator
+               build_wlconf            
                ;;        
+               'firmware')
+                print_highlight " building only firmware"
+                build_fw_download
+                ;;
         ############################################################
         'get_tag')
         get_tag
@@ -754,12 +836,22 @@ 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
         NO_CLEAN=1 build_all
                ;;
+
+        *)
+        echo " "
+        echo "**** Unknown parameter - please see usage below **** "
+        usage
+        ;;
        esac
        
        [[ -z $NO_BUILD ]] && build_outputs