以下是分析记录:
------------------------------------------------------------------------------
以上命令的参数可从 ubifs 挂载信息中提取:
UBI: attaching mtd5 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB) // -p:物理擦除块大小
UBI: logical eraseblock size: 129024 bytes // -e:逻辑擦除块大小(LEB size)
UBI: smallest flash I/O unit: 2048 // -m:页面大小
UBI: sub-page size: 512 // -s:最小的硬件输入输出页面大小
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd5 to ubi0
UBI: MTD device name: "File System-1"
UBI: MTD device size: 162 MiB
UBI: number of good PEBs: 1295 // -c:最大的逻辑擦除块数量,一般小于等于 block count -1
UBI: number of bad PEBs: 1 // -c:162*1024*1024/129024 = 1316, 162*1024*1024/(128*1024) = 1296(出错!!!)
// 对我们这种情况,文件系统最多可以访问卷上的 129024*812=100M 空间(可行!!!)
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 1295
UBI: number of PEBs reserved for bad PEB handling: 12
UBI: max/mean erase counter: 2/0
UBI: image sequence number: 936292432
UBI: background thread "ubi_bgt0d" started, PID 471
------------------------------------------------------------------------------
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 163602432 bytes (159768 KiB, 156 MiB, 1268 LEBs)
UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:12.
Freeing init memory: 164K
Failed to execute /init. Attempting defaults...
INIT: version 2.86 booting
Starting udevtar: removing leading ‘/‘ from member names
------------------------------------------------------------------------------
cd /devkit8500d/work
/devkit8500d/tools/bin/mkfs.ubifs -r rootfs -m 2048 -e 129024 -c 1996 -o ubifs.img
# 通过 mkfs.ubifs 命令制作的出的 UBIFS 文件系统镜像可在u-boot下使用ubi write命令烧写到NAND FLASH上
# 使用 ubinize 命令生产实际可用空间的 ubi 格式镜像,这样才可以通过 ubiformat 命令在板子上写入该文件系统镜像:
# ubinize,带有UBI文件系统镜像卷标
/devkit8500d/tools/bin/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 /devkit8500d/tools/bin/ubinize.cfg
#/devkit8500d/tools/bin/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 /devkit8500d/tools/bin/ubinize.cfg
cp /devkit8500d/work/ubi.img /mnt/hgfs/Ubuntu10.04/dyz/omap3devkit8500/image/
------------------------------------------------------------------------------
/devkit8500d/tools/bin/mkfs.ubifs -m 2048 -c 1296 -e 129024 -r /devkit8500d/work/rootfs -o ubifs.img
/devkit8500d/tools/bin/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 /devkit8500d/tools/bin/ubinize.cfg
出现错误:
...
UBIFS error (pid 1): ubifs_get_sb: cannot open "ubi0:rootfs", error -19
VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00 512 mtdblock0 (driver?)
...
------------------------------------------------------------------------------
修改 ubinize.cfg 文件
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=162MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
结果:
失败!!!
------------------------------------------------------------------------------
参考成功时候的信息
omap_vout omap_vout: : registered and initialized video device 1
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 163602432 bytes (159768 KiB, 156 MiB, 1268 LEBs) // 1268 LEBs 很重要!!!
UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:12.
Freeing init memory: 164K
Failed to execute /init. Attempting defaults...
INIT: version 2.86 booting
Starting udevtar: removing leading ‘/‘ from member names
重新运行:
/devkit8500d/tools/bin/mkfs.ubifs -m 2048 -c 1268 -e 129024 -r /devkit8500d/work/rootfs -o ubifs.img
/devkit8500d/tools/bin/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 /devkit8500d/tools/bin/ubinize.cfg
结果:
失败!!!
------------------------------------------------------------------------------
/devkit8500d/tools/bin/mkfs.ubifs -m 2048 -c 812 -e 129024 -r /devkit8500d/work/rootfs -o ubifs.img
/devkit8500d/tools/bin/ubinize -o ubi.img -m 2048 -p 128KiB -s 512 /devkit8500d/tools/bin/ubinize.cfg
成功,还是 -c 的问题
------------------------------------------------------------------------------