- 论坛徽章:
- 0
|
本帖最后由 yifei_wang 于 2011-10-12 21:57 编辑
Create UBIFS image
UBIFS 是工作在 UBI 层之上的, 因此意味着创建 ubifs image 必须包括两个步骤: 1. 首先创建ubifs image; 2. 其次创建ubi image.
因此, 具体的ubifs image 创建过程如下(qumu 模拟的devkit8000):
1. 参数确定:
g-bios download kernel image 后, 输入命令 # boot -f 7, 得到如下信息:- [ 1.472869] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron NAND 256MiB 1,8V 16-bit)
- [ 1.474914] 8 cmdlinepart partitions found on MTD device omap2-nand.0
- [ 1.475708] Creating 8 MTD partitions on "omap2-nand.0":
- [ 1.476684] 0x000000000000-0x000000080000 : "g-bios"
- [ 1.496276] 0x000000080000-0x000000280000 : "g-bios"
- [ 1.510803] 0x000000280000-0x0000002a0000 : "g-bios"
- [ 1.522949] 0x0000002a0000-0x0000005a0000 : "linux"
- [ 1.537353] 0x0000005a0000-0x0000008a0000 : "ramdisk"
- [ 1.552001] 0x0000008a0000-0x0000048a0000 : "rootfs"
- [ 1.603271] 0x0000048a0000-0x0000088a0000 : "data_1"
- [ 1.655029] 0x0000088a0000-0x000010000000 : "data_2"
- [ 1.740753] OneNAND driver initializing
- [ 1.748260] UBI: attaching mtd7 to ubi0
- [ 1.748992] UBI: physical eraseblock size: 131072 bytes (128 KiB)
- [ 1.749755] UBI: logical eraseblock size: 129024 bytes
- [ 1.750427] UBI: smallest flash I/O unit: 2048
- [ 1.751037] UBI: sub-page size: 512
- [ 1.751586] UBI: VID header offset: 512 (aligned 512)
- [ 1.753173] UBI: data offset: 2048
- [ 3.494934] UBI: max. sequence number: 0
- [ 3.495666] UBI error: ubi_read_volume_table: the layout volume was not found
- [ 3.499847] UBI error: ubi_init: cannot attach mtd7
复制代码 据此可以得到相应的 flash 参数:
1. physical eraseblock size: 131072 bytes (128 KiB)
2. logical eraseblock size: 129024 bytes
3. smallest flash I/O unit: 2048
4. sub-page size: 512
5. VID header offset: 512 (aligned 512)
6. data offset: 2048
2. 创建简单 rootfs 目录: lablin
作为测试,该目录中仅包含 dev/, proc/, sys/, etc/ 等空目录.
3. 创建 ubifs image:- $ mkfs.ubifs -q -r lablin -m 2048 -e 129024 -c 1024 -o ubifs.img
复制代码 4. 创建 ubi image:- $ ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubinize.cfg
复制代码 其中 ubinize.cfg 内容为:- [ubifs]
- mode=ubi
- image=ubifs.img
- vol_id=0
- vol_size=100MiB
- vol_type=dynamic
- vol_name=rootfs
- vol_flags=autoresize
复制代码 创建成功后, 将 ubi.img 通过 g-bios 中 tftp download 到相应的分区7, 并且启动, 出现如下错误:- [ 3.495666] UBI error: ubi_read_volume_table: the layout volume was not found
- [ 3.499847] UBI error: ubi_init: cannot attach mtd7
复制代码 并且启动是由 g-bios 传入到 kernel 的 command line 为:- [ 0.000000] Kernel command line: ubi.mtd=7 root=ubi0_0 rootfstype=ubifs mtdparts=omap2-nand.0:0x80000@0x0(g-bios),0x200000@0x80000(g-bios),0x20000@0x280000(g-bios),0x300000@0x2A0000(linux),0x300000@0x5A0000(ramdisk),0x4000000@0x8A0000(rootfs),0x4000000@0x48A0000(data_1),0x7760000@0x88A0000(data_2) ip=10.0.0.2:10.0.0.1:10.0.0.1:255.255.255.0:maxwit.googlecode.com:eth0:off console=ttyO0,115200
复制代码 这与没有 download ubi image 到分区中效果是一样的, 因此有理由怀疑是 ubi image 制作的问题...
继续解决中...
参考资料:
1. http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mkfubifs |
|