zoukankan      html  css  js  c++  java
  • Ubuntu 利用 mtd-utils 制作ubifs.img

    --- title: Ubuntu 利用 mtd-utils 制作ubifs.img date: 2019/10/11 17:24:15 categories: tags: - Ubuntu - mtd - rootfs ---
    确保已经安装了有关的工具
    sudo apt-get install mtd-utils
    

    需要的配置文件:

    $ cat ubi.cfg
    [ubifs-volumn]
    mode=ubi
    image=./rootfslink.ubiimg
    vol_id=0
    vol_type=dynamic
    vol_alignment=1
    vol_name=ubifs
    vol_flags=autoresize
    
    $ cat ubi.sh
    INPUT=$1sudo mkfs.ubifs -d ${INPUT} -m 2048 -o rootfslink.ubiimg -e 126976 -c 120000 -F -v
    sudo ubinize -o ${INPUT}.img -m 2KiB -p 128KiB ubi.cfg -v
    sudo rm rootfslink.ubiimg
    

    输入

    mkfs.ubifs -d fs -m 2048 -o rootfslink.ubiimg -e 126976 -c 120000 -F -v
    sleep 1
    sync
    ubinize -o fs.img -m 2KiB -p 128KiB ubi.cfg -v
    sleep 1
    rm rootfslink.ubiimg
    sync
    

    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
    

    重要选项

    -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
    

    3.ubinize这个工具存在什么意义?

    既然有了mkfs.ubifs,为什么又出现了ubinize这个工具,只有经过ubinize处理过的镜像文件烧写到flash中后,ubi工具才能正确处理这些存储在flash中的数据

  • 相关阅读:
    python的thread模块作用
    Python2、3解释器inpurt()函数的区别
    python中的单例设计模式
    Python2、3解释器中字符串中的区别
    浏览器向服务器发送请求的请求头解析
    Python中输出函数print()的三个参数
    Python中四种交换两个变量的值的方法
    学习爬虫看着篇(基础篇)
    Python读写txt文件时的编码问题
    网页和自然语言处理中的字符问题(半角和全角)
  • 原文地址:https://www.cnblogs.com/schips/p/13178939.html
Copyright © 2011-2022 走看看