9744f731892d6ea33cab55a718e1b5d9381f9a84
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`
100 }
102 function cd_repo()
103 {
104 cd `repo_path $1`
105 }
107 function cd_back()
108 {
109 cd - > /dev/null
110 }
112 function read_kernel_version()
113 {
114 filename=$KERNEL_PATH/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
134 }
136 #----------------------------------------------------------j
137 function setup_environment()
138 {
139 if [ ! -e setup-env ]
140 then
141 echo "No setup-env"
142 exit 1
143 fi
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
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
180 }
182 function setup_filesystem_skeleton()
183 {
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
192 }
194 function setup_directories()
195 {
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
203 }
205 function setup_repositories()
206 {
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
216 }
218 function setup_branches()
219 {
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
241 }
243 function setup_toolchain()
244 {
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
251 }
253 function build_uimage()
254 {
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
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
278 }
280 function generate_compat()
281 {
282 cd_repo backports
283 python ./gentree.py --clean `repo_path driver` `path compat_wireless`
284 cd_back
285 }
287 function build_modules()
288 {
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 {} \;
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
304 }
306 function build_openssl()
307 {
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
317 }
319 function build_libnl()
320 {
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
331 }
333 function build_wpa_supplicant()
334 {
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/
345 }
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/
359 }
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
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
374 }
376 function build_calibrator()
377 {
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
386 }
388 function build_wlconf()
389 {
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
411 }
413 function build_fw_download()
414 {
415 cp `repo_path fw_download`/*.bin `path filesystem`/lib/firmware/ti-connectivity
416 }
419 function build_scripts_download()
420 {
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
430 }
432 function clean_kernel()
433 {
434 [ "$DEFAULT_KERNEL" ] && echo "Cleaning kernel folder"
435 [ "$DEFAULT_KERNEL" ] && cd_repo kernel
436 [ "$DEFAULT_KERNEL" ] && git clean -fdx > /dev/null
437 }
439 function clean_outputs()
440 {
441 if [[ "$ROOTFS" == "DEFAULT" ]]
442 then
443 echo "Cleaning outputs"
444 rm -rf `path filesystem`/*
445 rm -f `path outputs`/${tar_filesystem[0]}
446 rm -f `path outputs`/uImage
447 fi
448 }
450 function build_outputs()
451 {
452 if [[ "$ROOTFS" == "DEFAULT" ]]
453 then
454 echo "Building outputs"
455 cd_path filesystem
456 tar cpjf `path outputs`/${tar_filesystem[0]} .
457 cd_back
459 if [ "$KERNEL_VERSION" -eq 3 ] && [ "$KERNEL_PATCHLEVEL" -eq 2 ]
460 then
461 cp `path tftp`/uImage `path outputs`/uImage
462 else
463 if [ -z $NO_DTB ]
464 then
465 cp `path tftp`/zImage `path outputs`/zImage
466 cp `path tftp`/am335x-evm.dtb `path outputs`/am335x-evm.dtb
467 else
468 cp `path tftp`/uImage `path outputs`/uImage
469 fi
470 fi
471 fi
472 }
474 function install_outputs()
475 {
476 echo "Installing outputs"
477 tftp_path=${setup[2]}
478 sitara_left_path=${setup[5]}
479 sitara_right_path=${setup[8]}
481 cp `path outputs`/uImage ${tftp_path}
482 cp `path outputs`/${tar_filesystem[0]} $sitara_left_path
483 cp `path outputs`/${tar_filesystem[0]} $sitara_right_path
485 cd $sitara_left_path
486 tar xjf ${tar_filesystem[0]}
487 cd_back
489 cd $sitara_right_path
490 tar xjf ${tar_filesystem[0]}
491 cd_back
492 }
494 function set_files_to_verify()
495 {
496 files_to_verify=(
497 # skeleton path
498 # source path
499 # pattern in output of file
501 `path filesystem`/usr/local/sbin/wpa_supplicant
502 `repo_path hostap`/wpa_supplicant/wpa_supplicant
503 "ELF 32-bit LSB executable, ARM"
505 `path filesystem`/usr/local/bin/hostapd
506 `repo_path hostap`/hostapd/hostapd
507 "ELF 32-bit LSB executable, ARM"
509 `path filesystem`/sbin/crda
510 `repo_path crda`/crda
511 "ELF 32-bit LSB executable, ARM"
513 `path filesystem`/usr/lib/crda/regulatory.bin
514 `repo_path wireless_regdb`/regulatory.bin
515 "CRDA wireless regulatory database file"
517 `path filesystem`/lib/firmware/ti-connectivity/wl18xx-fw-4.bin
518 `repo_path fw_download`/wl18xx-fw-4.bin
519 "data"
521 `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/extra/drivers/net/wireless/ti/wl18xx/wl18xx.ko
522 `path compat_wireless`/drivers/net/wireless/ti/wl18xx/wl18xx.ko
523 "ELF 32-bit LSB relocatable, ARM"
525 `path filesystem`/lib/modules/$KERNEL_VERSION.$KERNEL_PATCHLEVEL.*/extra/drivers/net/wireless/ti/wlcore/wlcore.ko
526 `path compat_wireless`/drivers/net/wireless/ti/wlcore/wlcore.ko
527 "ELF 32-bit LSB relocatable, ARM"
529 #`path filesystem`/usr/bin/calibrator
530 #`repo_path ti_utils`/calibrator
531 #"ELF 32-bit LSB executable, ARM"
533 `path filesystem`/usr/sbin/wlconf/wlconf
534 `repo_path ti_utils`/wlconf/wlconf
535 "ELF 32-bit LSB executable, ARM"
536 )
537 }
539 function get_tag()
540 {
541 i="0"
542 while [ $i -lt ${#repositories[@]} ]; do
543 name=${repositories[$i]}
544 url=${repositories[$i + 1]}
545 branch=${repositories[$i + 2]}
546 checkout_type="branch"
547 cd_repo $name
548 if [[ "$url" == *git.ti.com* ]]
549 then
550 echo -e "${PURPLE}Describe of ${NORMAL} repo : ${GREEN}$name ${NORMAL} " ;
551 git describe
552 fi
553 cd_back
554 i=$[$i + 3]
555 done
556 }
560 function admin_tag()
561 {
562 i="0"
563 while [ $i -lt ${#repositories[@]} ]; do
564 name=${repositories[$i]}
565 url=${repositories[$i + 1]}
566 branch=${repositories[$i + 2]}
567 checkout_type="branch"
568 cd_repo $name
569 if [[ "$url" == *git.ti.com* ]]
570 then
571 echo -e "${PURPLE}Adding tag ${GREEN} $1 ${NORMAL} to repo : ${GREEN}$name ${NORMAL} " ;
572 git show --summary
573 read -p "Do you want to tag this commit ?" yn
574 case $yn in
575 [Yy]* ) git tag -a $1 -m "$1" ;
576 git push --tags ;;
577 [Nn]* ) echo -e "${PURPLE}Tag was not applied ${NORMAL} " ;;
579 * ) echo "Please answer yes or no.";;
580 esac
582 fi
583 cd_back
584 i=$[$i + 3]
585 done
586 }
589 function verify_skeleton()
590 {
591 echo "Verifying filesystem skeleton..."
593 set_files_to_verify
595 i="0"
596 while [ $i -lt ${#files_to_verify[@]} ]; do
597 skeleton_path=${files_to_verify[i]}
598 source_path=${files_to_verify[i + 1]}
599 file_pattern=${files_to_verify[i + 2]}
600 file $skeleton_path | grep "${file_pattern}" >/dev/null
601 if [ $? -eq 1 ]; then
602 echo -e "${RED}ERROR " $skeleton_path " Not found ! ${NORMAL}"
603 #exit
604 fi
606 md5_skeleton=$(md5sum $skeleton_path | awk '{print $1}')
607 md5_source=$(md5sum $source_path | awk '{print $1}')
608 if [ $md5_skeleton != $md5_source ]; then
609 echo "ERROR: file mismatch"
610 echo $skeleton_path
611 exit 1
612 fi
613 i=$[$i + 3]
614 done
616 which regdbdump > /dev/null
617 if [ $? -eq 0 ]; then
618 regdbdump `path filesystem`/usr/lib/crda/regulatory.bin > /dev/null
619 assert_no_error
620 fi
621 }
623 function setup_workspace()
624 {
625 setup_directories
626 setup_repositories
627 setup_branches
628 #Download toolchain only if it was not set
629 [ DEFAULT_TOOLCHAIN ] && setup_toolchain
630 }
633 function build_all()
634 {
635 if [ -z $NO_EXTERNAL ]
636 then
637 [ $DEFAULT_KERNEL ] && build_uimage
638 build_openssl
639 build_libnl
640 build_crda
641 fi
643 if [ -z $NO_TI ]
644 then
645 build_modules
646 build_wpa_supplicant
647 build_hostapd
648 build_calibrator
649 build_wlconf
650 build_fw_download
651 build_scripts_download
652 fi
654 [ -z $NO_VERIFY ] && verify_skeleton
655 }
657 function setup_and_build()
658 {
659 setup_workspace
660 build_all
661 }
663 function main()
664 {
665 [[ "$1" == "-h" || "$1" == "--help" ]] && usage
667 setup_environment
668 setup_directories
669 read_kernel_version
671 case "$1" in
672 'update')
673 print_highlight " setting up workspace and building all "
674 if [ -n "$2" ]
675 then
676 print_highlight "Using tag $2 "
677 USE_TAG=$2
678 else
679 print_highlight "Updating all to head (this will revert local changes)"
680 RESET=1
681 fi
682 clean_kernel
683 clean_outputs
684 setup_workspace
685 read_kernel_version #####read kernel version again after update#####
686 build_all
687 ;;
689 'init')
690 print_highlight " initializing workspace (w/o build) "
691 [[ -n "$2" ]] && echo "Using tag $2 " && USE_TAG=$2
692 NO_BUILD=1
693 setup_workspace
694 read_kernel_version #####read kernel version again after init#####
695 ;;
697 'clean')
698 print_highlight " cleaning & building all "
699 clean_outputs
700 setup_directories
701 build_all
702 ;;
704 'rebuild')
705 print_highlight " building all (w/o clean) "
706 NO_CLEAN=1 build_all
707 ;;
709 'openlink')
710 print_highlight " building all (w/o clean) "
711 NO_EXTERNAL=1 setup_and_build
712 ;;
713 #################### Building single components #############################
714 'kernel')
715 print_highlight " building only Kernel "
716 clean_kernel
717 build_uimage
718 ;;
720 'kernel_modules')
721 print_highlight " building only Driver modules "
722 build_uimage
723 build_modules
724 ;;
725 'modules')
726 print_highlight " building only Driver modules "
727 build_modules
728 ;;
730 'wpa_supplicant')
731 print_highlight " building only wpa_supplicant "
732 build_wpa_supplicant
733 ;;
735 'hostapd')
736 print_highlight " building only hostapd "
737 build_hostapd
738 ;;
740 'crda')
741 print_highlight " building only CRDA "
742 build_crda
743 ;;
745 'libnl')
746 print_highlight " building only libnl"
747 build_libnl
748 ;;
750 'openssl')
751 print_highlight " building only openssl"
752 build_openssl
753 ;;
755 'scripts')
756 print_highlight " Copying scripts "
757 build_scripts_download
758 ;;
760 'utils')
761 print_highlight " building only ti-utils "
762 build_calibrator
763 build_wlconf
764 ;;
765 ############################################################
766 'get_tag')
767 get_tag
768 exit
769 ;;
771 'admin_tag')
772 admin_tag $2
773 ;;
775 *)
776 print_highlight " building all (No clean & no source code update) "
777 #clean_outputs
778 NO_CLEAN=1 build_all
779 ;;
780 esac
782 [[ -z $NO_BUILD ]] && build_outputs
783 [[ -n $INSTALL_NFS ]] && install_outputs
784 }
785 main $@