zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/install_libc.sh b/ap/build/install_libc.sh
new file mode 100755
index 0000000..547ae12
--- /dev/null
+++ b/ap/build/install_libc.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+DEST_DIR=$1
+
+#cp uClibc so to /lib
+cp -av ${STAGEDIR}/uClibc/lib/* ${DEST_DIR}/lib/
+
+rm -fv ${DEST_DIR}/lib/libubacktrace*
+
+#libgcc_s.so
+cp -av ${CROSS_COMPILE_LIBGCC_LIB}* ${DEST_DIR}/lib/
+chmod a+x ${DEST_DIR}/lib/libgcc_s.so*
+
+#clean kernel modules
+find ${DEST_DIR}/lib/modules -type l -name build | xargs rm -fr
+find ${DEST_DIR}/lib/modules -type l -name source | xargs rm -fr
+
+find ${DEST_DIR}/lib/modules/ -name "modules.*" | xargs rm -rfv
+
+if [ x"$USE_LIBSTDCPP" = x"yes" ]; then
+ LIBCPP_DIR=`dirname ${CROSS_COMPILE_LIBCPP_LIB}`
+ cp -av ${LIBCPP_DIR}/libstdc++.s*[o.0-9] ${DEST_DIR}/lib/
+fi
+
+#strip Executable files and dynamic libraries
+SECTIONS_REMOVE="-R .comment -R .note -R .ARM.attributes -R .ARM.exidx -R .ARM.extab"
+find ${DEST_DIR}/sbin -type f -perm -u+x -exec ${STRIPTOOL} $SECTIONS_REMOVE '{}' ';'
+find ${DEST_DIR}/bin -type f -perm -u+x -exec ${STRIPTOOL} $SECTIONS_REMOVE '{}' ';'
+find ${DEST_DIR}/usr/bin -type f -perm -u+x -exec ${STRIPTOOL} $SECTIONS_REMOVE '{}' ';'
+chmod a+x ${DEST_DIR}/lib/lib*.so*
+find ${DEST_DIR}/lib ! -name \*.ko -type f -perm -u+x -exec ${STRIPTOOL} $SECTIONS_REMOVE '{}' ';'
+find ${DEST_DIR}/lib ! -name cpko.ko -name \*.ko -type f -exec ${STRIPTOOL} --strip-debug --strip-unneeded $SECTIONS_REMOVE '{}' ';'
+find ${DEST_DIR}/recovery/bin -type f -perm -u+x -exec ${STRIPTOOL} $SECTIONS_REMOVE '{}' ';'
+
+if [ x"$USE_REMOVE_COMMENT" = x"yes" ]; then
+ find ${DEST_DIR} -name "*.sh" -type f -exec ${BUILD_DIR}/remove_comment.sh '{}' ';'
+ find ${DEST_DIR} -name "*.conf" -type f -exec sed -i '/^#/d' '{}' ';'
+ find ${DEST_DIR} -name "*.cfg" -type f -exec sed -i '/^#/d' '{}' ';'
+ ${BUILD_DIR}/remove_comment.sh ${DEST_DIR}/etc/rc
+ sed -i '/^#/d' ${DEST_DIR}/etc_ro/nvconfig
+ find ${DEST_DIR}/etc_ro -name "default_parameter_*" -type f -exec sed -i '/^#/d' '{}' ';'
+fi
+