Reading NAND flash and writting it to another system

mans picture mans · Oct 24, 2012 · Viewed 11.9k times · Source

I have an embedded system that I want to read its nand flash and write it back to another system's nand flash. I have access to root of Linux system which is running on device. The system is based on AM3874 and I have access to its JTAG too. My questions are:

1- Can I do this by login to system as root and writing nand flash data to a SD card and then one new system write it back to nand flash?

2- If the answer to above question is yes, what is the procedures and what software I need?

3- If the answer is no, Can I use JTAG interface to read NAND Flash and writing it to another device?

Answer

SKi picture SKi · Oct 24, 2012

You can copy whole device or a partition to a file by using dd command.

Example:

dd if=/dev/mtd/mtd4 of=/mnt/sdcard/system.img bs=4096

Similar way you can copy a file to device.

Edit:

This of course works only with NAND flashes which have device driver in your linux.

If you have mounted filesystem in the flash, then you can use fd or mount commands for finding the correct device name. This way:

~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                53504     13580     39924  25% /
tmpfs                    25600        68     25532   0% /tmp
/dev/mmcblk0p1           77077     67089    722524  92% /mnt/test

~ # dd if=/dev/root of=/mnt/test/root.img bs=4096
13376+0 records in
13376+0 records out

~ # ls -l /mnt/test/root.img
-rw-r--r--    1 root     root     54788096 Oct 26 13:17 /mnt/test/root.img
~ #