加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

通过UBI文件系统烧写flash

发布时间:2020-12-15 06:21:33 所属栏目:百科 来源:网络整理
导读:appfs文件太大,虽然可以在uboot通过tftp传输来烧写。但是同样也可以通过ubi文件系统来做这件事情。 Nand分区划分如下: device nand0 nx_2017,# parts = 4 ?#: name??????????????? size??????????? offset????????? mask_flags ?0: kernel????????????? 0x

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

Nand分区划分如下:
device nand0 <nx_2017>,# 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: image 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,LEB size 126976 bytes (124.0 KiB),dynamic,name "appfs",alignment 1

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读