Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book


The MTD-utils package, downloadable from ftp://ftp.infradead.org/pub/mtd-utils/, contains several useful tools that work on top of MTD-enabled flash memory. Examples of included utilities are flash_eraseall, nanddump, nandwrite, and sumtool.

To erase the second flash partition (on NOR or NAND devices), use flash_eraseall as follows:

bash> flash_eraseall –j /dev/mtd/2

Because NAND chips may contain bad blocks, use ECC-aware programs such as nandwrite and nanddump to copy raw data, instead of general-purpose utilities, such as dd. To store the JFFS2 image that you created previously, on to the second NAND partition, do this:

bash> nandwrite /dev/mtd/2 jffs2.img

You can reduce JFFS2 mount times by inserting summary information into a JFFS2 image using sumtool and turning on CONFIG_JFFS2_SUMMARY while configuring your kernel. To write a summarized JFFS2 image to the previous NAND flash, do this:

bash> sumtool –e 256KiB –i jffs2.img –o jffs2.summary.img
bash> nandwrite /dev/mtd/2 jffs2.summary.img
bash> mount –t jffs2 /dev/mtdblock/2 /mnt
  • + Share This
  • 🔖 Save To Your Account