[Feature][YUKUAI_patch]add 18.02 code

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I7f71153004f10fc0ea5adfa083866aaeeb1053ac
diff --git a/rootfs/sbin/to_mnt_ubifs.sh b/rootfs/sbin/to_mnt_ubifs.sh
new file mode 100755
index 0000000..abaa4a9
--- /dev/null
+++ b/rootfs/sbin/to_mnt_ubifs.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+#Author: comlee
+#
+
+#外部传参 
+# 参数1: mount点
+# 参数2: 分区名
+RECVFS_MTD_NUM=`cat /proc/mtd | grep "$2\"" | awk '{print $1}'| cut -b 4- |sed 's/://g'`
+ubiattach /dev/ubi_ctrl -m ${RECVFS_MTD_NUM}
+echo "attach $2  $1"
+
+if [ $? != 0 ];then
+	echo "fail to attach $2"	
+	exit 1
+fi
+
+UBIDEV_NUM=`ls /sys/devices/virtual/ubi|wc -l`
+MYTMP=0
+
+if [ ! -e $1 ]; then
+	mkdir -p $1
+fi
+
+while :
+do
+	if [ -e /sys/devices/virtual/ubi/ubi${MYTMP} ]; then
+		TMPDEV=`cat /sys/devices/virtual/ubi/ubi${MYTMP}/mtd_num`
+		if [ $TMPDEV -eq ${RECVFS_MTD_NUM} ]; then
+#			umount $1
+			mount -t ubifs  -o rw,sync,noatime ubi${MYTMP}_0 $1
+			exit 0
+		fi
+	else
+		if [ ${MYTMP} -ge ${UBIDEV_NUM} ]; then
+			exit 1
+		fi
+	fi
+	MYTMP=`expr $MYTMP + 1`
+done
+
+