fix build.sh
Change-Id: Id701cb096d25608d59dccc5c0b050cec8344cf46
diff --git a/build.sh b/build.sh
index a9f520b..8c9f438 100755
--- a/build.sh
+++ b/build.sh
@@ -109,6 +109,26 @@
cd $PWD_TEMP
}
+function copy_bin_and_lib()
+{
+ # Copy All SO Files.
+ cp -f out/lib/* $1/lib
+
+ # Copy All Bin Files.
+ #cp -f out/bin/* $1/bin
+ [ -f out/bin/at ] && cp -f out/bin/at $1/bin
+ [ -f out/bin/mbtk_rild ] && cp -f out/bin/mbtk_rild $1/bin
+ [ -f out/bin/mbtk_logd ] && cp -f out/bin/mbtk_logd $1/bin
+ [ -f out/bin/mbtk_adbd ] && cp -f out/bin/mbtk_adbd $1/bin
+ [ -f out/bin/mbtk_mdio ] && cp -f out/bin/mbtk_mdio $1/bin
+ [ -f out/bin/device_info_generate ] && cp -f out/bin/device_info_generate $1/..
+ [ -f out/bin/ota_update ] && cp -f out/bin/ota_update $1/..
+ [ -f out/bin/device_info ] && cp -f out/bin/device_info $1/bin
+ [ -f out/bin/mtd_info ] && cp -f out/bin/mtd_info $1/bin
+ [ -f out/bin/mbtk_sdk_ready ] && cp -f out/bin/mbtk_sdk_ready $1/bin
+ [ -f out/bin/mbtk_reboot ] && cp -f out/bin/mbtk_reboot $1/bin
+}
+
function file_copy()
{
ROOTFS_DIR=$ROOT_DIR/../asr_code/mbtk/rootfs
@@ -121,30 +141,44 @@
if [ ! -d $ROOTFS_DIR/lib ];then
mkdir $ROOTFS_DIR/lib
fi
-
- # Copy All SO Files.
- cp -f out/lib/* $ROOTFS_DIR/lib
+
+ copy_bin_and_lib $ROOTFS_DIR
ln_lib
-
- # Copy All Bin Files.
- #cp -f out/bin/* $ROOTFS_DIR/bin
- [ -f out/bin/at ] && cp -f out/bin/at $ROOTFS_DIR/bin
- [ -f out/bin/mbtk_rild ] && cp -f out/bin/mbtk_rild $ROOTFS_DIR/bin
- [ -f out/bin/mbtk_logd ] && cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin
- [ -f out/bin/mbtk_adbd ] && cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin
- [ -f out/bin/mbtk_mdio ] && cp -f out/bin/mbtk_mdio $ROOTFS_DIR/bin
- [ -f out/bin/device_info_generate ] && cp -f out/bin/device_info_generate $ROOTFS_DIR/..
- [ -f out/bin/ota_update ] && cp -f out/bin/ota_update $ROOTFS_DIR/..
- [ -f out/bin/device_info ] && cp -f out/bin/device_info $ROOTFS_DIR/bin
- [ -f out/bin/mtd_info ] && cp -f out/bin/mtd_info $ROOTFS_DIR/bin
- [ -f out/bin/mbtk_sdk_ready ] && cp -f out/bin/mbtk_sdk_ready $ROOTFS_DIR/bin
- [ -f out/bin/mbtk_reboot ] && cp -f out/bin/mbtk_reboot $ROOTFS_DIR/bin
else
echo "No found rootfs : $ROOTFS_DIR"
fi
}
+function temp_mbtk_copy()
+{
+ TEMP_MBTK_DIR=$ROOT_DIR/../temp_open
+ if [ -d $TEMP_MBTK_DIR ];then
+ rm -rf $TEMP_MBTK_DIR
+ fi
+
+ mkdir -p $TEMP_MBTK_DIR/mbtk/include
+ mkdir -p $TEMP_MBTK_DIR/mbtk/rootfs/bin
+ mkdir -p $TEMP_MBTK_DIR/mbtk/rootfs/lib
+ mkdir -p $TEMP_MBTK_DIR/mbtk/test
+
+ copy_bin_and_lib $TEMP_MBTK_DIR/mbtk/rootfs
+
+ # Copy include file.
+ if [ -d mbtk/include ];then
+ cp -rf mbtk/include/* $TEMP_MBTK_DIR/mbtk/include
+ fi
+
+ # Copy test source.
+ if [ -d mbtk/test ];then
+ cope_file="mbtk/test/*"
+ files=$(ls $cope_file 2> /dev/null | wc -l)
+ if [ "$files" != "0" ] ;then #如果存在文件
+ cp -rf $cope_file $TEMP_MBTK_DIR/mbtk/test
+ fi
+ fi
+}
+
function main()
{
if [ -n "$1" ] ;then
@@ -169,6 +203,8 @@
file_copy
fi
+
+ temp_mbtk_copy
}
main $1
\ No newline at end of file