NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Mtdutils
About[edit]
The MTD Utilities are a collection of tools that allow the user to interact with the MTD subsystem in the kernel to perform operations on Flash devices. The most commonly used utilities supported are:
- flash_erase - Erases an erase block of flash
- flash_eraseall - Erases the entire flash device
- flashcp - Copies data into flash
- flash_info - Displays information about Flash devices
- flash_lock - Lock flash pages to prevent writing
- flash_unlock - Unlock flash pages to allow writing
- mkfs.jffs2 - Create a JFFS2 file system image from an existing file system
- nandwrite - Write an input file (i.e. JFFS2 or YAFFS2 image) to the NAND Flash device
Visit MTD utils home page for more information.
Source Download Location[edit]
Click on snapshot to get the tar.gz package.
Cross compiling[edit]
- Cross compilation command - make CC=$(TOOL_CHAIN_PREFIX)-gcc
- The TOOL_CHAIN_PREFIX corresponds to the tool chain in use. Set this based on your tool chain. Also make path to toolchain is exported as part of $PATH.
- Dependancy : The MTD utilities require the liblzo package to be installed on you Linux development host in order to compile. This package is usually installed in the /usr/local/lib directory as liblzo2.la and liblzo2.a
If you do not have liblzo installed you can download the sources from Download liblzo package. After downloading do the following -
- host$ tar xzf lzo-version.xy.z.tar.gz
- host$ cd lzo-x.yz.z
- host$ ./configure
- host$ make
- host$ make install
Now you can go for the mtd utils build as shown in first step.
Test setup[edit]
- EVM booted up with NFS configuration.
Execution[edit]
Nand write command
- ./nandwrite -b 1 -n /dev/mtd4 -p uImage
Nand write options
- -b --blockalign
- -n - Write without ecc
- -p - pad to page size
Flash info command
- ./flash_info /dev/mtd4
Nand dump command
- ./nanddump -f dump -n -l 5000 /dev/mtd2
- -f is filename option. The above command will dump 5000 bytes(length option -l) from /dev/mtd2 partition by reading without error correction(-n).
Copy to flash command
- ./flashcp file /dev/mtd4
ftl check command
- ./ftl_check -v /dev/mtd2
Mtd debug command
- ./mtd_debug info /dev/mtd2
- ./mtd_debug read /dev/mtd2 0 1000 dump
- ./mtd_debug write /dev/mtd4 0x0020000 1024 filename
Nand test command
- ./nandtest -k -o 0x0020000 -l 0x40000 /dev/mtd4
- -o is offset.
- -l is length in bytes.
- restore data after tests.
Flash erase command
- ./flash_eraseall -j /dev/mtd4
Scripts[edit]
Scripts, execution logs - File:Mtd utils script logs.zip