<1>Download mtd-utils(v1.4.1)
http://git.infradead.org/mtd-utils.git
git clone git://git.infradead.org/mtd-utils.git
<2>Compile
mtd_debug:
arm-none-linux-gnueabi-gcc -static mtd_debug.c -o mtd_debug -I./include
nanddump:
arm-none-linux-gnueabi-gcc -c lib/libmtd.c -I./include
arm-none-linux-gnueabi-gcc -c lib/libmtd_legacy.c -I./include
arm-none-linux-gnueabi-gcc -static nanddump.c libmtd.o libmtd_legacy.o -o nanddump -I./include
<3>How to use mtd_debug
# cat /proc/mtd
dev: size erasesize name
mtd0: 000c0000 00020000 "Bootloader"
mtd1: 00040000 00020000 "misc"
mtd2: 01080000 00020000 "recovery"
mtd3: 00600000 00020000 "Kernel"
mtd4: 06000000 00020000 "system"
mtd5: 03c00000 00020000 "cache"
mtd6: 031c0000 00020000 "userdata"
mtd7: 00060000 00020000 "NVM"
a).Read some information from mtd layer.
# ./mtd_debug info /dev/mtd/mtd0
mtd.type = MTD_NANDFLASH
mtd.flags = MTD_CAP_ROM
mtd.size = 786432 (768K)
mtd.erasesize = 131072 (128K)
mtd.writesize = 2048 (2K)
mtd.oobsize = 64
regions = 0
b).Erase the nand flash partitions.
# ./mtd_debug erase /dev/mtd/mtd7 0 0x00060000
Erased 393216 bytes from address 0x00000000 in flash
<4>How to use the nanddump
# ./nanddump
Usage: nanddump [OPTIONS] MTD-device
Dumps the contents of a nand mtd partition.
--help display this help and exit
--version output version information and exit
-f file --file=file dump to file
-i --ignoreerrors ignore errors
-l length --length=length length
-n --noecc read without error correction
-o --omitoob omit oob data
-b --omitbad omit bad blocks from the dump
-p --prettyprint print nice (hexdump)
-s addr --startaddress=addr start address
nand flash测试工具集
最新推荐文章于 2023-10-30 11:02:38 发布