]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wilink8-wlan/build-utilites.git/blob - build_wl18xx.sh
Updated defconfig with iptables support
[wilink8-wlan/build-utilites.git] / build_wl18xx.sh
1 export PATH__ROOT=`pwd`    
2 . configuration.sh    
3 . setup-env
4 # Pretty colors
5 GREEN="\033[01;32m"
6 YELLOW="\033[01;33m"
7 NORMAL="\033[00m"
8 BLUE="\033[34m"
9 RED="\033[31m"
10 PURPLE="\033[35m"
11 CYAN="\033[36m"
12 UNDERLINE="\033[02m"
14 function print_highlight()
15 {      
16     echo -e "   ${YELLOW}***** $1 ***** ${NORMAL} "
17 }
19 function usage ()
20 {
21     echo ""
22     echo "This script compiles one/all of the following utilities: kernel, libnl, openssl, hostapd, wpa_supplicant,wl18xx_modules,firmware,crda,calibrator"
23     echo "by calling specific utility name and action."
24     echo ""
25     echo " Usage: ./wl18xx_build.sh init         <head|TAG>  [ Update w/o build        ] "
26     echo "                          update       <head|TAG>  [ Update & build          ] "
27     echo "                          rebuild                  [ Build w/o update        ] "
28     echo "                          clean                    [ Clean, Update & build   ] "
29     echo "                              "
30     echo " Building a specific module usage "
31     echo "       ./build.sh    hostapd "
32     echo "                     wpa_supplicant "
33     echo "                     modules(driver) "
34     echo "                     firmware "
35     echo "                     scripts "
36     echo "                     calibrator "
37     echo "                     wlconf "
38     echo "                     uimage "
39     echo "                     openssl "
40     echo "                     libnl "
41     echo "                     crda "
43     exit 1
44 }
46 function assert_no_error()
47 {
48         if [ $? -ne 0 ]; then
49                 echo "****** ERROR $? $@*******"
50                 exit 1
51         fi
52         echo "****** $1 *******"
53 }
55 function repo_id()
56 {
57         i="0"
58         while [ $i -lt ${#repositories[@]} ]; do
59                 [ $1 == "${repositories[i]}" ] && echo $i
60                 i=$[$i + 3]
61         done
62 }
64 function repo_url()
65 {
66         echo "${repositories[`repo_id $1` + 1]}"
67 }
69 function repo_branch()
70 {
71         echo "${repositories[`repo_id $1` + 2]}"
72 }
74 function path()
75 {
76         i="0"
77         while [ $i -lt "${#paths[@]}" ]; do
78                 [ $1 == "${paths[i]}" ] && echo "${paths[i + 1]}"
79                 i=$[$i + 2]
80         done
81 }
83 function set_path()
84 {
85         i="0"    
86         while [ $i -lt "${#paths[@]}" ]; do
87                 [ $1 == "${paths[i]}" ] && paths[i+1]=$2    
88                 i=$[$i + 2]
89         done
90 }
92 function repo_path()
93 {
94         echo `path src`/$1
95 }
97 function cd_path()
98 {
99         cd `path $1`
102 function cd_repo()
104         cd `repo_path $1`
107 function cd_back()
109         cd - > /dev/null
112 function read_kernel_version()
114         filename=`repo_path kernel`/Makefile
116         if [ ! -f $filename ]
117         then
118             KERNEL_VERSION=0
119             KERNEL_PATCHLEVEL=0
120             KERNEL_SUBLEVEL=0
121             echo "No Makefile was found. Kernel version was set to default." 
122         else 
123             exec 6< $filename
124             read version <&6
125             read patchlevel <&6
126             read sublevel <&6
127             exec 6<&-
129             KERNEL_VERSION=$(echo $version|sed 's/[^0-9]//g')
130             KERNEL_PATCHLEVEL=$(echo $patchlevel|sed 's/[^0-9]//g')
131             KERNEL_SUBLEVEL=$(echo $sublevel|sed 's/[^0-9]//g')
132             echo "Makefile was found. Kernel version was set to $KERNEL_VERSION.$KERNEL_PATCHLEVEL.$KERNEL_SUBLEVEL." 
133         fi
136 #----------------------------------------------------------j
137 function setup_environment()
139     if [ ! -e setup-env ]
140     then
141         echo "No setup-env"
142         exit 1
143     fi
144     
145     #if a rootfs path is set - replace the default.
146     if [[ "$ROOTFS" != "DEFAULT" ]]
147     then            
148         echo " Changing ROOTFS path to $ROOTFS"
149         set_path filesystem $ROOTFS
150         [ ! -d $ROOTFS ] && echo "Error ROOTFS: $ROOTFS dir does not exist" && exit 1
151     fi   
152     #if no toolchain path is set - download it.
153     if [[ "$TOOLCHAIN_PATH" == "DEFAULT" ]]
154     then            
155         echo " Setting TOOLCHAIN_PATH path to default"
156         export TOOLCHAIN_PATH=`path toolchain`/arm/bin
157         DEFAULT_TOOLCHAIN=1
158     fi   
160     #if no kernel path is set - download it.
161     if [[ "$KERNEL_PATH" == "DEFAULT" ]]
162     then            
163         echo " Setting KERNEL_PATH path to default"
164         export KERNEL_PATH=`repo_path kernel`
165         DEFAULT_KERNEL=1
166     else 
167         echo " Using user defined kernel"                        
168         [ ! -d $KERNEL_PATH ] && echo "Error KERNEL_PATH: $KERNEL_PATH dir does not exist" && exit 1
169     fi  
170     
171         export PROCESSORS_NUMBER=$(egrep '^processor' /proc/cpuinfo | wc -l)
172         export PKG_CONFIG_PATH=`path filesystem`/lib/pkgconfig
173         export INSTALL_PREFIX=`path filesystem`
174         export LIBNL_PATH=`repo_path libnl`     
175         export KLIB=${KERNEL_PATH}
176         export KLIB_BUILD=${KERNEL_PATH}
177         export GIT_TREE=`repo_path driver`
178         export PATH=$TOOLCHAIN_PATH:$PATH
179     
182 function setup_filesystem_skeleton()
184         mkdir -p `path filesystem`/usr/bin
185         mkdir -p `path filesystem`/etc
186         mkdir -p `path filesystem`/usr/lib/crda
187         mkdir -p `path filesystem`/lib/firmware/ti-connectivity
188         mkdir -p `path filesystem`/usr/share/wl18xx
189         mkdir -p `path filesystem`/usr/sbin/wlconf
190         mkdir -p `path filesystem`/usr/sbin/wlconf/official_inis
191         mkdir -p `path filesystem`/etc/wireless-regdb/pubkeys
194 function setup_directories()
196         i="0"
197         while [ $i -lt ${#paths[@]} ]; do
198                 mkdir -p ${paths[i + 1]}
199                 i=$[$i + 2]
200         done
201         setup_filesystem_skeleton
205 function setup_repositories()
207         i="0"
208         while [ $i -lt ${#repositories[@]} ]; do
209                 url=${repositories[$i + 1]}
210                 name=${repositories[$i]}
211         echo -e "${NORMAL}Cloning into: ${GREEN} $name ${NORMAL}"        
212         #Skip kernel clone if it was user defined 
213                 [ "$name" != "kernel" -o "$DEFAULT_KERNEL" ] && [ ! -d `repo_path $name` ] && git clone $url `repo_path $name`
214                 i=$[$i + 3]
215         done        
218 function setup_branches()
220         i="0"    
221         while [ $i -lt ${#repositories[@]} ]; do
222                 name=${repositories[$i]}
223                 url=${repositories[$i + 1]}
224         branch=${repositories[$i + 2]}   
225         checkout_type="branch"       
226         #for all the openlink repo. we use a tag if provided.               
227         [ "$name" == "kernel" ] && [ -z "$DEFAULT_KERNEL" ] && i=$[$i + 3] && continue
228         cd_repo $name   
229         echo -e "\n${NORMAL}Checking out branch ${GREEN}$branch  ${NORMAL}in repo ${GREEN}$name ${NORMAL} "
230                 git checkout $branch        
231         git fetch origin
232         git fetch origin --tags  
233         if [[ "$url" == *git.ti.com* ]]
234         then            
235            [[ -n $RESET ]] && echo -e "${PURPLE}Reset to latest in repo ${GREEN}$name ${NORMAL} branch  ${GREEN}$branch ${NORMAL}"  && git reset --hard origin/$branch
236            [[ -n $USE_TAG ]] && git reset --hard $USE_TAG  && echo -e "${NORMAL}Reset to tag ${GREEN}$USE_TAG   ${NORMAL}in repo ${GREEN}$name ${NORMAL} "            
237         fi        
238                 cd_back
239                 i=$[$i + 3]
240         done
243 function setup_toolchain()
245         if [ ! -f `path downloads`/arm-toolchain.tar.bz2 ]; then
246         echo "Setting toolchain"
247                 wget ${toolchain[0]} -O `path downloads`/arm-toolchain.tar.bz2
248                 tar -xjf `path downloads`/arm-toolchain.tar.bz2 -C `path toolchain`
249                 mv `path toolchain`/* `path toolchain`/arm
250         fi
253 function build_uimage()
255     cd_repo kernel
256         [ -z $NO_CONFIG ] && cp `path configuration`/kernel_$KERNEL_VERSION.$KERNEL_PATCHLEVEL.config `repo_path kernel`/.config
257         [ -z $NO_CLEAN ] && make clean
258         [ -z $NO_CLEAN ] && assert_no_error
259        
260     if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
261     then
262         make -j${PROCESSORS_NUMBER} uImage
263         cp `repo_path kernel`/arch/arm/boot/uImage `path tftp`/uImage
264     else
265         if [ -z $NO_DTB ] 
266         then
267             make -j${PROCESSORS_NUMBER} uImage
268             make -j${PROCESSORS_NUMBER} am335x-evm.dtb
269             cp `repo_path kernel`/arch/arm/boot/zImage `path tftp`/zImage
270             cp `repo_path kernel`/arch/arm/boot/dts/am335x-evm.dtb `path tftp`/am335x-evm.dtb
271         else
272             LOADADDR=0x80008000 make -j${PROCESSORS_NUMBER} uImage.am335x-evm 
273             cp `repo_path kernel`/arch/arm/boot/uImage.am335x-evm `path tftp`/uImage
274         fi
275     fi
276         assert_no_error
277         cd_back
280 function generate_compat()
282         cd_repo backports
283         python ./gentree.py --clean `repo_path driver` `path compat_wireless`
284         cd_back
287 function build_modules()
289     generate_compat
290         cd_repo compat_wireless
291         if [ -z $NO_CLEAN ]; then
292                 make clean
293         fi
294         make defconfig-wl18xx
295     make -j${PROCESSORS_NUMBER} 
296         assert_no_error
297         find . -name \*.ko -exec cp {} `path debugging`/ \;
298         find . -name \*.ko -exec ${CROSS_COMPILE}strip -g {} \;
299     
300         make -C ${KERNEL_PATH} M=`pwd` "INSTALL_MOD_PATH=`path filesystem`" modules_install
301         assert_no_error
302         #chmod -R 0777 ${PATH__FILESYSTEM}/lib/modules/
303         cd_back
306 function build_openssl()
308         cd_repo openssl
309         [ -z $NO_CONFIG ] && ./Configure linux-generic32
310         [ -z $NO_CLEAN ] && make clean
311         [ -z $NO_CLEAN ] && assert_no_error
312         make
313         assert_no_error
314         make install_sw
315         assert_no_error
316         cd_back
319 function build_libnl()
321         cd_repo libnl
322         [ -z $NO_CONFIG ] && ./autogen.sh
323         [ -z $NO_CONFIG ] && ./configure --prefix=`path filesystem` --host=${ARCH} CC=${CROSS_COMPILE}gcc AR=${CROSS_COMPILE}ar
324         ([ -z $NO_CONFIG ] || [ -z $NO_CLEAN ]) && make clean
325         [ -z $NO_CLEAN ] && assert_no_error
326         make
327         assert_no_error
328         make install
329         assert_no_error
330         cd_back
333 function build_wpa_supplicant()
335         cd `repo_path hostap`/wpa_supplicant
336         [ -z $NO_CONFIG ] && cp android.config .config
337         CONFIG_LIBNL32=y DESTDIR=`path filesystem` make clean
338         assert_no_error
339         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
340         assert_no_error
341         CONFIG_LIBNL32=y DESTDIR=`path filesystem` make install
342         assert_no_error
343         cd_back    
344     cp `repo_path scripts_download`/conf/*_supplicant.conf  `path filesystem`/etc/
347 function build_hostapd()
348 {              
349     cd `repo_path hostap`/hostapd
350         [ -z $NO_CONFIG ] && cp android.config .config
351         CONFIG_LIBNL32=y DESTDIR=`path filesystem` make clean
352         assert_no_error
353         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
354         assert_no_error
355         CONFIG_LIBNL32=y DESTDIR=`path filesystem` make install
356         assert_no_error
357         cd_back
358     cp `repo_path scripts_download`/conf/hostapd.conf  `path filesystem`/etc/    
361 function build_crda()
362 {       
363         cp `repo_path wireless_regdb`/regulatory.bin `path filesystem`/usr/lib/crda/regulatory.bin
364         cp `repo_path wireless_regdb`/linville.key.pub.pem `path filesystem`/etc/wireless-regdb/pubkeys/
365     cd_repo crda
366         
367         [ -z $NO_CLEAN ] && DESTDIR=`path filesystem` make clean
368         [ -z $NO_CLEAN ] && assert_no_error
369         PKG_CONFIG_LIBDIR="`path filesystem`/lib/pkgconfig" PKG_CONFIG_PATH="`path filesystem`/usr/local/ssl/lib/pkgconfig" DESTDIR=`path filesystem` CFLAGS+="-I`path filesystem`/usr/local/ssl/include -I`path filesystem`/include -L`path filesystem`/usr/local/ssl/lib -L`path filesystem`/lib" LDLIBS+=-lpthread V=1 USE_OPENSSL=1 make -j${PROCESSORS_NUMBER} all_noverify CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar
370         assert_no_error
371         DESTDIR=`path filesystem` make install
372         assert_no_error
373         cd_back
376 function build_calibrator()
378         cd_repo ti_utils
379         [ -z $NO_CLEAN ] && NFSROOT=`path filesystem` make clean
380         [ -z $NO_CLEAN ] && assert_no_error
381         NLVER=3 NLROOT=`repo_path libnl`/include NFSROOT=`path filesystem` LIBS+=-lpthread make
382         assert_no_error
383         NFSROOT=`path filesystem` make install
384         #assert_no_error
385         cd_back
388 function build_wlconf()
390         files_to_copy="dictionary.txt struct.bin default.conf wl18xx-conf-default.bin README example.conf example.ini configure-device.sh"
391         cd `repo_path ti_utils`/wlconf
392         if [ -z $NO_CLEAN ]; then
393                 NFSROOT=`path filesystem` make clean
394                 assert_no_error
395                 for file_to_copy in $files_to_copy; do
396                         rm -f `path filesstem`/usr/sbin/wlconf/$file_to_copy
397                 done
398                 rm -f `path filesystem`/usr/sbin/wlconf/official_inis/*
399         fi
400         NFSROOT=`path filesystem` make CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld
401         assert_no_error
403         # install
404         cp -f `repo_path ti_utils`/wlconf/wlconf `path filesystem`/usr/sbin/wlconf
405         chmod 755 `path filesystem`/usr/sbin/wlconf
406         for file_to_copy in $files_to_copy; do
407                 cp $file_to_copy `path filesystem`/usr/sbin/wlconf/$file_to_copy
408         done
409         cp official_inis/* `path filesystem`/usr/sbin/wlconf/official_inis/
410         cd_back
413 function build_fw_download()
415         cp `repo_path fw_download`/*.bin `path filesystem`/lib/firmware/ti-connectivity
419 function build_scripts_download()
421         cd_repo scripts_download
422         echo "Copying scripts"
423         scripts_download_path=`repo_path scripts_download`
424         for script_dir in `ls $scripts_download_path`
425         do
426                 echo "Copying everything from ${script_dir} to `path filesystem`/usr/share/wl18xx directory"
427                 cp -rf `repo_path scripts_download`/${script_dir}/* `path filesystem`/usr/share/wl18xx
428         done
429         cd_back
432 function clean_kernel()
434         echo "Cleaning kernel folder"
435         cd_repo kernel
436         git clean -fdx > /dev/null      
439 function clean_outputs()
441         echo "Cleaning outputs"   
442     rm -rf `path filesystem`/*
443     rm -f `path outputs`/${tar_filesystem[0]}
444         rm -f `path outputs`/uImage
445         
448 function build_outputs()
450         if [[ "$ROOTFS" == "DEFAULT" ]]
451     then  
452         echo "Building outputs"    
453         cd_path filesystem
454         tar cpjf `path outputs`/${tar_filesystem[0]} .
455         cd_back
456                 
457         if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
458         then
459             cp `path tftp`/uImage `path outputs`/uImage
460         else
461             if [ -z $NO_DTB ]
462             then
463                 cp `path tftp`/zImage `path outputs`/zImage
464                 cp `path tftp`/am335x-evm.dtb `path outputs`/am335x-evm.dtb
465             else
466                 cp `path tftp`/uImage `path outputs`/uImage
467             fi
468         fi              
469     fi
472 function install_outputs()
474     echo "Installing outputs"
475         tftp_path=${setup[2]}
476         sitara_left_path=${setup[5]}
477         sitara_right_path=${setup[8]}
479         cp `path outputs`/uImage ${tftp_path}
480         cp `path outputs`/${tar_filesystem[0]} $sitara_left_path
481         cp `path outputs`/${tar_filesystem[0]} $sitara_right_path
483         cd $sitara_left_path
484         tar xjf ${tar_filesystem[0]}
485         cd_back
487         cd $sitara_right_path
488         tar xjf ${tar_filesystem[0]}
489         cd_back
492 function set_files_to_verify()
494         files_to_verify=(
495         # skeleton path
496         # source path
497         # pattern in output of file
499         `path filesystem`/usr/local/sbin/wpa_supplicant
500         `repo_path hostap`/wpa_supplicant/wpa_supplicant
501         "ELF 32-bit LSB executable, ARM"
503         `path filesystem`/usr/local/bin/hostapd
504         `repo_path hostap`/hostapd/hostapd
505         "ELF 32-bit LSB executable, ARM"
507         `path filesystem`/sbin/crda
508         `repo_path crda`/crda
509         "ELF 32-bit LSB executable, ARM"
511         `path filesystem`/usr/lib/crda/regulatory.bin
512         `repo_path wireless_regdb`/regulatory.bin
513         "CRDA wireless regulatory database file"
515         `path filesystem`/lib/firmware/ti-connectivity/wl18xx-fw-4.bin
516         `repo_path fw_download`/wl18xx-fw-4.bin
517         "data"
519         `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/extra/drivers/net/wireless/ti/wl18xx/wl18xx.ko
520         `path compat_wireless`/drivers/net/wireless/ti/wl18xx/wl18xx.ko
521         "ELF 32-bit LSB relocatable, ARM"
523         `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/extra/drivers/net/wireless/ti/wlcore/wlcore.ko
524         `path compat_wireless`/drivers/net/wireless/ti/wlcore/wlcore.ko
525         "ELF 32-bit LSB relocatable, ARM"
527         #`path filesystem`/usr/bin/calibrator
528         #`repo_path ti_utils`/calibrator
529         #"ELF 32-bit LSB executable, ARM"
531         `path filesystem`/usr/sbin/wlconf/wlconf
532         `repo_path ti_utils`/wlconf/wlconf
533         "ELF 32-bit LSB executable, ARM"
534         )
537 function get_tag()
539        i="0"
540        while [ $i -lt ${#repositories[@]} ]; do
541                name=${repositories[$i]}
542                url=${repositories[$i + 1]}
543         branch=${repositories[$i + 2]}
544         checkout_type="branch"
545         cd_repo $name
546         if [[ "$url" == *git.ti.com* ]]
547         then
548                 echo -e "${PURPLE}Describe of ${NORMAL} repo : ${GREEN}$name ${NORMAL} "  ;
549                 git describe
550         fi
551                cd_back
552                i=$[$i + 3]
553        done
558 function admin_tag()
560         i="0"    
561         while [ $i -lt ${#repositories[@]} ]; do
562                 name=${repositories[$i]}
563                 url=${repositories[$i + 1]}
564         branch=${repositories[$i + 2]}   
565         checkout_type="branch"              
566         cd_repo $name    
567         if [[ "$url" == *git.ti.com* ]]
568         then                                   
569                 echo -e "${PURPLE}Adding tag ${GREEN} $1 ${NORMAL} to repo : ${GREEN}$name ${NORMAL} "  ;
570                 git show --summary        
571                 read -p "Do you want to tag this commit ?" yn
572                 case $yn in
573                     [Yy]* )  git tag -a $1 -m "$1" ;
574                              git push --tags ;;
575                     [Nn]* ) echo -e "${PURPLE}Tag was not applied ${NORMAL} " ;;
576                     
577                     * ) echo "Please answer yes or no.";;
578                 esac
579            
580         fi        
581                 cd_back
582                 i=$[$i + 3]
583         done
587 function verify_skeleton()
589         echo "Verifying filesystem skeleton..."
591         set_files_to_verify
593         i="0"
594         while [ $i -lt ${#files_to_verify[@]} ]; do
595                 skeleton_path=${files_to_verify[i]}
596                 source_path=${files_to_verify[i + 1]}
597                 file_pattern=${files_to_verify[i + 2]}
598                 file $skeleton_path | grep "${file_pattern}" >/dev/null
599         if [ $? -eq 1 ]; then
600         echo -e "${RED}ERROR " $skeleton_path " Not found ! ${NORMAL}"
601         #exit
602         fi
604                 md5_skeleton=$(md5sum $skeleton_path | awk '{print $1}')
605                 md5_source=$(md5sum $source_path     | awk '{print $1}')
606                 if [ $md5_skeleton != $md5_source ]; then
607                         echo "ERROR: file mismatch"
608                         echo $skeleton_path
609                         exit 1
610                 fi
611                 i=$[$i + 3]
612         done
614         which regdbdump > /dev/null
615         if [ $? -eq 0 ]; then
616                 regdbdump `path filesystem`/usr/lib/crda/regulatory.bin > /dev/null
617                 assert_no_error
618         fi
621 function setup_workspace()
623         setup_directories       
624         setup_repositories
625         setup_branches
626     #Download toolchain only if it was not set
627     [ DEFAULT_TOOLCHAIN ] && setup_toolchain   
631 function build_all()
633     if [ -z $NO_EXTERNAL ] 
634     then        
635         [ $DEFAULT_KERNEL ] && build_uimage
636         build_openssl
637         build_libnl
638         build_crda
639     fi
640     
641     if [ -z $NO_TI ] 
642     then
643         build_modules
644         build_wpa_supplicant
645         build_hostapd   
646         build_calibrator
647         build_wlconf
648         build_fw_download
649         build_scripts_download
650     fi
651     
652     [ -z $NO_VERIFY ] && verify_skeleton
655 function setup_and_build()
657     setup_workspace
658     build_all
661 function main()
663         [[ "$1" == "-h" || "$1" == "--help"  ]] && usage
665     setup_environment
666     setup_directories
667     read_kernel_version
668     
669         case "$1" in
670                 'update')                
671         print_highlight " setting up workspace and building all "       
672                 if [  -n "$2" ]
673         then
674             print_highlight "Using tag $2 " 
675             USE_TAG=$2
676         else
677             print_highlight "Updating all to head (this will revert local changes)" 
678             RESET=1    
679         fi
680         clean_kernel
681         clean_outputs        
682         setup_workspace
683         read_kernel_version #####read kernel version again after update#####
684         build_all
685                 ;;
686         
687         'init')                
688         print_highlight " initializing workspace (w/o build) "       
689                 [[  -n "$2" ]] && echo "Using tag $2 " && USE_TAG=$2                
690         NO_BUILD=1 
691         setup_workspace
692         read_kernel_version #####read kernel version again after init#####
693                 ;;
694               
695         'clean')        
696         print_highlight " cleaning & building all "       
697         clean_outputs
698         setup_directories
699         build_all        
700                 ;;
702                 'rebuild')
703         print_highlight " building all (w/o clean) "       
704                 NO_CLEAN=1 build_all
705                 ;;
706         
707                 'openlink')
708         print_highlight " building all (w/o clean) "       
709                 NO_EXTERNAL=1 setup_and_build
710                 ;;
711         #################### Building single components #############################
712                 'kernel')
713                 print_highlight " building only Kernel "
714                 clean_kernel
715                 build_uimage
716                 ;;
717                 
718                 'kernel_modules')
719         print_highlight " building only Driver modules "
720                 build_uimage
721                 build_modules
722                 ;;
723                 'modules')
724         print_highlight " building only Driver modules "
725                 build_modules
726                 ;;
728                 'wpa_supplicant')
729         print_highlight " building only wpa_supplicant "
730                 build_wpa_supplicant      
731                 ;;
733                 'hostapd')
734         print_highlight " building only hostapd "
735                 build_hostapd
736                 ;;
738                 'crda')
739         print_highlight " building only CRDA "
740                 build_crda
741                 ;;
742         
743                 'libnl')
744                 print_highlight " building only libnl"
745                 build_libnl
746                 ;;
748                 'openssl')
749                 print_highlight " building only openssl"
750                 build_openssl
751                 ;;
753         'scripts')
754         print_highlight " Copying scripts "
755                 build_scripts_download
756                 ;;
757                 
758         'utils')
759         print_highlight " building only ti-utils "
760         build_calibrator
761         build_wlconf            
762                 ;;        
763         ############################################################
764         'get_tag')
765         get_tag
766         exit
767         ;;
768                 
769         'admin_tag')        
770                 admin_tag $2
771                 ;;
772         
773         *)
774         print_highlight " building all (No clean & no source code update) "  
775                 #clean_outputs
776         NO_CLEAN=1 build_all
777                 ;;
778         esac
779         
780         [[ -z $NO_BUILD ]] && build_outputs
781         [[ -n $INSTALL_NFS ]] && install_outputs
783 main $@