script: optimize [1/1]

PD#SWPL-96062

Problem:
1. module function call analysis failed
2. compilation is too slow
3. can't use --savedefconfig
4. can't use --module
5. can't use --Image
6. can't use --dtbs

Solution:
1. add directory to fix the issue of module function call analysis failed
2. add --fast_build to improve compilation speed
3. modify --savedefconfig to --menuconfig and --basicconfig
4. support --module  --Image --dtbs

Verify:
sc2

Change-Id: I9af0d23c3220c4c533a2383c0ecf8c3389f2b1e5
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
diff --git a/amlogic_utils.sh b/amlogic_utils.sh
index dc97460..37d1950 100644
--- a/amlogic_utils.sh
+++ b/amlogic_utils.sh
@@ -71,7 +71,7 @@
 top_ext_drivers=top_ext_drivers
 function prepare_module_build() {
 	local temp_file=`mktemp /tmp/kernel.XXXXXXXXXXXX`
-	if [[ -z ${IN_KERNEL_MODULES} ]]; then
+	if [[ ! `grep "CONFIG_AMLOGIC_IN_KERNEL_MODULES=y" ${ROOT_DIR}/${FRAGMENT_CONFIG}` ]]; then
 		sed 's:#.*$::g' ${ROOT_DIR}/${FRAGMENT_CONFIG} | sed '/^$/d' | sed 's/^[ ]*//' | sed 's/[ ]*$//' > ${temp_file}
 		GKI_EXT_KERNEL_MODULE_CONFIG=$(read_ext_module_config ${temp_file})
 		GKI_EXT_KERNEL_MODULE_PREDEFINE=$(read_ext_module_predefine ${temp_file})
@@ -226,7 +226,7 @@
 
 	popd
 
-	if [[ -z ${ANDROID_PROJECT} ]]; then
+	if [[ -z ${ANDROID_PROJECT} ]] && [[ -d ${OUT_DIR}/${DTS_EXT_DIR} ]]; then
 		FILES="$FILES `ls ${OUT_DIR}/${DTS_EXT_DIR}`"
 	fi
 
@@ -552,7 +552,7 @@
 	else
 		echo "can't find compile tool"
 	fi
-	${compile_tool}nm ../vmlinux | grep -E " T | D | B | R | W "> vmlinux_T.txt
+	${compile_tool}nm ${DIST_DIR}/vmlinux | grep -E " T | D | B | R | W "> vmlinux_T.txt
 	# cat __install.sh | grep "insmod" | cut -d ' ' -f 2 > module_list.txt
 	cat ramdisk/ramdisk_install.sh | grep "insmod" | cut -d ' ' -f 2 > module_list.txt
 	cat vendor/vendor_install.sh | grep "insmod" | cut -d ' ' -f 2 >> module_list.txt