嵌入式Linux中基于MTD的文件系统的结构框架图

简介: 转载时请注明原文出处(http://blog.sina.com.cn/wyw1976)及作者邮箱(wyw1976@gmail.com)         闪存在嵌入式系统中充当硬盘的角色,一般有NAND, OneNand, Nor等种类。
转载时请注明原文出处( http://blog.sina.com.cn/wyw1976 )及作者邮箱( wyw1976@gmail.com )
 
 
    闪存在嵌入式系统中充当硬盘的角色,一般有NAND, OneNand, Nor等种类。主要的闪存厂商有三星,东芝等。有关不同闪存的区别可以参考http://www.linux-mtd.infradead.org/doc/onenand.html
   
    MTD(Memory Technology Devices)是一个软件抽象层,为了屏蔽不同种类和不同厂商的闪存,从而为上层的文件系统提供统一的接口。
 
    嵌入式的文件系统主要有YAFFS, JFFS,UBIFS等。
 
    闪存,MTD及文件系统之间的关系,如下图所示:
   
 
嵌入式Linux中基于MTD的文件系统的结构框架图
 
说明:
  (1)对于JFFS2或YAFFS2来说,它看到的是统一的mtd接口,而不论上面的硬件是NAND或ONENand, 厂商是三星还是东芝。这些接口包括mtd->read, mtd->write, mtd->erase等,参见include/linux/mtd.h
   (2) 内核中有一个分区表来统一系统中所有的nand, 例如下面就是一个分区表的例子:
    static struct mtd_partition partitions[] = { \
                [0] = { \
                        .name        = "Bootloader", \
                        .offset      = 0, \
                        .size        = 0x100000, \
                }, \
                [1] = { \
                        .name        = "MassStorage0", \
                        .offset      = 0x100000, \
                        .size        = MTDPART_SIZ_FULL, \
                }, \
        }
 
  分区表中,指定了每个mtd分区的名称,起始地址,大小及读写属性(例如有的系统分区会被写保护)
  (3)UBIFS特殊的一点是,他不是直接构建在MTD层上,而是构建在ubi volume上,而ubi volume是基于mtd分区的,具体可参考 http://blog.sina.com.cn/s/blog_5d9051c00100ejvj.html
  (4)上层用户除了可以通过文件系统读写mtd外,还可以通过mtd设备节点直接操作mtd。而每个mtd分区都会对应两种节点:
     /dev/mtdxx      ----------->字符设备节点
     /dev/mtdblockxx ----------->块设备节点
例如 "dd if=/dev/urandom of=/dev/mtdblock1 bs=1024 count=1024",就是跳过文件系统直接访问MTD设备
相关文章
|
9天前
|
安全 Linux 网络安全
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
94 2
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
|
9天前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
143 1
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
|
19天前
|
安全 Linux 网络安全
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.88 (macOS, Linux, Windows) - 开源渗透测试框架
300 0
|
27天前
|
缓存 安全 Linux
Metasploit Pro 4.22.8-2025082101 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025082101 (Linux, Windows) - 专业渗透测试框架
93 0
|
4月前
|
安全 Linux 网络安全
Metasploit Pro 4.22.7-2025061201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025061201 (Linux, Windows) - 专业渗透测试框架
132 3
Metasploit Pro 4.22.7-2025061201 (Linux, Windows) - 专业渗透测试框架
|
2月前
|
SQL 安全 Linux
Metasploit Pro 4.22.8-2025073001 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025073001 (Linux, Windows) - 专业渗透测试框架
128 0
|
5月前
|
安全 Unix Linux
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
122 5
Metasploit Pro 4.22.7-2025052201 (Linux, Windows) - 专业渗透测试框架
|
5月前
|
数据采集 安全 Linux
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
105 4
Metasploit Pro 4.22.7-2025051201 (Linux, Windows) - 专业渗透测试框架
|
5月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
128 4
Metasploit Framework 6.4.63 (macOS, Linux, Windows) - 开源渗透测试框架
|
6月前
|
存储 安全 Linux
Metasploit Pro 4.22.7-2025040601 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.7-2025040601 (Linux, Windows) - 专业渗透测试框架
214 1
Metasploit Pro 4.22.7-2025040601 (Linux, Windows) - 专业渗透测试框架