VAR-SOM-AM33 NAND Flash Burning: Difference between revisions

From Variscite Wiki
Line 8: Line 8:


Replacing Nand Flash images can be done from either Linux user space or U-Boot.  
Replacing Nand Flash images can be done from either Linux user space or U-Boot.  
<u>From U-Boot</u><br>
<pre>U-Boot # mmc rescan
U-Boot # nand erase 0x0 0x280000
U-Boot # mmc rescan
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} MLO
U-Boot # nand write ${loadaddr} 0x0 0x20000
U-Boot # nand write ${loadaddr} 0x20000 0x20000
U-Boot # nand write ${loadaddr} 0x40000 0x20000
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} u-boot.img
U-Boot # nand write ${loadaddr} 0x80000 0x1c0000
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} uImage
U-Boot # nand erase 0x280000 0x500000
U-Boot # nand write ${loadaddr} 0x280000 0x500000
</pre>
<u>From Linux shell</u><u></u><br>  
<u>From Linux shell</u><u></u><br>  
<pre> &lt;&lt; Install SPL &gt;&gt;
<pre>
  &lt;&lt; Flash MLO (4 copies) &gt;&gt;
$ flash_erase /dev/mtd0 0 0
$ flash_erase /dev/mtd0 0 0
$ flash_erase /dev/mtd1 0 0
$ flash_erase /dev/mtd1 0 0
Line 33: Line 19:
$ nandwrite -p /dev/mtd2 &lt;MLO file&gt;
$ nandwrite -p /dev/mtd2 &lt;MLO file&gt;
$ nandwrite -p /dev/mtd3 &lt;MLO file&gt;
$ nandwrite -p /dev/mtd3 &lt;MLO file&gt;
  &lt;&lt; Install device tree &gt;&gt;
$ flash_erase /dev/mtd4 0 0
$ nandwrite -p /dev/mtd4 &lt;zImage-var-som-amx3.dtb file&gt


   &lt;&lt; Install U-Boot &gt;&gt;
   &lt;&lt; Install U-Boot &gt;&gt;
$ flash_erase /dev/mtd4 0 0
 
$ flash_erase /dev/mtd5 0 0
$ flash_erase /dev/mtd5 0 0
$ nandwrite -p /dev/mtd4 &lt;u-boot.img file&gt;
$ nandwrite -p /dev/mtd5 &lt;u-boot.img file&gt;


   &lt;&lt; Install Kernel &gt;&gt;
   &lt;&lt; Install Kernel &gt;&gt;
$ flash_erase /dev/mtd6 0 0
$ flash_erase /dev/mtd6 0 0
$ nandwrite -p /dev/mtd6 &lt;uImage file&gt;
$ nandwrite -p /dev/mtd6 &lt;uImage file&gt;
</pre>
<u>From U-Boot</u><br>
<pre>U-Boot # mmc rescan
U-Boot # nand erase 0x0 0x280000
U-Boot # mmc rescan
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} MLO
U-Boot # nand write ${loadaddr} 0x0 0x20000
U-Boot # nand write ${loadaddr} 0x20000 0x20000
U-Boot # nand write ${loadaddr} 0x40000 0x20000
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} u-boot.img
U-Boot # nand write ${loadaddr} 0x80000 0x1c0000
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} uImage
U-Boot # nand erase 0x280000 0x500000
U-Boot # nand write ${loadaddr} 0x280000 0x500000
</pre>
</pre>

Revision as of 12:21, 22 December 2015

Flash Images to NAND

using nand-recovery.sh script

Variscite provides a sample script which burns all required images (MLO, U-BOOT, zImage, device tree, and UBI rootfs) to NAND-Flash.
For sample script, please refer to : https://github.com/varigit/meta-variscite-amx3/blob/master/utils/nand-recovery.sh
In the above example script, NAND-Flash binaries reside in /opt/TISDK on the SD-Card

Step by step manual flashing of NAND binaries

Replacing Nand Flash images can be done from either Linux user space or U-Boot. From Linux shell

  << Flash MLO (4 copies) >>
$ flash_erase /dev/mtd0 0 0
$ flash_erase /dev/mtd1 0 0
$ flash_erase /dev/mtd2 0 0
$ flash_erase /dev/mtd3 0 0
$ nandwrite -p /dev/mtd0 <MLO file>
$ nandwrite -p /dev/mtd1 <MLO file>
$ nandwrite -p /dev/mtd2 <MLO file>
$ nandwrite -p /dev/mtd3 <MLO file>

  << Install device tree >>
$ flash_erase /dev/mtd4 0 0
$ nandwrite -p /dev/mtd4 <zImage-var-som-amx3.dtb file&gt

  << Install U-Boot >>

$ flash_erase /dev/mtd5 0 0
$ nandwrite -p /dev/mtd5 <u-boot.img file>

  << Install Kernel >>
$ flash_erase /dev/mtd6 0 0
$ nandwrite -p /dev/mtd6 <uImage file>

From U-Boot

U-Boot # mmc rescan
U-Boot # nand erase 0x0 0x280000
U-Boot # mmc rescan
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} MLO
U-Boot # nand write ${loadaddr} 0x0 0x20000
U-Boot # nand write ${loadaddr} 0x20000 0x20000
U-Boot # nand write ${loadaddr} 0x40000 0x20000
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} u-boot.img
U-Boot # nand write ${loadaddr} 0x80000 0x1c0000
U-Boot # fatload mmc ${mmc_dev} ${loadaddr} uImage
U-Boot # nand erase 0x280000 0x500000
U-Boot # nand write ${loadaddr} 0x280000 0x500000