]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wilink8-wlan/build-utilites.git/blobdiff - build_wl18xx.sh
build,configuration updated
[wilink8-wlan/build-utilites.git] / build_wl18xx.sh
index 200636807b4a1456380cdaec100648764854ba52..0a12024cf873a81188cfa996a10a36724cb102e9 100755 (executable)
@@ -42,7 +42,9 @@ function usage ()
     echo "                          openssl                  [ Clean & Build openssll         ] "
     echo "                          libnl                    [ Clean & Build libnl            ] "
     echo "                          crda                     [ Clean & Build crda             ] "
-
+    echo "                          patch_kernel             [ Apply provided kernel patches  ] "
+    echo "                          uim                      [ Clean & Build uim              ] "
+    echo "                          bt-firmware              [ Install Bluetooth init scripts ] "
     exit 1
 }
 
@@ -175,6 +177,7 @@ function setup_environment()
         DEFAULT_TOOLCHAIN=1
     fi   
 
+
     #if no kernel path is set - download it.
     if [[ "$KERNEL_PATH" == "DEFAULT" ]]
     then            
@@ -192,8 +195,8 @@ function setup_environment()
        export LIBNL_PATH=`repo_path libnl`     
        export KLIB=`path filesystem`
        export KLIB_BUILD=${KERNEL_PATH}
-        export GIT_TREE=`repo_path driver`
-        export PATH=$TOOLCHAIN_PATH:$PATH
+       export GIT_TREE=`repo_path driver`
+       export PATH=$TOOLCHAIN_PATH:$PATH
     
 }
 
@@ -201,6 +204,8 @@ function setup_filesystem_skeleton()
 {
        mkdir -p `path filesystem`/usr/bin
        mkdir -p `path filesystem`/etc
+       mkdir -p `path filesystem`/etc/init.d
+       mkdir -p `path filesystem`/etc/rcS.d
        mkdir -p `path filesystem`/usr/lib/crda
        mkdir -p `path filesystem`/lib/firmware/ti-connectivity
        mkdir -p `path filesystem`/usr/share/wl18xx
@@ -268,6 +273,52 @@ function setup_toolchain()
        fi
 }
 
+function build_intree()
+{
+       cd_repo driver
+       export KERNEL_PATH=`repo_path driver`
+       read_kernel_version
+       [ $CONFIG ] && cp `path configuration`/kernel_$KERNEL_VERSION.$KERNEL_PATCHLEVEL.config `repo_path driver`/.config
+       [ $CLEAN ] && make clean
+       [ $CLEAN ] && assert_no_error
+
+       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 driver`/arch/arm/boot/zImage `path tftp`/zImage
+       cp `repo_path driver`/arch/arm/boot/dts/am335x-*.dtb `path tftp`/
+
+       assert_no_error
+
+       [ -e ./outputs/drv_skeleton.tar ] && rm ./outputs/drv_skeleton.tar
+       cd `path filesystem`
+       find ./ -name wl*.ko -exec tar rf ../outputs/drv_skeleton.tar {$1} \;
+       find ./ -name *80211*.ko -exec tar rf ../outputs/drv_skeleton.tar {$1} \;
+
+       cd_back
+}
+
+function rebuild_intree()
+{
+    cd_repo driver
+       export KERNEL_PATH=`repo_path driver`
+
+       INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} M=net/wireless/ modules
+       INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} M=net/wireless/ modules_install
+
+       INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} M=net/mac80211/ modules
+       INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} M=net/mac80211/ modules_install
+
+       INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} M=drivers/net/wireless/ti/ modules
+       INSTALL_MOD_PATH=`path filesystem` make -j${PROCESSORS_NUMBER} M=drivers/net/wireless/ti/ modules_install
+
+       assert_no_error
+       cd_back
+}
+
 function build_uimage()
 {
     cd_repo kernel
@@ -310,6 +361,13 @@ function build_modules()
 {
        generate_compat
        cd_repo compat_wireless
+       if [ -n "$KERNEL_VARIANT" ] && [ -d "$PATH__ROOT/patches/driver_patches/$KERNEL_VARIANT" ]; then
+               for i in $PATH__ROOT/patches/driver_patches/$KERNEL_VARIANT/*.patch; do
+                       print_highlight "Applying driver patch: $i"
+                       patch -p1 < $i;
+                       assert_no_error
+               done
+       fi
        if [ -z $NO_CLEAN ]; then
                make clean
        fi
@@ -382,7 +440,7 @@ 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
+       [ -z $NO_UPNP ] && 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
@@ -396,7 +454,7 @@ function build_hostapd()
 function build_crda()
 {      
        cp `repo_path wireless_regdb`/regulatory.bin `path filesystem`/usr/lib/crda/regulatory.bin
-       cp `repo_path wireless_regdb`/sforshee.key.pub.pem `path filesystem`/etc/wireless-regdb/pubkeys/
+       cp `repo_path crda`/pubkeys/* `path filesystem`/etc/wireless-regdb/pubkeys/
     cd_repo crda
        
        [ -z $NO_CLEAN ] && DESTDIR=`path filesystem` make clean
@@ -408,6 +466,19 @@ function build_crda()
        cd_back
 }
 
+function build_wl_logger()
+{
+       if [ -d "`repo_path ti_utils`/wl_logproxy" ]; then
+               cd `repo_path ti_utils`/wl_logproxy
+               [ -z $NO_CLEAN ] && NFSROOT=`path filesystem` make clean
+               [ -z $NO_CLEAN ] && assert_no_error
+               NLVER=3 NLROOT=`repo_path libnl`/include NFSROOT=`path filesystem` LIBS+=-lpthread make
+               assert_no_error
+               NFSROOT=`path filesystem` make install
+               cd_back
+       fi
+}
+
 function build_calibrator()
 {
        cd_repo ti_utils
@@ -452,6 +523,65 @@ function build_fw_download()
        cp `repo_path fw_download`/*.bin `path filesystem`/lib/firmware/ti-connectivity
 }
 
+function build_fw()
+{
+       cd `repo_path firmware-build`/victoria/firmware
+       [ -z $NO_CLEAN ] && ./build.sh clean
+       ./build.sh
+       cp `repo_path firmware-build`/victoria/firmware/out/Firmware18xx/wl18xx-fw-4.bin `path filesystem`/lib/firmware/ti-connectivity
+       cp `repo_path firmware-build`/victoria/firmware/out/Firmware18xx/wl18xx-fw-4.bin `path outputs`
+       cd_back
+}
+
+
+function patch_kernel()
+{
+       [ ! -d $KERNEL_PATH ] && echo "Error KERNEL_PATH: $KERNEL_PATH dir does not exist" && exit 1
+       cd $KERNEL_PATH
+       echo "using kernel: $KERNEL_PATH"
+       if [ -d "$PATH__ROOT/patches/kernel_patches/$KERNEL_VARIANT" ]; then
+               read -p "Branch name to use? (will be created if doesn't exist)" -e branchname
+               if git show-ref --verify --quiet "refs/heads/$branchname"; then
+                       echo "Branch name $branchname already exists, trying to use it..."
+                       git checkout $branchname
+               else
+                       echo "Creating branch $branchname and switching to it"
+                       git checkout -b $branchname
+               fi
+               assert_no_error
+               for i in $PATH__ROOT/patches/kernel_patches/$KERNEL_VARIANT/*.patch; do
+                       git am $i;
+                       assert_no_error
+               done
+       fi
+       assert_no_error
+       cd_back
+}
+
+function build_uim()
+{
+       cd_repo uim
+       [ -z $NO_CLEAN ] && NFSROOT=`path filesystem` make clean
+       [ -z $NO_CLEAN ] && assert_no_error
+       make CC=${CROSS_COMPILE}gcc
+       assert_no_error
+        install -m 0755 uim `path filesystem`/usr/bin
+       install -m 0755 `repo_path uim`/scripts/uim-sysfs `path filesystem`/etc/init.d/
+       cd `path filesystem`/etc/rcS.d/
+       ln -sf  ../init.d/uim-sysfs S03uim-sysfs
+       assert_no_error
+       cd_back
+}
+
+function build_bt_firmware()
+{
+       cd_repo bt-firmware
+       for i in `repo_path bt-firmware`/initscripts/*.bts; do
+               echo "Installing bluetooth init script: $i"
+               install -m 0755 $i `path filesystem`/lib/firmware/
+               assert_no_error
+       done
+}
 
 function build_scripts_download()
 {
@@ -487,13 +617,13 @@ function build_outputs()
 {
        if [[ "$ROOTFS" == "DEFAULT" ]]
     then  
-        echo "Building outputs"    
+        echo "Building outputs"
         cd_path filesystem
         tar cpjf `path outputs`/${tar_filesystem[0]} .
         cd_back
                
                # Copy kernel files only if default kernel is used(for now)
-               if [ "$DEFAULT_KERNEL" -eq 1 ]
+               if [[ $DEFAULT_KERNEL -eq 1 ]]
                then
                        if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
                        then
@@ -540,15 +670,15 @@ function set_files_to_verify()
 
         `path filesystem`/usr/local/sbin/wpa_supplicant
         `repo_path hostap`/wpa_supplicant/wpa_supplicant
-        "ELF 32-bit LSB executable, ARM"
+        "ELF 32-bit LSB[ ]*executable, ARM"
 
         `path filesystem`/usr/local/bin/hostapd
         `repo_path hostap`/hostapd/hostapd
-        "ELF 32-bit LSB executable, ARM"
+        "ELF 32-bit LSB[ ]*executable, ARM"
 
         `path filesystem`/sbin/crda
         `repo_path crda`/crda
-        "ELF 32-bit LSB executable, ARM"
+        "ELF 32-bit LSB[ ]*executable, ARM"
 
         `path filesystem`/usr/lib/crda/regulatory.bin
         `repo_path wireless_regdb`/regulatory.bin
@@ -560,20 +690,63 @@ function set_files_to_verify()
 
         `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"
+        "ELF 32-bit LSB[ ]*relocatable, ARM"
 
         `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"
+        "ELF 32-bit LSB[ ]*relocatable, ARM"
 
         #`path filesystem`/usr/bin/calibrator
         #`repo_path ti_utils`/calibrator
-        #"ELF 32-bit LSB executable, ARM"
+        #"ELF 32-bit LSB[ ]*executable, ARM"
 
         `path filesystem`/usr/sbin/wlconf/wlconf
         `repo_path ti_utils`/wlconf/wlconf
-        "ELF 32-bit LSB executable, ARM"
+        "ELF 32-bit LSB[ ]*executable, ARM"
         )
+
+               [ $INTREE ] && files_to_verify=(
+        # skeleton path
+        # source path
+        # pattern in output of file
+
+        `path filesystem`/usr/local/sbin/wpa_supplicant
+        `repo_path hostap`/wpa_supplicant/wpa_supplicant
+        "ELF 32-bit LSB[ ]*executable, ARM"
+
+        `path filesystem`/usr/local/bin/hostapd
+        `repo_path hostap`/hostapd/hostapd
+        "ELF 32-bit LSB[ ]*executable, ARM"
+
+        `path filesystem`/sbin/crda
+        `repo_path crda`/crda
+        "ELF 32-bit LSB[ ]*executable, ARM"
+
+        `path filesystem`/usr/lib/crda/regulatory.bin
+        `repo_path wireless_regdb`/regulatory.bin
+        "CRDA wireless regulatory database file"
+
+        `path filesystem`/lib/firmware/ti-connectivity/wl18xx-fw-4.bin
+        `repo_path fw_download`/wl18xx-fw-4.bin
+        "data"
+
+        `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/kernel/drivers/net/wireless/ti/wl18xx/wl18xx.ko
+        `repo_path driver`/drivers/net/wireless/ti/wl18xx/wl18xx.ko
+        "ELF 32-bit LSB[ ]*relocatable, ARM"
+
+        `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/kernel/drivers/net/wireless/ti/wlcore/wlcore.ko
+        `repo_path driver`/drivers/net/wireless/ti/wlcore/wlcore.ko
+        "ELF 32-bit LSB[ ]*relocatable, ARM"
+
+        #`path filesystem`/usr/bin/calibrator
+        #`repo_path ti_utils`/calibrator
+        #"ELF 32-bit LSB[ ]*executable, ARM"
+
+        `path filesystem`/usr/sbin/wlconf/wlconf
+        `repo_path ti_utils`/wlconf/wlconf
+        "ELF 32-bit LSB[ ]*executable, ARM"
+        ) 
+
 }
 
 function get_tag()
@@ -702,7 +875,7 @@ function build_all()
 {
     if [ -z $NO_EXTERNAL ] 
     then        
-        [ $DEFAULT_KERNEL ] && build_uimage
+        [ -z $INTREE ] && [ $DEFAULT_KERNEL ] && build_uimage
         build_openssl
         build_libnl
         build_crda
@@ -710,14 +883,18 @@ function build_all()
     
     if [ -z $NO_TI ] 
     then
-        build_modules
+        [ -z $INTREE ] && build_modules
+               [ $INTREE ] && build_intree
         build_iw
         build_wpa_supplicant
         build_hostapd  
         build_calibrator
+        build_wl_logger
         build_wlconf
         build_fw_download
         build_scripts_download
+        build_uim
+        build_bt_firmware
     fi
     
     [ -z $NO_VERIFY ] && verify_skeleton
@@ -777,15 +954,26 @@ function main()
         #################### Building single components #############################
                'kernel')
                print_highlight " building only Kernel "
-                #clean_kernel
+        #clean_kernel
                build_uimage
                ;;
+
+               'intree')
+               print_highlight " building modules intree"
+               build_intree
+               ;;
                
-                'kernel_modules')
-        print_highlight " building only Driver modules "
-                build_uimage
+               'intree_m')
+               print_highlight " Building JUST wireless modules intree"
+               rebuild_intree
+               ;;
+
+        'kernel_modules')
+        print_highlight " building kernel and driver modules"
+        build_uimage
                build_modules
-                ;;
+               ;;
+
                'modules')
         print_highlight " building only Driver modules "
                build_modules
@@ -802,7 +990,7 @@ function main()
                ;;
 
                'crda')
-        print_highlight " building only CRDA "
+               print_highlight " building only CRDA "
                build_crda
                ;;
         
@@ -825,16 +1013,39 @@ function main()
                print_highlight " Copying scripts "
                build_scripts_download
                ;;
-               
+
                'utils')
                print_highlight " building only ti-utils "
                build_calibrator
+               build_wl_logger
                build_wlconf            
-               ;;        
+               ;;
+
                'firmware')
-                print_highlight " building only firmware"
-                build_fw_download
-                ;;
+               print_highlight " building only firmware"
+               build_fw_download
+               ;;
+
+               'fw')
+               print_highlight " building only firmware"
+               build_fw
+               ;;
+
+               'patch_kernel')
+               print_highlight " only patching kernel $2 without performing an actual build!"
+               NO_BUILD=1
+               patch_kernel
+               ;;
+
+               'uim')
+               print_highlight " building only uim "
+               build_uim
+               ;;
+
+               'bt-firmware')
+               print_highlight " Only installing bluetooth init scripts "
+               build_bt_firmware
+               ;;
         ############################################################
         'get_tag')
         get_tag
@@ -855,6 +1066,11 @@ function main()
         NO_CLEAN=1 build_all
                ;;
 
+               'all_intree')
+        print_highlight " building all (in-tree) (No clean & no source code update) "
+               #clean_outputs
+        INTREE=1 build_all
+               ;;
         *)
         echo " "
         echo "**** Unknown parameter - please see usage below **** "
@@ -864,5 +1080,6 @@ function main()
        
        [[ -z $NO_BUILD ]] && build_outputs
        [[ -n $INSTALL_NFS ]] && install_outputs
+       echo "Wifi Package Build Successful"
 }
 main $@