[Feature][ZXW-179]merge P52U02 version

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: I4fa8f86757e71388ae88400914dae8b50cd00338
diff --git a/allbins/tools/mkfs_sh/bin/mksquashfs4 b/allbins/tools/mkfs_sh/bin/mksquashfs4
new file mode 100755
index 0000000..76482d7
--- /dev/null
+++ b/allbins/tools/mkfs_sh/bin/mksquashfs4
Binary files differ
diff --git a/allbins/tools/mkfs_sh/bin/ubinize b/allbins/tools/mkfs_sh/bin/ubinize
new file mode 100755
index 0000000..c84411b
--- /dev/null
+++ b/allbins/tools/mkfs_sh/bin/ubinize
Binary files differ
diff --git a/allbins/tools/mkfs_sh/bin/zxic_generate_squashfs_verity b/allbins/tools/mkfs_sh/bin/zxic_generate_squashfs_verity
new file mode 100755
index 0000000..8d2fbf7
--- /dev/null
+++ b/allbins/tools/mkfs_sh/bin/zxic_generate_squashfs_verity
Binary files differ
diff --git a/allbins/tools/mkfs_sh/oemdata-ubi-default.cfg b/allbins/tools/mkfs_sh/oemdata-ubi-default.cfg
new file mode 100755
index 0000000..6c7f896
--- /dev/null
+++ b/allbins/tools/mkfs_sh/oemdata-ubi-default.cfg
@@ -0,0 +1,7 @@
+[vol_oemdata]
+mode=ubi
+vol_id=0
+vol_size=1MiB
+vol_type=dynamic
+vol_name=vol_oemdata
+vol_flags=autoresize
diff --git a/allbins/tools/mkfs_sh/readme.txt b/allbins/tools/mkfs_sh/readme.txt
new file mode 100755
index 0000000..992c83d
--- /dev/null
+++ b/allbins/tools/mkfs_sh/readme.txt
@@ -0,0 +1,33 @@
+1、环境
+环境ubuntu 18.04
+sudo apt-get  install policycoreutils  cryptsetup-bin
+将签名工具SignTool拷贝到当前mkfs_sh目录
+
+2、命令帮助
+bash rootfs_mksqushfs_demo.sh out_name dir_name vol_name selinux_file dm_verity
+out_name:输出文件名
+dir_name:打包的目录
+vol_name:为UBI卷名称
+selinux_file: selinux context file。若禁用selinux,则需要提供一个不存在的文件即可
+dm_verity: 0 for disable dm-verity, 1 for enable dm-verity
+
+3、squashfs打包示例
+caprootfs重新打包
+rootfs目录为版本elf/normal/ap_caprootfs.img.tgz解压,修改rootfs目录文件,然后重新打包。
+编辑rootfs_mksqushfs_demo.sh,检查下面参数配置
+UBI_ARGS为nandflash UBI参数配置
+MKSQUASHFS_ARGS为squashfs压缩打包参数
+PRIVATE_KEY为dm-verity签名私钥
+
+运行fakeroot命令,进入fakeboot模式
+bash rootfs_mksqushfs_demo.sh  ap_caprootfs.img rootfs vol_rootfs rootfs/etc/selinux/mls/contexts/files/file_contexts 1
+
+oem重新打包类似。若开启selinux,需要提供selinux context文件。
+
+4、ubifs打包示例
+编辑ubifs_demo.sh,检查下面参数配置
+UBI_ARGS为nandflash UBI参数配置。参考oemdata-ubi-default.cfg配置自己的cfg文件。
+bash  ubifs_demo.sh cap_oemdata.img  oemdata-ubi-default.cfg
+特殊注明:避免将一个目录打包成ubifs镜像,否则需要mkfs.ubifs命令,并且要计算max leb count值。
+ubifs的预置文件可以放到squashfs文件系统里,第一次启动的时候拷贝到ubifs里。
+
diff --git a/allbins/tools/mkfs_sh/rootfs_mksqushfs_demo.sh b/allbins/tools/mkfs_sh/rootfs_mksqushfs_demo.sh
new file mode 100755
index 0000000..2be2acb
--- /dev/null
+++ b/allbins/tools/mkfs_sh/rootfs_mksqushfs_demo.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+WORKDIR=$PWD
+export PATH=$WORKDIR/bin:$PATH
+
+UBI_ARGS="-m 0x1000 -p 0x40000 -s 0x1000 -Q 1024"
+MKSQUASHFS_ARGS="-nopad -noappend -root-owned -comp xz -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2  -b 256k -processors 1"
+PRIVATE_KEY="$WORKDIR/SignTool/key/RSA_2048/private.k"
+if [ $# -lt 5 ]; then
+  echo "[error] $0 parameter to less"
+  echo "$0 out_name dir_name vol_name selinux_file dm_verity"
+  echo "selinux_file: selinux context file"
+  echo "dm_verity: 0 for disable dm-verity, 1 for enable dm-verity"
+  exit -1
+fi
+OUT_NAME=$1
+DIR_NAME=$2
+VOL_NAME=$3
+selinux_file=$4
+dm_verity=$5
+
+echo "out_name: $OUT_NAME"
+echo "dir_name: $DIR_NAME"
+echo "vol_name: $VOL_NAME"
+echo "ubi_args: $UBI_ARGS"
+
+rm -rf $OUT_NAME  verity   ${VOL_NAME}.out
+mkdir -p $DIR_NAME
+
+if [ -f $selinux_file ]; then
+  setfiles -m -r $DIR_NAME  $selinux_file $DIR_NAME
+  if [ $? -eq 0 ]; then
+    echo "selinux set success"
+  else
+    echo "selinux set fail"
+    exit -1
+  fi
+else
+  echo "selinux_file NOT exist and disable selinux"
+fi
+
+$WORKDIR/bin/mksquashfs4 $DIR_NAME  ${VOL_NAME}.out ${MKSQUASHFS_ARGS} -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1'
+if [ $? -ne 0 ]; then
+    echo "mksquashfs error"
+    exit -1
+fi
+
+if [ "$dm_verity" == "1" ]; then
+  ./squashfs_dm-verity.sh  ${VOL_NAME}.out  ./  ${VOL_NAME}.dm  $PRIVATE_KEY $WORKDIR/SignTool/SignImage
+  if [ $? -eq 0 ]; then
+    echo "dm-verity sucess"
+  else
+     echo "dm-verity fail"
+     exit -1
+  fi
+  mv ${VOL_NAME}.dm  ${VOL_NAME}.out
+else
+  echo "disable dm-verity"
+fi
+
+./ubinize-static.sh  $VOL_NAME $OUT_NAME ${VOL_NAME}.out  "$UBI_ARGS"
diff --git a/allbins/tools/mkfs_sh/squashfs_dm-verity.sh b/allbins/tools/mkfs_sh/squashfs_dm-verity.sh
new file mode 100755
index 0000000..29170e0
--- /dev/null
+++ b/allbins/tools/mkfs_sh/squashfs_dm-verity.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+IN_FILE=$1
+WORK_DIR=$2
+OUT_FILE=$3
+PRIV_KEY=$4
+SignImage=$5
+
+VERITY_DIR=$WORK_DIR/verity
+
+rm -rf $VERITY_DIR  $OUT_FILE  $OUT_FILE.pad
+mkdir -p  $VERITY_DIR
+
+# 1.pad
+let size="$(stat -c%s $IN_FILE)" pad="128*1024" offset="0"  pad="(pad - ((size + offset) % pad)) % pad"  newsize='size + pad'
+echo $size $newsize
+dd  if=$IN_FILE   of=$OUT_FILE  bs=$newsize count=1  conv=sync
+#cp -v $OUT_FILE   $OUT_FILE.pad
+
+# 2. gen raw_table and hash_tree
+veritysetup format $OUT_FILE $VERITY_DIR/hash_tree > $VERITY_DIR/raw_table
+if [ $? -ne 0 ]; then
+	echo "generate squashfs dm-verity veritysetup format error!"
+	exit 1
+fi
+
+# 3. gen signature of raw_table
+#openssl dgst -sha256 -binary -sign $PRIV_KEY $VERITY_DIR/raw_table > $VERITY_DIR/sign
+$SignImage -i  $VERITY_DIR/raw_table -o $VERITY_DIR/raw_table.signed  -k $PRIV_KEY
+if [ $? -ne 0 ]; then
+	echo "generate squashfs dm-verity sign error!"
+	exit 1
+fi
+dd if=$VERITY_DIR/raw_table.signed  of=$VERITY_DIR/sign bs=640 count=1 status=none
+
+# 4. padding sign, raw_table and hash_tree to input file
+zxic_generate_squashfs_verity $OUT_FILE $VERITY_DIR/sign $VERITY_DIR/raw_table $VERITY_DIR/hash_tree
+if [ $? -ne 0 ]; then
+	echo "generate squashfs dm-verity error!"
+	exit 1
+fi
diff --git a/allbins/tools/mkfs_sh/ubifs_demo.sh b/allbins/tools/mkfs_sh/ubifs_demo.sh
new file mode 100755
index 0000000..e98cca6
--- /dev/null
+++ b/allbins/tools/mkfs_sh/ubifs_demo.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+WORKDIR=$PWD
+export PATH=$WORKDIR/bin:$PATH
+
+UBI_ARGS="-m 0x1000 -p 0x40000 -s 0x1000 -Q 1024"
+
+if [ $# -lt 2 ]; then
+  echo "[error] $0 parameter to less"
+  echo "$0 outfile cfg_file_name"
+  exit -1
+fi
+outfile=$1
+cfg_file_name=$2
+
+
+echo "outfile: $outfile"
+echo "cfg_file_name: $cfg_file_name"
+echo "UBI_ARGS: $UBI_ARGS"
+
+
+./ubinize-cfg.sh  $outfile $cfg_file_name  "$UBI_ARGS"
diff --git a/allbins/tools/mkfs_sh/ubinize-cfg.sh b/allbins/tools/mkfs_sh/ubinize-cfg.sh
new file mode 100755
index 0000000..31b9b64
--- /dev/null
+++ b/allbins/tools/mkfs_sh/ubinize-cfg.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+outfile=$1
+cfg_file_name=$2
+ubinize_para=$3
+
+echo "outfile:$outfile"
+echo "ubinize_para:$ubinize_para"
+
+cat $cfg_file_name
+
+ubinize  -o $outfile $ubinize_para $cfg_file_name
+if [ $? -ne 0 ]; then
+    echo "ubinize error"
+    exit -2
+else
+    echo "ubinize ok"
+fi
+
diff --git a/allbins/tools/mkfs_sh/ubinize-static.sh b/allbins/tools/mkfs_sh/ubinize-static.sh
new file mode 100755
index 0000000..84f6aaf
--- /dev/null
+++ b/allbins/tools/mkfs_sh/ubinize-static.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+if [ $# -ne 4 ]; then
+    echo "$0 error"
+    echo "Usage:"
+    echo "        $0 mtd_name outfile image_file ubinize_para"
+    exit  -1
+fi
+
+mtdname=$1
+outfile=$2
+imgfile=$3
+ubinize_para=$4
+
+filesize="$(stat -c%s $imgfile)"
+
+cfg_file_name=$mtdname.cfg
+
+echo "[$mtdname]"                     > $cfg_file_name
+echo "mode=ubi"                      >> $cfg_file_name
+echo "image=$imgfile"                >> $cfg_file_name
+echo "vol_id=0"                      >> $cfg_file_name
+echo "vol_size=${filesize}"          >> $cfg_file_name
+echo "vol_type=dynamic"               >> $cfg_file_name
+echo "vol_name=$mtdname"             >> $cfg_file_name
+
+cat $cfg_file_name
+
+ubinize  -o $outfile $ubinize_para $cfg_file_name
+if [ $? -ne 0 ]; then
+    echo "ubinize error"
+    exit -2
+else
+    echo "ubinize ok"
+fi
+
+rm -v $cfg_file_name
diff --git a/allbins/tools/resign_tool/fileseek b/allbins/tools/resign_tool/fileseek
index c63a901..82052df8 100755
--- a/allbins/tools/resign_tool/fileseek
+++ b/allbins/tools/resign_tool/fileseek
Binary files differ
diff --git a/allbins/tools/resign_tool/fileseek.exe b/allbins/tools/resign_tool/fileseek.exe
index bb1590b..b36894a 100755
--- a/allbins/tools/resign_tool/fileseek.exe
+++ b/allbins/tools/resign_tool/fileseek.exe
Binary files differ
diff --git a/allbins/tools/resign_tool/filewrite b/allbins/tools/resign_tool/filewrite
index 0edcc84..7f8fd64 100755
--- a/allbins/tools/resign_tool/filewrite
+++ b/allbins/tools/resign_tool/filewrite
Binary files differ
diff --git a/allbins/tools/resign_tool/filewrite.exe b/allbins/tools/resign_tool/filewrite.exe
index ffd4129..f5d66ba 100755
--- a/allbins/tools/resign_tool/filewrite.exe
+++ b/allbins/tools/resign_tool/filewrite.exe
Binary files differ
diff --git a/allbins/tools/resign_tool/resign.bat b/allbins/tools/resign_tool/resign.bat
index 27d352c..dd0bf26 100755
--- a/allbins/tools/resign_tool/resign.bat
+++ b/allbins/tools/resign_tool/resign.bat
@@ -73,17 +73,13 @@
     SignImage -d -i  "%WORK_DIR%\verity\raw_table" -o "%WORK_DIR%\verity\raw_table.signed"  -k %PRIVATE_KEY% -t %HASH_STR% || EXIT /B 1

     fileseek "%WORK_DIR%\ap_caprootfs.img" "%WORK_DIR%\verity\sign" > "%WORK_DIR%\verity\sign_offset"

     if %ERRORLEVEL% NEQ 0  EXIT /B 1

-    set /p sign_offset=<"%WORK_DIR%\verity\sign_offset"

-    echo caprootfs sign_offset %sign_offset%

-    filewrite "%WORK_DIR%\ap_caprootfs.img" %sign_offset% %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\ap_caprootfs.img" || EXIT /B 1

+    filewrite "%WORK_DIR%\ap_caprootfs.img" "%WORK_DIR%\verity\sign_offset" %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\ap_caprootfs.img" || EXIT /B 1

     del /f /q "%WORK_DIR%\verity\sign_offset"

 

     ::fix ap_caprootfs.img.dm

     fileseek "%WORK_DIR%\ap_caprootfs.img.dm" "%WORK_DIR%\verity\sign" > "%WORK_DIR%\verity\sign_offset2"

     if %ERRORLEVEL% NEQ 0  EXIT /B 1

-    set /p sign_offset2=<"%WORK_DIR%\verity\sign_offset2"

-    echo caprootfs dm sign_offset %sign_offset2%

-    filewrite "%WORK_DIR%\ap_caprootfs.img.dm" %sign_offset2%  %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\ap_caprootfs.img.dm" || EXIT /B 1

+    filewrite "%WORK_DIR%\ap_caprootfs.img.dm" "%WORK_DIR%\verity\sign_offset2"  %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\ap_caprootfs.img.dm" || EXIT /B 1

     del /f /q "%WORK_DIR%\verity\sign_offset2"

     echo "ap_caprootfs.img resign success"

 )

@@ -96,17 +92,13 @@
     SignImage -d -i  "%WORK_DIR%\verity\raw_table" -o "%WORK_DIR%\verity\raw_table.signed"  -k %PRIVATE_KEY% -t %HASH_STR% || EXIT /B 1

     fileseek "%WORK_DIR%\cap_oem.img" "%WORK_DIR%\verity\sign" > "%WORK_DIR%\verity\sign_offset3"

     if %ERRORLEVEL% NEQ 0  EXIT /B 1

-    set /p sign_offset3=<"%WORK_DIR%\verity\sign_offset3"

-    echo oem sign_offset %sign_offset3%

-    filewrite "%WORK_DIR%\cap_oem.img" %sign_offset3%  %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\cap_oem.img" || EXIT /B 1

+    filewrite "%WORK_DIR%\cap_oem.img" "%WORK_DIR%\verity\sign_offset3"  %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\cap_oem.img" || EXIT /B 1

     del /f /q "%WORK_DIR%\verity\sign_offset3"

 

     ::fix cap_oem.img.dm

     fileseek "%WORK_DIR%\cap_oem.img.dm" "%WORK_DIR%\verity\sign" > "%WORK_DIR%\verity\sign_offset4"

     if %ERRORLEVEL% NEQ 0  EXIT /B 1

-    set /p sign_offset4=<"%WORK_DIR%\verity\sign_offset4"

-    echo oem dm sign_offset %sign_offset4%

-    filewrite "%WORK_DIR%\cap_oem.img.dm" %sign_offset4% %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\cap_oem.img.dm" || EXIT /B 1

+    filewrite "%WORK_DIR%\cap_oem.img.dm" "%WORK_DIR%\verity\sign_offset4" %WORK_DIR%\verity\raw_table.signed "%WORK_DIR%\cap_oem.img.dm" || EXIT /B 1

     del /f /q "%WORK_DIR%\verity\sign_offset4"

     echo "cap_oem.img resign success"

 )

diff --git a/allbins/tools/resign_tool/resign.sh b/allbins/tools/resign_tool/resign.sh
index 37144f2..9a2f163 100755
--- a/allbins/tools/resign_tool/resign.sh
+++ b/allbins/tools/resign_tool/resign.sh
@@ -42,7 +42,7 @@
         #old v3t device for mdl/mifi etc.
         SignImage -z -i $WORK_DIR/zloader.bin -k $PRIVATE_KEY -t $HASH_STR
     fi
-    SignImage -z -i $WORK_DIR/tloader.bin -k $PRIVATE_KEY -t $HASH_STR
+    SignImage -z -i $WORK_DIR/tloader.bin -k $PRIVATE_KEY -t $HASH_STR
 fi
 echo "HASH_STR:" $HASH_STR
 SignImage -r -i $WORK_DIR/uboot.bin -k $PRIVATE_KEY -t $HASH_STR
@@ -71,15 +71,11 @@
     zxic_parse_squashfs_verity $WORK_DIR/ap_caprootfs.img.dm  $WORK_DIR/verity/sign $WORK_DIR/verity/raw_table $WORK_DIR/verity/hash_tree_offset
     SignImage -d -i  $WORK_DIR/verity/raw_table -o $WORK_DIR/verity/raw_table.signed  -k $PRIVATE_KEY -t $HASH_STR
     fileseek $WORK_DIR/ap_caprootfs.img $WORK_DIR/verity/sign > $WORK_DIR/verity/sign_offset
-    sign_offset=` sed -n '/found/p' $WORK_DIR/verity/sign_offset | awk '{print $2}' `
-    echo caprootfs sign_offset $sign_offset
-    filewrite  $WORK_DIR/ap_caprootfs.img $sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/ap_caprootfs.img
+    filewrite  $WORK_DIR/ap_caprootfs.img $WORK_DIR/verity/sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/ap_caprootfs.img
 
     #fix ap_caprootfs.img.dm
     fileseek $WORK_DIR/ap_caprootfs.img.dm $WORK_DIR/verity/sign > $WORK_DIR/verity/sign_offset
-    sign_offset=` sed -n '/found/p' $WORK_DIR/verity/sign_offset | awk '{print $2}' `
-    echo caprootfs dm sign_offset $sign_offset
-    filewrite  $WORK_DIR/ap_caprootfs.img.dm $sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/ap_caprootfs.img.dm
+    filewrite  $WORK_DIR/ap_caprootfs.img.dm $WORK_DIR/verity/sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/ap_caprootfs.img.dm
 
     echo "ap_caprootfs.img resign success"
 fi
@@ -89,15 +85,11 @@
     zxic_parse_squashfs_verity $WORK_DIR/cap_oem.img.dm  $WORK_DIR/verity/sign $WORK_DIR/verity/raw_table $WORK_DIR/verity/hash_tree_offset
     SignImage -d -i  $WORK_DIR/verity/raw_table -o $WORK_DIR/verity/raw_table.signed  -k $PRIVATE_KEY -t $HASH_STR
     fileseek $WORK_DIR/cap_oem.img $WORK_DIR/verity/sign > $WORK_DIR/verity/sign_offset
-    sign_offset=` sed -n '/found/p' $WORK_DIR/verity/sign_offset | awk '{print $2}' `
-    echo oem sign_offset $sign_offset
-    filewrite  $WORK_DIR/cap_oem.img $sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/cap_oem.img
+    filewrite  $WORK_DIR/cap_oem.img $WORK_DIR/verity/sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/cap_oem.img
 
     #fix cap_oem.img.dm
     fileseek $WORK_DIR/cap_oem.img.dm $WORK_DIR/verity/sign > $WORK_DIR/verity/sign_offset
-    sign_offset=` sed -n '/found/p' $WORK_DIR/verity/sign_offset | awk '{print $2}' `
-    echo oem dm sign_offset $sign_offset
-    filewrite  $WORK_DIR/cap_oem.img.dm $sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/cap_oem.img.dm
+    filewrite  $WORK_DIR/cap_oem.img.dm $WORK_DIR/verity/sign_offset  $WORK_DIR/verity/raw_table.signed $WORK_DIR/cap_oem.img.dm
     echo "cap_oem.img resign success"
 fi
 
diff --git a/allbins/tools/squashfskit/mksquashfs4 b/allbins/tools/squashfskit/mksquashfs4
index 76482d7..0670d62 100755
--- a/allbins/tools/squashfskit/mksquashfs4
+++ b/allbins/tools/squashfskit/mksquashfs4
Binary files differ
diff --git a/allbins/tools/squashfskit/unsquashfs b/allbins/tools/squashfskit/unsquashfs
index 24f24e1..7cb0e8c 100755
--- a/allbins/tools/squashfskit/unsquashfs
+++ b/allbins/tools/squashfskit/unsquashfs
Binary files differ
diff --git a/allbins/zx297520v3/prj_evb/nv/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_evb/nv/Ref_nvrw_0x26C00.bin
index afab31f..f866615 100755
--- a/allbins/zx297520v3/prj_evb/nv/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_evb/nv/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_evb/nv/psPriData_nvrw_0x00002000.bin b/allbins/zx297520v3/prj_evb/nv/psPriData_nvrw_0x00002000.bin
index 31ca88a..212e783 100755
--- a/allbins/zx297520v3/prj_evb/nv/psPriData_nvrw_0x00002000.bin
+++ b/allbins/zx297520v3/prj_evb/nv/psPriData_nvrw_0x00002000.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_evb/nv_230a/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_evb/nv_230a/Ref_nvrw_0x26C00.bin
index 48b40ae..7b501d5 100755
--- a/allbins/zx297520v3/prj_evb/nv_230a/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_evb/nv_230a/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_evb/nv_230a/psPriData_nvrw_0x00002000.bin b/allbins/zx297520v3/prj_evb/nv_230a/psPriData_nvrw_0x00002000.bin
index 7d77d0e..663c68c 100755
--- a/allbins/zx297520v3/prj_evb/nv_230a/psPriData_nvrw_0x00002000.bin
+++ b/allbins/zx297520v3/prj_evb/nv_230a/psPriData_nvrw_0x00002000.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_evb/nv_230a_dcxo/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_evb/nv_230a_dcxo/Ref_nvrw_0x26C00.bin
index 48b40ae..7b501d5 100755
--- a/allbins/zx297520v3/prj_evb/nv_230a_dcxo/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_evb/nv_230a_dcxo/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/allbins_dc_4Gb/product.ini b/allbins/zx297520v3/prj_vehicle/allbins_dc_4Gb/product.ini
index af5d590..9cc8232 100755
--- a/allbins/zx297520v3/prj_vehicle/allbins_dc_4Gb/product.ini
+++ b/allbins/zx297520v3/prj_vehicle/allbins_dc_4Gb/product.ini
@@ -1,9 +1,9 @@
 [imagefs]

 largefile_split_enable=no

-mkfs_jffs2=-v -X lzma --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash 

+mkfs_jffs2=-v -X lzo --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash 

 

 [nvrofs]

-mkfs_jffs2=-v -X lzma --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash

+mkfs_jffs2=-v -X lzo --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash

 

 [resource]

-mkfs_jffs2=-v -X lzma --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash
\ No newline at end of file
+mkfs_jffs2=-v -X lzo --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash

diff --git a/allbins/zx297520v3/prj_vehicle/allbins_dc_ref/product.ini b/allbins/zx297520v3/prj_vehicle/allbins_dc_ref/product.ini
index 57ac351..c851b9e 100755
--- a/allbins/zx297520v3/prj_vehicle/allbins_dc_ref/product.ini
+++ b/allbins/zx297520v3/prj_vehicle/allbins_dc_ref/product.ini
@@ -1,9 +1,9 @@
 [imagefs]

 largefile_split_enable=no

-mkfs_jffs2=-v -X lzma --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash 

+mkfs_jffs2=-v -X lzo --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash 

 

 [nvrofs]

-mkfs_jffs2=-v -X lzma --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash

+mkfs_jffs2=-v -X lzo --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash

 

 [resource]

-mkfs_jffs2=-v -X lzma --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash
\ No newline at end of file
+mkfs_jffs2=-v -X lzo --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash

diff --git a/allbins/zx297520v3/prj_vehicle/allbins_dc_systemd/product.ini b/allbins/zx297520v3/prj_vehicle/allbins_dc_systemd/product.ini
index af5d590..c851b9e 100755
--- a/allbins/zx297520v3/prj_vehicle/allbins_dc_systemd/product.ini
+++ b/allbins/zx297520v3/prj_vehicle/allbins_dc_systemd/product.ini
@@ -1,9 +1,9 @@
 [imagefs]

 largefile_split_enable=no

-mkfs_jffs2=-v -X lzma --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash 

+mkfs_jffs2=-v -X lzo --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash 

 

 [nvrofs]

-mkfs_jffs2=-v -X lzma --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash

+mkfs_jffs2=-v -X lzo --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash

 

 [resource]

-mkfs_jffs2=-v -X lzma --pagesize=0x800 --eraseblock=0x20000 --little-endian --no-cleanmarkers --squash
\ No newline at end of file
+mkfs_jffs2=-v -X lzo --pagesize=0x1000 --eraseblock=0x40000 --little-endian --no-cleanmarkers --squash

diff --git a/allbins/zx297520v3/prj_vehicle/nv/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_vehicle/nv/Ref_nvrw_0x26C00.bin
index 7c82cc9..d386b79 100755
--- a/allbins/zx297520v3/prj_vehicle/nv/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv/flags.bin b/allbins/zx297520v3/prj_vehicle/nv/flags.bin
index 42ed5c4..bc004de 100755
--- a/allbins/zx297520v3/prj_vehicle/nv/flags.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv/flags.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv/psPriData_nvrw_0x00002000.bin b/allbins/zx297520v3/prj_vehicle/nv/psPriData_nvrw_0x00002000.bin
index 73ab50f..172d479 100755
--- a/allbins/zx297520v3/prj_vehicle/nv/psPriData_nvrw_0x00002000.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv/psPriData_nvrw_0x00002000.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_vehicle/nv_dc/Ref_nvrw_0x26C00.bin
index 4a7e13f..e0b43a8 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_4Gb/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_4Gb/Ref_nvrw_0x26C00.bin
index 352f147..617c86e 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_4Gb/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_4Gb/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/Ref_nvrw_0x26C00.bin
index be64d73..2a63d4f 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_systemd/Ref_nvrw_0x26C00.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_systemd/Ref_nvrw_0x26C00.bin
index 178c48f..c858c4e 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_systemd/Ref_nvrw_0x26C00.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_systemd/Ref_nvrw_0x26C00.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/scripts_linux/merge.sh b/allbins/zx297520v3/prj_vehicle/scripts_linux/merge.sh
index f4ccc31..9f3f3fc 100755
--- a/allbins/zx297520v3/prj_vehicle/scripts_linux/merge.sh
+++ b/allbins/zx297520v3/prj_vehicle/scripts_linux/merge.sh
@@ -1,5 +1,13 @@
 #!/bin/bash
 
+CURR_DIR=`pwd`
+TOP_DIR=$CURR_DIR/../../../..
+
+chmod -R a+x $CURR_DIR/*
+chmod a+x $TOP_DIR/tools/SignTool/*
+chmod a+x $TOP_DIR/allbins/tools/squashfskit/*
+chmod a+x $TOP_DIR/allbins/tools/resign_tool/*
+
 ./Image -n  NVRWInOneImage.ini
 ./Image -n  NVRWOInOneImage.ini
 ./Image -n  NVRWInOneImage_dc.ini