匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“MTD overview”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
MTD overview
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
'''SUMMARY '''<br> MTD(内存技术设备)子系统为原始闪存提供抽象层。 在使用不同的Flash类型和技术(例如,Flash)时,可以使用相同的API。 SLC NAND,SPI NOR,... == Framework purpose == 本文的目的是介绍MTD Linux子系统: * 一般信息 * 主要组成部分/利益相关者 * 如何使用MTD API ==System overview== [[File:MTD v1.1.0.png|center]] <div class="mw-collapsible mw-collapsed"> <div class="mw-collapsible-content"> [[File:mtd.png|center]] </div></div> ===Component description=== * 执行“文件I / O”的用户空间应用程序需要像对待磁盘一样查看闪存,而希望完成“原始I / O”的程序就像访问磁盘一样访问该存储器。 是一个角色设备。 * '''VFS''' (内核空间) 虚拟文件系统。 请参考VFS文档 <ref>{{CodeSource | Linux kernel | Documentation/filesystems/vfs.txt | VFS}} </ref>. * '''mtdchar''' (内核空间) 通常称为/ dev / mtdX。 对于MTD字符设备,请参考MTD概述文档 <ref>[http://www.linux-mtd.infradead.org/doc/general.html#L_overview MTD overview]</ref>. * '''mtdblock''' (内核空间) 通常称为/ dev / mtdblockX。 除非您确切知道自己在做什么,否则不要使用mtdblock。 对于MTD块设备,请参考MTD块文档<ref>[http://www.linux-mtd.infradead.org/doc/general.html#L_mtdblock MTD block]</ref>. * '''JFFS2''' (内核空间) 日记Flash文件系统。 请参考MTD JFFS2文档 <ref>[http://www.linux-mtd.infradead.org/doc/jffs2.html MTD JFFS2]</ref>. * '''UBI''' (内核空间) 未分类的块图像。 请参考MTD UBI文档 <ref>[http://www.linux-mtd.infradead.org/doc/ubi.html MTD UBI]</ref>. * '''UBIFS''' (内核空间) UBI文件系统。 请参考MTD UBIFS文档<ref>[http://www.linux-mtd.infradead.org/doc/ubifs.html MTD UBIFS]</ref>. * '''MTD core''' (内核空间) MTD内核为原始闪存提供了一个抽象层。 * '''Raw NAND subsystem''' (内核空间) MTD子系统中使用Raw NAND协议来连接NAND闪存。 * '''SPI-MEM subsystem''' (内核空间) SPI-MEM协议在MTD子系统中用于连接各种SPI存储器(NOR,NAND) * '''SPI-NAND subsystem''' (内核空间) SPI-NAND协议在MTD子系统中用于连接SPI NAND闪存。 * '''SPI-NOR subsystem''' (内核空间) MTD子系统中使用SPI-NOR协议来连接SPI NOR闪存。 * '''FMC driver''' (内核空间) / '''FMC''' (硬件) 请参阅[[FMC internal peripheral]]. * '''QUADSPI driver''' (Kernel space) / '''QUADSPI''' (Hardware) 请参阅[[QUADSPI internal peripheral]]. ===API description=== 有关Linux MTD API的描述,请参阅MTD API文档 <ref>[http://www.linux-mtd.infradead.org/doc/general.html#L_mtd_api MTD API]</ref>. ==Configuration == ===Kernel configuration=== ST交货中默认激活MTD。 但是,如果需要特定的配置,则本节说明如何在内核中激活/停用MTD。 使用Linux Menuconfig工具在内核配置中激活MTD:[[Menuconfig or how to configure kernel]]. ==== SLC NAND Flash memory ==== <pre> [*] Device Drivers ---> <*> Memory Technology Device (MTD) support ---> <*> RAW/Parallel NAND Device Support ---> <*> Support for NAND controller on STM32MP Socs. </pre> ==== SPI NOR/NAND Flash memory ==== <pre> [*] Device Drivers ---> <*> Memory Technology Device (MTD) support ---> Self-contained MTD device drivers ---> <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...) <*> SPI NAND device Support <*> SPI-NOR device support <*> SPI support ---> -*- SPI memory extension <*> STMicroelectronics STM32 QUAD SPI controller </pre> ===Device tree configuration=== 借助[[STM32CubeMX]]可以完成DT配置。 ==== NAND Flash memory ==== 请参考 [[FMC_device_tree_configuration| FMC device tree configuration]]. ==== SPI NOR/NAND Flash memory ==== 请参考 [[QUADSPI_device_tree_configuration| QUADSPI device tree configuration]]. == How to use the framework == A file system, which handles read/write/erase operations, can be used over the MTD Framework. Please refer to the [[How to support UBIFS through MTD|UBIFS support through MTD]]. You can also interact with the MTD subsystem using the MTD utilities. The MTD utilities<ref>[http://www.linux-mtd.infradead.org MTD utils]</ref> are a set of tools that can be used to perform operations on Flash memories through the MTD character interface. The most common utilities used are: * mtdinfo * flash_erase * flashcp * nandwrite * nanddump root:~# mtdinfo -a Count of MTD devices: 9 Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4, mtd5, mtd6, mtd7, mtd8 Sysfs interface supported: yes<br> mtd0 Name: fsbl Type: nand Eraseblock size: 262144 bytes, 256.0 KiB Amount of eraseblocks: 8 (2097152 bytes, 2.0 MiB) Minimum input/output unit size: 4096 bytes Sub-page size: 4096 bytes OOB size: 224 bytes Character device major/minor: 90:0 Bad blocks are allowed: true Device is writable: true<br> mtd1 Name: ssbl Type: nand Eraseblock size: 262144 bytes, 256.0 KiB Amount of eraseblocks: 8 (2097152 bytes, 2.0 MiB) Minimum input/output unit size: 4096 bytes Sub-page size: 4096 bytes OOB size: 224 bytes Character device major/minor: 90:2 Bad blocks are allowed: true Device is writable: true<br> mtd2 Name: UBI Type: nand Eraseblock size: 262144 bytes, 256.0 KiB Amount of eraseblocks: 4078 (1069023232 bytes, 1019.5 MiB) Minimum input/output unit size: 4096 bytes Sub-page size: 4096 bytes OOB size: 224 bytes Character device major/minor: 90:4 Bad blocks are allowed: true Device is writable: true<br> mtd3 Name: fsbl1 Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 4 (262144 bytes, 256.0 KiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:6 Bad blocks are allowed: false Device is writable: true<br> mtd4 Name: fsbl2 Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 4 (262144 bytes, 256.0 KiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:8 Bad blocks are allowed: false Device is writable: true<br> mtd5 Name: ssbl Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 32 (2097152 bytes, 2.0 MiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:10 Bad blocks are allowed: false Device is writable: true<br> mtd6 Name: logo Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 4 (262144 bytes, 256.0 KiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:12 Bad blocks are allowed: false Device is writable: true<br> mtd7 Name: nor_user Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 980 (64225280 bytes, 61.2 MiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:14 Bad blocks are allowed: false Device is writable: true<br> mtd8 Name: 58003000.qspi Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 1024 (67108864 bytes, 64.0 MiB) Minimum input/output unit size: 1 byte Sub-page size: 1 byte Character device major/minor: 90:16 Bad blocks are allowed: false Device is writable: true ==How to trace and debug the framework== ===How to monitor=== The sysfs interface provides detail information on each mtd device. root:~# cat /sys/class/mtd/mtd0/name fsbl root:~# cat /sys/class/mtd/mtd0/type nand root:~# cat /sys/class/mtd/mtd0/erasesize 262144 root:~# cat /sys/class/mtd/mtd0/ecc_strength 8 root:~# cat /sys/class/mtd/mtd0/bad_blocks 0 root:~# cat /sys/class/mtd/mtd0/ecc_failures 0 ===How to trace=== A detail dynamic trace is available here [[How to use the kernel dynamic debug]]. root:~# echo "file drivers/mtd/* +p" > /sys/kernel/debug/dynamic_debug/control ==Source code location== The MTD framework is {{CodeSource | Linux kernel | drivers/mtd | here}}. ==To go further== Please refer to the MTD FAQs documentation <ref>[http://www.linux-mtd.infradead.org/faq/general.html MTD FAQs]</ref>. ==References== Please refer to the following links for full description: <references /> <noinclude> {{ArticleBasedOnModel | Framework overview article model}} [[Category:Mass storage]] </noinclude>
该页面使用的模板:
模板:CodeSource
(
查看源代码
)
返回至
MTD overview
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志