blob: 860d6a6c9dc5fd0e7537d35b9b449cb2f7713c88 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#$1:源文件路径
2#$2:mkfs.ubifs 配置参数MKUBIFS_ARGS
3#$2:ubinize的配置参数
4#$4:输入ubi镜像的路径和名字
5fakeroot mkfs_ubifs() {
6 cfg_file_name=userdata.cfg
7 img_file_name=userdata.imgbak
8
9 rm -fv $img_file_name $cfg_file_name
10
11 echo "[ubifs]" > $cfg_file_name
12 echo "mode=ubi" >> $cfg_file_name
13 echo "image=${img_file_name}" >> $cfg_file_name
14 echo "vol_id=0" >> $cfg_file_name
15 echo "vol_size=$5" >> $cfg_file_name
16 echo "vol_type=dynamic" >> $cfg_file_name
17 echo "vol_name=userdata" >> $cfg_file_name
18 echo "vol_flags=autoresize" >> $cfg_file_name
19
20 mkfs.ubifs -r $1 $2 -o $img_file_name
21 if [ $? -ne 0 ]; then
22 echo "mkfs.ubifs error"
23 exit -1
24 else
25 echo "mkfs.ubifs ok"
26 fi
27
28 ubinize -o $4 $3 $cfg_file_name
29 if [ $? -ne 0 ]; then
30 echo "ubinize error"
31 exit -2
32 else
33 echo "ubinize ok"
34 fi
35
36 rm -fv $img_file_name $cfg_file_name
37 exit 0
38}
39
40#$1:输出生成文件
41#$2:文件系统源文件
42#$3:文件系统大小
43#$4:mkfs.ext4 参数
44fakeroot mkfs_ext4fs() {
45
46}