mkfs.ubifs & ubinize 用法

mkfs.ubifs 制作UBIFS 镜像

mkfs.ubifs的用法 
Usage: mkfs.ubifs [OPTIONS] target 
Make a UBIFS file system image from an existing directory tree 
Examples: 
Build file system from directory /opt/img, writting the result in the ubifs.img file 
        mkfs.ubifs -m 512 -e 128KiB -c 100 -r /opt/img ubifs.img 
The same, but writting directly to an UBI volume 
        mkfs.ubifs -r /opt/img /dev/ubi0_0 
Creating an empty UBIFS filesystem on an UBI volume 
        mkfs.ubifs /dev/ubi0_0 
Options: 

-r, -d, --root=DIR                    build file system from directory DIR 
-m, --min-io-size=SIZE         minimum I/O unit size,最小输入输出大小 
-e, --leb-size=SIZE               logical erase block size逻辑可擦出块大小 
-c, --max-leb-cnt=COUNT    maximum logical erase block count最大逻辑可擦出块数目 
-o, --output=FILE                  output to FILE输出文件名 
-j, --jrn-size=SIZE                  journal size 
-R, --reserved=SIZE             how much space should be reserved for the super-user 
-x, --compr=TYPE                 compression type - "lzo", "favor_lzo", "zlib" or "none" (default: "lzo") 
-X, --favor-percent                may only be used with favor LZO compression and defines 
                                               how many percent better zlib should compress to make 
                                               mkfs.ubifs use zlib instead of LZO (default 20%) 
-f, --fanout=NUM                   fanout NUM (default: 8) 
-F, --space-fixup                   file-system free space has to be fixed up on first moun
                                               (requires kernel version 3.0 or greater) 
-k, --keyhash=TYPE             key hash type - "r5" or "test" (default: "r5") 
-p, --orph-lebs=COUNT      count of erase blocks for orphans (default: 1) 
-D, --devtable=FILE            use device table FILE 
-U, --squash-uids                squash owners making all files owned by root 
-l, --log-lebs=COUNT         count of erase blocks for the log (used only for debugging) 
-v, --verbose                        verbose operation 
-V, --version                        display version information 
-g, --debug=LEVEL           display debug information (0 - none, 1 - statistics, 2 - files, 3 - more details) 
-h, --help                              display this help text 

例: 

mkfs.ubifs -x lzo -m 2KiB -e 124KiB -c 720 -o system_ubifs.img -d $path_to_system 

压缩格式为lzo 
-m最小输入输出大小为2KiB(2048bytes),一般为页大小 
-e逻辑可擦除块大小为124KiB=(每块的页数-2)*页大小=(64-2)*2KiB=124KiB 
-c最多逻辑可擦除块数目为720(720*128KiB=90MiB),这个可根据ubi volume来设置,实际上是设置此卷的最大容量。

 

ubinize命令可将使用mkfs.ubifs命令制作的UBIFS文件系统镜像转换成可直接在FLASH上烧写的格式(带有UBI文件系统镜像卷标):

ubinize -o ubi.img-m 2048 -p 128KiB-s 512 -O 2048 ubinize.cfg

ubinize.cfg为一些配置参数:

[ubifs]

mode=ubi

image=ubifs.img

vol_id=0

vol_size=100MiB

vol_type=dynamic

vol_alignment=1

vol_name=rootfs

vol_flags=autoresize

通过此命令生成的ubi.img可直接使用NAND FLASH的烧写命令烧写到FLASH上。

  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HarkerYX

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值