world leader in high performance signal processing
Trace: » mtd-utils

MTD Utilities

The mtd-utils package is a collection of utilities for managing flash devices at the MTD level. You can use them to program/erase/dump/test your various flash devices. Since they work at the MTD level, they should work with pretty much all types of flash memories out there (parallel NOR flash, serial/SPI NOR flash, NAND flash, etc…).

The mtd-utils home page can be found at http://www.linux-mtd.infradead.org/.

uClinux-dist Settings

All utilities can be found in your vendor/user configuration menu.

Flash Tools  --->
  [ ] mtd-utils
  [ ]   flash_erase
  [ ]   flash_eraseall
  [ ]   lock
  [ ]   unlock
  [ ]   ftl_check
  [ ]   ftl_format
  [ ]   mkfs.jffs
  [ ]   mkfs.jff2
  [ ]   nftldump
  [ ]   nftl_format
  [ ]   nanddump
  [ ]   nandtest
  [ ]   nandwrite
  [ ]   doc_loadbios
  [ ]   doc_loadipl

flash_erase

This utility can be used to erase an entire flash partition:

root:/> flash_eraseall /dev/mtd0
Erasing 128 Kibyte @ 3e0000 -- 96 % complete.
</code>

To create an empty JFFS2 partition:
<xterm>
root:/> flash_eraseall -j /dev/mtd6
Erasing 64 Kibyte @ 1c0000 -- 100 % complete.Cleanmarker written at 1b0000. 
root:/> mount -t jffs2 /dev/mtdblock6 /mnt/

flash read/write

There are three main ways to access a flash:

  1. directly (mtd#)
  2. through a block interface (mtdblock#)
  3. through a char interface (mtdchar#)

When accessing things directly, you are responsible for making sure things are erased before writing and other such details. When going through the block/char interface, the mtd layer will take care of the read/overlay/erase/write cycles for you. As such, you can use those interfaces like any other block/char device. That means using utilities such as cat or dd.

root:/> dd of=/dev/mtdblock0 if=u-boot.bin
root:/> dd if=/dev/mtdblock0 of=/tmp/bla.txt skip=32 count=1