[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/ubifs.sh b/ap/build/ubifs.sh
new file mode 100644
index 0000000..0666088
--- /dev/null
+++ b/ap/build/ubifs.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+if [ x"$PAGESIZE" = x"" ]; then
+ PAGESIZE=0x800
+fi
+
+if [ x"$ERASEBLOCK" = x"" ]; then
+ ERASEBLOCK=0x20000
+fi
+
+cfg_file_name=$1.cfg
+img_file_name=$1.imgbak
+vol_size=$[$2*942-512]
+
+rm -fv $img_file_name $cfg_file_name
+
+echo "[ubifs]" > $cfg_file_name
+echo "mode=ubi" >> $cfg_file_name
+echo "image=${img_file_name}" >> $cfg_file_name
+echo "vol_id=0" >> $cfg_file_name
+echo "vol_size=${vol_size}KiB" >> $cfg_file_name
+echo "vol_type=dynamic" >> $cfg_file_name
+echo "vol_name=${1}" >> $cfg_file_name
+echo "vol_flags=autoresize" >> $cfg_file_name
+
+mkfs.ubifs -r $3 -m $PAGESIZE -e $[$ERASEBLOCK - $PAGESIZE] -c $[$2*8 -1] -x zlib -o $img_file_name
+if [ $? -ne 0 ]; then
+ echo "mkfs.ubifs error"
+ exit -1
+else
+ echo "mkfs.ubifs ok"
+fi
+
+ubinize -o $4 -m $PAGESIZE -p $ERASEBLOCK -s 512 $cfg_file_name
+if [ $? -ne 0 ]; then
+ echo "ubinize error"
+ exit -2
+else
+ echo "ubinize ok"
+fi
+
+rm -fv $img_file_name $cfg_file_name
+
+exit 0