- /**********************************************************************
- * busybox devmem 直接获取, 修改内存信息
- * 说明:
- * 有时候再进行一些硬件测试的时候为了加快处理速度, 可能会希望通过
- * shell 直接修改内存地址中的信息, devmem 内部还是 mmap 进行地址映射, 另外
- * 觉得可以直接用 outb/inb 等函数直接操作.
- *
- * 2018-6-25 深圳 宝安西乡 曾剑锋
- *********************************************************************/
- 一, 参考文档:
- 1. How to access the i.MX6 unique ID/serial number in Linux
- https://community.nxp.com/thread/434775
- 2. Linux 驱动开发常用内存调试工具 memtool and devmem
- https://blog.csdn.net/mike8825/article/details/51505218
- 二, devmem help
- [buildroot@root ~/lmbench-3.0-a9/scripts]# devmem --help
- BusyBox v1.26.2 (2018-06-21 15:47:27 CST) multi-call binary.
- Usage: devmem ADDRESS [WIDTH [VALUE]]
- Read/write from physical address
- ADDRESS Address to act upon
- WIDTH Width (8/16/...)
- VALUE Data to be written
- 三, 用 i.MX6 SN 验证 devmem 获取地址数据正确性:
- [buildroot@root ~]# cat /sys/fsl_otp/HW_OCOTP_CFG0
- 0xe6b416f0
- [buildroot@root ~]# cat /sys/fsl_otp/HW_OCOTP_CFG1
- 0x1f2231d4
- [buildroot@root ~]# devmem 0x21BC410 32
- 0xE6B416F0
- [buildroot@root ~]# devmem 0x21BC420 32
- 0x1F2231D4
来源: http://www.bubuko.com/infodetail-2659006.html