ubi文件系统制作

时间:2021-01-26 10:03:44

得到分区信息,可以用mtdinfo命令

root@XJ-WTX-871:~# mtdinfo /dev/mtd9 -u
mtd9
Name:                           NAND.file-system
Type:                           nand
Eraseblock size:                524288 bytes, 512.0 KiB
Amount of eraseblocks:          988 (517996544 bytes, 494.0 MiB)
Minimum input/output unit size: 4096 bytes
Sub-page size:                  1024 bytes
OOB size:                       224 bytes
Character device major/minor:   90:18
Bad blocks are allowed:         true
Device is writable:             true
Default UBI VID header offset:  1024
Default UBI data offset:        4096
Default UBI LEB size:           520192 bytes, 508.0 KiB
Maximum UBI volumes count:      128

root@XJ-WTX-871:~# mtdinfo /dev/mtd10 -u
mtd10
Name:                           NAND.Usrinit
Type:                           nand
Eraseblock size:                524288 bytes, 512.0 KiB
Amount of eraseblocks:          200 (104857600 bytes, 100.0 MiB)
Minimum input/output unit size: 4096 bytes
Sub-page size:                  1024 bytes
OOB size:                       224 bytes
Character device major/minor:   90:20
Bad blocks are allowed:         true
Device is writable:             true
Default UBI VID header offset:  1024
Default UBI data offset:        4096
Default UBI LEB size:           520192 bytes, 508.0 KiB
Maximum UBI volumes count:      128

root@XJ-WTX-871:~# mtdinfo /dev/mtd11 -u
mtd11
Name:                           NAND.Usrdsk
Type:                           nand
Eraseblock size:                524288 bytes, 512.0 KiB
Amount of eraseblocks:          825 (432537600 bytes, 412.5 MiB)
Minimum input/output unit size: 4096 bytes
Sub-page size:                  1024 bytes
OOB size:                       224 bytes
Character device major/minor:   90:22
Bad blocks are allowed:         true
Device is writable:             true
Default UBI VID header offset:  1024
Default UBI data offset:        4096
Default UBI LEB size:           520192 bytes, 508.0 KiB
Maximum UBI volumes count:      128 

 根据分析信息,用ubi镜像制作工具,制作镜像,注意参数一定要和分区信息一致

mkfs.ubifs的参数定义

ubi文件系统制作

ubinize 的参数定义

ubi文件系统制作

 

mtd9的参数填写,-e  -c  -m -s  

        @cd $(TI_SDK_PATH)/filesystem; $(TI_SDK_PATH)/bin/mkfs.ubifs -r $(DESTDIR_XJ_ALLSINFO) -F -m 4096 -e 516096 -c 988 -o ubifs.img; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; $(TI_SDK_PATH)/bin/ubinize -o ubi.img -m 4096 -p 512KiB -s 4096 ubinize.cfg; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; rm ubifs.img; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; mkdir generated 1>/dev/null 2>/dev/null; cd - 1>/dev/null
        @cd $(TI_SDK_PATH)/filesystem; mv ubi.img ./generated/; cd - 1>/dev/null;

mtd10的参数填写,-e  -c  -m -s  

        @cd $(TI_SDK_PATH)/filesystem; $(TI_SDK_PATH)/bin/mkfs.ubifs -r $(DESTDIR_XJ_ALLSINFO)/usrinit -F -m 4096 -e 520192 -c 200 -o usrinitfs.img; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; $(TI_SDK_PATH)/bin/ubinize -o usrinit.img -m 4096 -p 512KiB -s 1024 ubi-usrinit.cfg; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; rm usrinitfs.img; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; mkdir generated 1>/dev/null 2>/dev/null; cd - 1>/dev/null
        @cd $(TI_SDK_PATH)/filesystem; mv usrinit.img ./generated/; cd - 1>/dev/null;

mtd11的参数填写,-e  -c  -m -s

        @cd $(TI_SDK_PATH)/filesystem; $(TI_SDK_PATH)/bin/mkfs.ubifs -r $(DESTDIR_XJ_ALLSINFO)/usrdsk -F -m 4096 -e 520192 -c 825 -o usrdskfs.img; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; $(TI_SDK_PATH)/bin/ubinize -o usrdsk.img -m 4096 -p 512KiB -s 1024 ubi-usrdsk.cfg; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; rm usrdskfs.img; cd - 1>/dev/null;
        @cd $(TI_SDK_PATH)/filesystem; mkdir generated 1>/dev/null 2>/dev/null; cd - 1>/dev/null
        @cd $(TI_SDK_PATH)/filesystem; mv usrdsk.img ./generated/; cd - 1>/dev/null;   

 镜像配置菜单mtd9 ubinize.cfg

[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=464MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

 镜像配置菜单mtd10  ubi-usrinit.cfg

[ubifs]
mode=ubi
image=usrinitfs.img
vol_id=1
vol_size=60MiB
vol_type=dynamic
vol_name=usrinit
vol_flags=autoresize

 镜像配置菜单mtd11  ubi-usrdsk.cfg  

[ubifs]
mode=ubi
image=usrdskfs.img
vol_id=2
vol_size=300MiB
vol_type=dynamic
vol_name=usrdsk
vol_flags=autoresize