前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Linux下,如何验证SD/EMMC卡?

Linux下,如何验证SD/EMMC卡?

作者头像
董哥聊技术
发布2023-08-29 16:40:35
6050
发布2023-08-29 16:40:35
举报
文章被收录于专栏:嵌入式艺术嵌入式艺术

Linux下mmc_test测试工具使用

很多朋友也都有疑问,如何在Linux下,测试emmc/sd模块呢? 当然,mmc core提供了mmc_test.c来作为mmc driver的测试文件。

如何使用mmc_test.c测试文件测试mmc 驱动呢?

1、将mmc_test.c编译到内核

默认情况下,mmc_test.c是独立的文件,并没有编译到内核中,需要我们到menuconfig中手动打开。

打开的配置有:CONFIG_MMC_TESTCONFIG_MMC_DEBUGCONFIG_DEBUG_FS三个配置。

注意CONFIG_MMC_TEST,该选项可以选择M*,分别对应为:编译成模块或者直接编译到内核

这里我们选择*

2、mmc_test绑定

默认情况下,我们一般都已经加载了mmc driver,那么要想使用mmc_test工具测试,需要将mmc设备绑定到该mmc_test驱动上。

2.1、查看驱动编号

通过下面命令,查询对应的mmc编号,如下:mmc0:0001,忽略掉\

代码语言:javascript
复制
ls /sys/bus/mmc/drivers/mmcblk/mmc0\:0001/

2.2、解绑mmc原驱动

代码语言:javascript
复制
echo mmc0:0001 >  /sys/bus/mmc/drivers/mmcblk/unbind

2.3、绑定mmc_test驱动

代码语言:javascript
复制
echo mmc0:0001 > /sys/bus/mmc/drivers/mmc_test/bind

2.4、debugfs挂载

代码语言:javascript
复制
mount -t debugfs none /sys/kernel/debug

2.5、查看测试列表

代码语言:javascript
复制
cd /sys/kernel/debug/mmc0/mmc0\:0001/
cat testlist 
代码语言:javascript
复制
0:      Run all tests
1:      Basic write (no data verification)
2:      Basic read (no data verification)
3:      Basic write (with data verification)
4:      Basic read (with data verification)
5:      Multi-block write
6:      Multi-block read
7:      Power of two block writes
8:      Power of two block reads
9:      Weird sized block writes
10:     Weird sized block reads
11:     Badly aligned write
12:     Badly aligned read
13:     Badly aligned multi-block write
14:     Badly aligned multi-block read
15:     Correct xfer_size at write (start failure)
16:     Correct xfer_size at read (start failure)
17:     Correct xfer_size at write (midway failure)
18:     Correct xfer_size at read (midway failure)
19:     Highmem write
20:     Highmem read
21:     Multi-block highmem write
22:     Multi-block highmem read
23:     Best-case read performance
24:     Best-case write performance
25:     Best-case read performance into scattered pages
26:     Best-case write performance from scattered pages
27:     Single read performance by transfer size
28:     Single write performance by transfer size
29:     Single trim performance by transfer size
30:     Consecutive read performance by transfer size
31:     Consecutive write performance by transfer size
32:     Consecutive trim performance by transfer size
33:     Random read performance by transfer size
34:     Random write performance by transfer size
35:     Large sequential read into scattered pages
36:     Large sequential write from scattered pages
37:     Write performance with blocking req 4k to 4MB
38:     Write performance with non-blocking req 4k to 4MB
39:     Read performance with blocking req 4k to 4MB
40:     Read performance with non-blocking req 4k to 4MB
41:     Write performance blocking req 1 to 512 sg elems
42:     Write performance non-blocking req 1 to 512 sg elems
43:     Read performance blocking req 1 to 512 sg elems
44:     Read performance non-blocking req 1 to 512 sg elems
45:     Reset test
46:     Commands during read - no Set Block Count (CMD23)
47:     Commands during write - no Set Block Count (CMD23)
48:     Commands during read - use Set Block Count (CMD23)
49:     Commands during write - use Set Block Count (CMD23)
50:     Commands during non-blocking read - use Set Block Count (CMD23)
51:     Commands during non-blocking write - use Set Block Count (CMD23)

2.6、测试指定命令

代码语言:javascript
复制
echo number > test

number:是上面的测试序号。

如:echo 1 > test

代码语言:javascript
复制
mmc0: Starting tests of card mmc0:0001...
mmc0: Test case 1. Basic write (no data verification)...
mmc0: Result: OK

这个工具可以尽可能的帮助我们测试SD/EMMC卡,使用起来吧!

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2023-07-07,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 嵌入式艺术 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Linux下mmc_test测试工具使用
    • 1、将mmc_test.c编译到内核
      • 2、mmc_test绑定
        • 2.1、查看驱动编号
        • 2.2、解绑mmc原驱动
        • 2.3、绑定mmc_test驱动
        • 2.4、debugfs挂载
        • 2.5、查看测试列表
        • 2.6、测试指定命令
    相关产品与服务
    腾讯云服务器利旧
    云服务器(Cloud Virtual Machine,CVM)提供安全可靠的弹性计算服务。 您可以实时扩展或缩减计算资源,适应变化的业务需求,并只需按实际使用的资源计费。使用 CVM 可以极大降低您的软硬件采购成本,简化 IT 运维工作。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档