init: Optimization script [1/1]

PD#SWPL-64232

Problem:
exit now when build fail
generate function or variable references between modules,
even without rootfs_ base.cpio.gz.uboot

Solution:
exit now when build fail
generate function or variable references between modules,
even without rootfs_ base.cpio.gz.uboot

Verify:
local build

Change-Id: I1a0a99d28debb28eace80ceaa425efc457028b2a
Signed-off-by: wanwei.jiang <wanwei.jiang@amlogic.com>
diff --git a/amlogic_utils.sh b/amlogic_utils.sh
index 6443de1..234ab0e 100644
--- a/amlogic_utils.sh
+++ b/amlogic_utils.sh
@@ -78,6 +78,7 @@
 }
 
 function modules_install() {
+	pushd ${DIST_DIR}
 	rm modules -rf
 	mkdir modules
 	cp *.ko modules
@@ -116,13 +117,13 @@
 	echo "/modules/: all `wc -l modules.dep | awk '{print $1}'` modules."
 
 	cd ../
+	popd
 }
+export -f modules_install
 
 function rebuild_rootfs() {
 	pushd ${DIST_DIR}
 
-	modules_install
-
 	rm rootfs -rf
 	mkdir rootfs
 	cp ${ROOT_DIR}/common_drivers/rootfs_base.cpio.gz.uboot	rootfs
@@ -144,11 +145,11 @@
 export -f rebuild_rootfs
 
 function check_undefined_symbol() {
-	pushd ${DIST_DIR}/rootfs/rootfs/modules
+	pushd ${DIST_DIR}/modules
 	echo
 	echo "========================================================"
 	echo "Functions or variables not defined in this module refer to which module."
-	nm ../../../vmlinux | grep -E " T | D | B | R | W "> vmlinux_T.txt
+	nm ../vmlinux | grep -E " T | D | B | R | W "> vmlinux_T.txt
 	cat __install.sh | grep "insmod" | cut -d ' ' -f 2 > module_list.txt
 	while read LINE
 	do