关于闪存布局可参考官网文档 Flash Layouthtml
关于OpenWrt的文件系统内容能够参考 Filesystemslinux
本篇文章均参考以上两篇文章。bootstrap
进入设备后能够经过/proc/mtdless
root@fogcell:~# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00010000 "u-boot" mtd1: 00010000 00010000 "u-boot-env" mtd2: 00e30000 00010000 "rootfs" mtd3: 00620000 00010000 "rootfs_data" mtd4: 00170000 00010000 "kernel" mtd5: 00010000 00010000 "art" mtd6: 00fa0000 00010000 "firmware"
与/proc/partitions ,查看到系统的分区信息。erasesize 为单位擦除的最小单位, 其为64KBide
root@fogcell:~# cat /proc/partitions major minor #blocks name 31 0 256 mtdblock0 31 1 64 mtdblock1 31 2 14528 mtdblock2 31 3 6272 mtdblock3 31 4 1472 mtdblock4 31 5 64 mtdblock5 31 6 16000 mtdblock6
以上的这些信息能够在设备启动的串口打印数据中找到以下:布局
[ 0.710000] bootconsole [early0] disabled [ 0.710000] bootconsole [early0] disabled [ 0.720000] m25p80 spi0.0: found w25q128, expected m25p80 [ 0.730000] m25p80 spi0.0: w25q128 (16384 Kbytes) [ 0.730000] 6 cmdlinepart partitions found on MTD device spi0.0 [ 0.740000] Creating 6 MTD partitions on "spi0.0": [ 0.740000] 0x000000000000-0x000000040000 : "u-boot" [ 0.750000] 0x000000040000-0x000000050000 : "u-boot-env" [ 0.750000] 0x000000050000-0x000000e80000 : "rootfs" [ 0.760000] mtd: device 2 (rootfs) set to be root filesystem [ 0.770000] 1 squashfs-split partitions found on MTD device rootfs [ 0.770000] 0x000000860000-0x000000e80000 : "rootfs_data" [ 0.780000] 0x000000e80000-0x000000ff0000 : "kernel" [ 0.780000] 0x000000ff0000-0x000001000000 : "art" [ 0.790000] 0x000000050000-0x000000ff0000 : "firmware"
此次使用的是16MB的FLASH存储芯片,不一样机型不一样。针对以上信息,有以下的解释。英文版的内容更丰富The OpenWrt Flash Layoutthis
通用的Flash layout 以下spa
The generic Flash layout is:操作系统
对本设备来讲,总共 16384 KB = 256 KiB + 64 KiB + 16000 KiB + 64 KiB = 16 MiBrest
bootloader partition(s) : "u-boot" 256 KiB
optional SoC specific partition(s): "u-boot-env" 64 KiB
OpenWrt firmware partition: "kernel" + "rootfs" ="firmware" 16000 KiB 其中 "rootfs" = "rootfs_data" (6272 KiB)+ 8256 KiB
optional SoC specific partition(s
这是官网针对此型号的例子。
这种存储芯片可被认为是块(block)设备,与之类似的是内存。若是操做系统(Linux)能够直接读取叫作“raw flash”,若是闪存芯片不可以直接被操做系统读取(还须要在闪存中间添加额外的控制芯片来链接的)叫作“FTL (Flash Translation Layer)flash” 。嵌入式系统中经常使用的就是“raw flash”,USB存储设备使用的是 FTL flash。 详细信息可查看连接 Raw flash vs. FTL devices
官网对以上图片的解释以下:
Since the partitions are nested we look at this whole thing in layers:
ath9k
(wireless driver) won't come up anymore. The bootloader (128 KiB) contains of the u-boot 64KiB block AND a data section which contains the MAC, WPS-PIN and type description. If no MAC is configured ath9k will not work correctly due to a faulty MAC.
待更新。。