Creating and Flashing UBIFS with MTD Utils
转:http://wiki.atlas-embedded.com/index.php?title=Creating_and_Flashing_UBIFS_with_MTD_Utils
Contents
- 1 UBIFS
- 2 UBIFS User-space tools
- 3 Obtaining UBIFS Tools
- 4 Creating UBIFS
- 5 Flashing and Mounting UBIFS to NAND
UBIFS
UBIFS is next generation of JFFS2 file-system.
JFFS2 file systems works on MTD devices, UBIFS is works on UBI volumes which is on MTD devices.
UBIFS is much more quicker than JFFS2 and nowadays people prefer UBI as filesystem.
For more information on MTD, refer <http://www.linux-mtd.infradead.org/doc/general.html> ,on UBI refer <http://www.linux-mtd.infradead.org/doc/ubi.html> ,on UBIFS refer <http://www.linux-mtd.infradead.org/doc/ubifs.html>
UBIFS User-space tools
Most used UBIFS User-space tools are shown below.All All UBI tools support "-h" option and print sufficient usage information.You can use "-h" option to see help about commands.
ubinfo - provides information about UBI devices and volumes found in the system;
ubiattach - attaches MTD devices (which describe raw flash) to UBI and creates corresponding UBI devices;
ubidetach - detaches MTD devices from UBI devices (the opposite to what ubiattach does);
ubimkvol - creates UBI volumes on UBI devices;
ubirmvol - removes UBI volumes from UBI devices;
ubiupdatevol - updates UBI volumes; this tool uses the UBI volume update feature which leaves the volume in
"corrupted" state if the update was interrupted; additionally, this tool may be used to wipe
out UBI volumes;
ubicrc32 - calculates CRC-32 checksum of a file with the same initial seed as UBI would use;
ubinize - generates UBI images;
ubiformat - formats empty flash, erases flash and preserves erase counters, flashes UBI images to MTD devices;
mtdinfo - reports information about MTD devices found in the system.
Obtaining UBIFS Tools
The MTD and UBI user-space tools are available from the the following git repository:
git://git.infradead.org/mtd-utils.git
However,we suggest you to download our pre-built mtd-utils at here
Creating UBIFS
From information on how to create a UBIFS image. refer create an UBIFS image
- Boot from NFS.
- You can use following command to learn parameter which is necessary for UBIFS creation.
root@bosphorus-2:/# ./sbin_mtd/mtdinfo /dev/mtd7 -u
mtd7
Name: File System
Type: nand
Eraseblock size: 131072 bytes, 128.0 KiB
Amount of eraseblocks: 4036 (529006592 bytes, 504.5 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size: 512 bytes
OOB size: 64 bytes
Character device major/minor: 90:14
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 512
Default UBI data offset: 2048
Default UBI LEB size: 129024 bytes, 126.0 KiB
Maximum UBI volumes count: 128 root@bosphorus-1:/#
There are two steps for creating UBIFS.
First,
- mkfs.ubifs
General use of mkfs.ubifs,
# mkfs.ubifs -r </path/to/your/rootfs/tree> -m <min io size>
-e <LEB size> -c <Eraseblocks count>
-o </path/to/output/ubifs.img>
For Bosphorus-II,
mtd-utils# mkfs.ubifs/mkfs.ubifs -r /your-rootfs/ -F -o ubifs.img -m 2048 -e 126976 -c 4036
The output of the above command, ubifs.img is fed into the 'ubinize' program to wrap it into a UBI image.
The images produced by mkfs.ubifs must be further fed to the ubinize tool to create a UBI image which must be put to the raw flash to be used a UBI partition.
Second step,
- Create ubinize.cfg file and write the contents into it
mtd-utils# vi ubinize.cfg
[ubifs] <== Section header
mode=ubi <== Volume mode (other option is static)
image=ubifs.img <== Source image
vol_id=0 <== Volume ID in UBI image
vol_size=400MiB <== Volume size
vol_type=dynamic <== Allow for dynamic resize
vol_name=rootfs <== Volume name
vol_flags=autoresize <== Autoresize volume at first mount
- ubinize
General use of ubinize,
ubinize -o <output image> -m <min io size> -p <PEB size>KiB <configuration file>
For Bosphorus-II,
./sbin_mtd/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
For more information about parameter you can use "-h" option.
Where:
-o ubi.img
Output file
-m 2KiB (or 2048)
Minimum flash I/O size of 2KiB page
-p 128KiB
Size of the physical eraseblock of the flash this UBI image is created for
-O 2048 offset if the VID header from start of the physical eraseblock
The output of the above command, 'ubi.img' is the required image.
Flashing and Mounting UBIFS to NAND
Yo can use following command to flash UBIFS.
root@bosphorus-2:/# ./sbin_mtd/ubiformat /dev/mtd7 -f ubi.img -s 512 -O 2048
ubiformat: mtd7 (nand), size 529006592 bytes (504.5 MiB), 4036 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 4035 -- 100 % complete
ubiformat: 4036 eraseblocks have valid erase counter, mean value is 1
ubiformat: flashing eraseblock 53 -- 100 % complete
ubiformat: formatting eraseblock 4035 -- 100 % complete
Attaching UBIFS, you can use following command.If you want to mount UBIFS, firstly you should attach it.You can use ubidetach for detaching.
root@bosphorus-2:/# ./sbin_mtd/ubiattach --vid-hdr-offset 2048 /dev/ubi_ctrl -m7
[ 1211.819305] UBI: attaching mtd7 to ubi0
[ 1211.823455] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1211.830078] UBI: logical eraseblock size: 126976 bytes
[ 1211.835723] UBI: smallest flash I/O unit: 2048
[ 1211.840698] UBI: sub-page size: 512
[ 1211.845520] UBI: VID header offset: 2048 (aligned 2048)
[ 1211.851867] UBI: data offset: 4096
[ 1216.159484] UBI: max. sequence number: 0
[ 1216.197570] UBI: volume 0 ("rootfs") re-sized from 3304 to 3992 LEBs
[ 1216.211334] UBI: attached mtd7 to ubi0
[ 1216.215301] UBI: MTD device name: "File System"
[ 1216.221099] UBI: MTD device size: 504 MiB
[ 1216.226318] UBI: number of good PEBs: 4036
[ 1216.231262] UBI: number of bad PEBs: 0
[ 1216.235931] UBI: number of corrupted PEBs: 0
[ 1216.240600] UBI: max. allowed volumes: 128
[ 1216.245452] UBI: wear-leveling threshold: 4096
[ 1216.250396] UBI: number of internal volumes: 1
[ 1216.255065] UBI: number of user volumes: 1
[ 1216.259735] UBI: available PEBs: 0
[ 1216.264404] UBI: total number of reserved PEBs: 4036
[ 1216.269592] UBI: number of PEBs reserved for bad PEB handling: 40
[ 1216.276000] UBI: max/mean erase counter: 4/2
[ 1216.280487] UBI: image sequence number: 295372338
[ 1216.285919] UBI: background thread "ubi_bgt0d" started, PID 1967
UBI device number 0, total 4036 LEBs (512475136 bytes, 488.7 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
root@bosphorus-2:/#
To mount UBIFS,
root@bosphorus-2:/# mount -t ubifs ubi0:rootfs /mnt/
[ 1310.544067] UBIFS: start fixing up free space
[ 1311.091491] UBIFS: free space fixup complete
[ 1311.098175] UBIFS: mounted UBI device 0, volume 0, name "rootfs"
[ 1311.104553] UBIFS: file system size: 505491456 bytes (493644 KiB, 482 MiB, 3981 LEBs)
[ 1311.112945] UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
[ 1311.120635] UBIFS: media format: w4/r0 (latest is w4/r0)
[ 1311.126770] UBIFS: default compressor: lzo
[ 1311.131072] UBIFS: reserved for root: 0 bytes (0 KiB)
root@bosphorus-2:/#
U-Boot Bootargs Command for UBIFS
setenv bootargs console=ttyO0,115200 ubi.mtd=X,YYYY rootfstype=ubifs root=ubi0:rootfs rw
Where X is the MTD partition number being used for file system and YYYY is the NAND page size.Make sure that an UBI file system is flashed into this partition before passing it as a boot partition for Linux
Assuming mtd 5,
setenv bootargs console=ttyO0,115200 root=ubi0:rootfs ubi.mtd =7,2048 rw rootfstype=ubifs ip=dhcp
saveenv
Note : Above steps can be done with Network File System or SD/MMC File System.
Creating and Flashing UBIFS with MTD Utils的更多相关文章
- UBIFS介绍 - MTD网站
转:http://blog.csdn.net/kickxxx/article/details/6583463 目录(?)[-] Big red note Overview Scalabity Writ ...
- Ubifs Support
参考:http://processors.wiki.ti.com/index.php/UBIFS_Support#Creating_UBIFS_file_system UBIFS UBIFS may ...
- android和ubifs
原文地址: http://opendevkit.com/?e=37 1. ubifs号称性能比yaffs2 好,同时压缩可读写,文件系统image体较小同时可写,相当不错 2. ubifs制作 (1) ...
- Is an MTD device a block device or a char device?
转:http://www.linux-mtd.infradead.org/faq/general.html#L_mtd_what Note, you can find Ukranian transla ...
- 让Android系统支持ubifs文件系统
原文地址:http://www.cnblogs.com/linucos/p/3279381.html 1. ubifs号称性能比yaffs2 好,同时压缩可读写,文件系统image体较小同时可写,相当 ...
- UBIFS - UBI File-System
参考:http://www.linux-mtd.infradead.org/doc/ubifs.html#L_raw_vs_ftl UBIFS - UBI File-System Table of c ...
- 使用ubifs格式的根文件系统
配置内核,使其支持ubifs文件系统 1)Device Drivers --->Memory Technology Device (MTD) support --->UBI - Uns ...
- 使用ubifs格式的根文件系统---过程记录
配置内核,使其支持ubifs文件系统 1)Device Drivers --->Memory Technology Device (MTD) support --->UBI - Uns ...
- UBI 文件系统移植 sys 设备信息【转】
转自:http://blog.chinaunix.net/uid-25304914-id-3058647.html cat /sys/class/misc/ubi_ctrl/dev --------- ...
随机推荐
- 【NOI 2015网络同步赛】
今年没法去.. 分数160+181+100(假设我有去考笔试)=441 分数线:金548 银459 铜331 并没有到银牌线.... 以后题目啊数据啊出来的话继续更新 2015.7.19
- eclipse增加jar包方式对比
add external jars = 增加工程外部的包add jars = 增加工程内包add library = 增加一个库add class folder = 增加一个类文件夹 add jar ...
- eclipse中git的使用
首先在Eclipse中安装EGit插件,如下图: 1. 2.点击Add 3. 4. 5. 给Eclipse安装插件很少遇到没被屏蔽的,这是一个.安装过程并不长,稍候即可. 安装成功之后我们就可以使用了 ...
- 转:Android 的进程与线程总结
当一个Android应用程序组件启动时候,如果此时这个程序的其他组件没有正在运行,那么系统会为这个程序 以单一线程的形式启动一个新的Linux 进程. 默认情况下,同一应用程序下的所有组件都运行再相同 ...
- ASIHttprequest-创建同步请求
ASIHttprequest-创建同步请求 当你发送一个同步请求后,该请求会在当前的应用主线程中运行并获取程序的控制权限,也就说你的程序处于锁定的状态,在这个期间,你进行不了任何的操作,直到该请求返回 ...
- 结构型设计模式之代理模式(Proxy)
结构 意图 为其他对象提供一种代理以控制对这个对象的访问. 适用性 在需要用比较通用和复杂的对象指针代替简单的指针的时候,使用P r o x y 模式.下面是一 些可以使用P r o x y 模式常见 ...
- gdb 记录临时变量
gdb ./pgm set logging file log set logging on ... set logging off gdb ./pgm | tee -a log ... file a. ...
- SVN如何进行版本的还原
http://jingyan.baidu.com/article/d621e8da0d07022865913fa5.html 工具/原料 SVN乌龟软件和相关的文件 百度经验:jingyan.baid ...
- 函数atof,atoi,atol,strtod,strtol,strtoul 描述
函数atof,atoi,atol,strtod,strtol,strtoul atof(将字串转换成浮点型数) 相关函数 atoi,atol,strtod,strtol,strtoul表头文件 #in ...
- 给notepad++加nppFtp插件连接ubuntu编写文本
打开notepad++的菜单栏中的插件,如果没有“插件管理”,去https://github.com/ashkulz/NppFTP/releases/tag/v0.27.2,下载对应的版本,将其解压后 ...