zoukankan      html  css  js  c++  java
  • ubi文件系统之1,mkfs.ubifs 制作UBIFS 镜像

    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: 

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

    1.ubinize支持哪些选项

    Usage: ubinize [options] <ini-file>

    Generate UBI images. An UBI image may contain one or more UBI volumes which
    have to be defined in the input configuration ini-file. The flash
    characteristics are defined via the command-line options.

    -o, --output=<file name> output file name
    -p, --peb-size=<bytes> size of the physical eraseblock of the flash this UBI image is created for in bytes,kilobytes (KiB), or megabytes (MiB) (mandatory parameter)
    -m, --min-io-size=<bytes> minimum input/output unit size of the flash in bytes
    -s, --sub-page-size=<bytes> minimum input/output unit used for UBI headers, e.g. sub-page size in case of NAND flash (equivalent to the minimum input/output unit size by default)
    -O, --vid-hdr-offset=<num> offset if the VID header from start of the physical eraseblock (default is the next minimum I/O unit or sub-page after the EC header)
    -e, --erase-counter=<num> the erase counter value to put to EC headers (default is 0)
    -x, --ubi-ver=<num> UBI version number to put to EC headers (default is 1)
    -Q, --image-seq=<num> 32-bit UBI image sequence number to use
    (by default a random number is picked)
    -v, --verbose be verbose
    -h, --help print help message
    -V, --version print program version

    2.重要选项-p -m -s -O -e

    -p 指定flash的物理擦除块大小

    -m 指定flash的最小输入输出单元,当为nor flash时,此值应指定为1,当为nand flash时此值应指定为页面大小

    -s 指定子页大小,当为nor flash时,此值应指定为1,当为nand flash时需指定此值为nand flash的子页大小

    -O 指定vid header的偏移量

    -e 指定放在EC头中的擦除计数器值,默认为0

  • 相关阅读:
    抓取六房间小姐姐小视频
    fiddler报错:creation of the root certificate was not successful 证书安装不成功
    修改cmd命令默认路径
    二维码的生成
    大话设计模式Python实现-单例模式
    大话设计模式Python实现-迭代器模式
    大话设计模式Python实现-组合模式
    大话设计模式Python实现-备忘录模式
    大话设计模式Python实现-适配器模式
    大话设计模式Python实现-状态模式
  • 原文地址:https://www.cnblogs.com/zxc2man/p/14073785.html
Copyright © 2011-2022 走看看