appfs文件太大,虽然可以在uboot通过tftp传输来烧写。但是同样也可以通过ubi文件系统来做这件事情。

Nand分区划分如下:
device nand0 , # parts = 4
 #: name                size            offset          mask_flags
 0: kernel              0x00a00000      0x00100000      0
 1: root                0x00f00000      0x00a00000      0
 2: appfs               0x05000000      0x01900000      0
 3: datac               0x01700000      0x06900000      0

 

板子配置nfs启动以后,先将分区格式化:
# ubiformat /dev/mtd2 -y

ubiformat: mtd2 (nand), size 83886080 bytes (80.0 MiB), 640 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 639 -- 100 % complete
ubiformat: 511 eraseblocks have valid erase counter, mean value is 0
ubiformat: 129 eraseblocks are supposedly empty
ubiformat: warning!: only 511 of 640 eraseblocks have valid erase counter
ubiformat: mean erase counter 0 will be used for the rest of eraseblock
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 639 -- 100 % complete

然后将这个分区attach到ubi文件系统中:
# ubiattach /dev/ubi_ctrl -m 2


UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "appfs"
UBI: MTD device size:            80 MiB
UBI: number of good PEBs:        640
UBI: number of bad PEBs:         0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     0
UBI: available PEBs:             630
UBI: total number of reserved PEBs: 10
UBI: number of PEBs reserved for bad PEB handling: 6
UBI: max/mean erase counter: 0/0
UBI: p_w_picpath sequence number: 1404847517
UBI: background thread "ubi_bgt0d" started, PID 695
UBI device number 0, total 640 LEBs (81264640 bytes, 77.5 MiB), available 630 LEBs (79994880 bytes, 76.3 MiB), LEB size 126976 bytes (124.0 KiB)

然后创建一个volume,名字为你的mtd分区名
# ubimkvol /dev/ubi0 -N appfs -m


Set volume size to 79994880
Volume ID 0, size 630 LEBs (79994880 bytes, 76.3 MiB), LEB size 126976 bytes (124.0 KiB), dynamic, name "appfs", alignment 1

然后mount这个volume到指定位置
# mount -t ubifs ubi0:appfs /mnt/