VAR-SOM-OM35/7 Linux Nand Reflashing Scripts

From Variscite Wiki

VAR-SOM-OM35/7 Linux Nand Reflashing Scripts

Use the below example scripts to re-flash the on-board Nand flash.


/****** Software update via Ethernet TFTP ***********************/
setenv rf_blank_ram   mw.b 0x81600000 0xff 0x2000000
setenv rf_blank_ram_fs   mw.b 0x81600000 0xff 0xA000000
setenv rf_er_xloader  nand erase 0 80000
setenv rf_er_uboot    nand erase 80000 1e0000
setenv rf_er_env      nand erase 260000 20000
setenv rf_er_kernel   nand erase 280000 400000
setenv rf_er_ramdisk  nand erase 780000 
setenv rf_er_fs       nand erase 780000 
setenv rf_get_xloader tftpboot 0x81600000 MLO
setenv rf_get_uboot   tftpboot 0x81600000 u-boot.bin
setenv rf_get_kernel  tftpboot 0x81600000 uImage
setenv rf_get_fs      tftpboot 0x81600000 am3517-05.02.00.00-fs.jffs2
setenv rf_wr_xloader  nandecc hw\; nand write.i 0x81600000 0 20000\; nand write.i 0x81600000 20000 20000
setenv rf_wr_uboot    nandecc bch4_sw\; nand write.i 0x81600000 80000 80000
setenv rf_wr_kernel   nandecc bch4_sw\; nand write.i 0x81600000 280000 300000
setenv rf_wr_fs       nandecc bch4_sw\; nand write.i 0x81600000 780000 93BD800 
setenv rf_ev          run rf_er_env
setenv rf_xl          run rf_blank_ram\; run rf_er_xloader\; run rf_get_xloader\; run rf_wr_xloader
setenv rf_ub          run rf_blank_ram\; run rf_er_uboot\; run rf_get_uboot\; run rf_wr_uboot
setenv rf_kn          run rf_blank_ram\; run rf_er_kernel\; run rf_get_kernel\; run rf_wr_kernel
setenv rf_fs          run rf_blank_ram_fs\; run rf_er_fs\; run rf_get_fs\; run rf_wr_fs
setenv rf_sys         run rf_xl\; run rf_ub\; run rf_kn
setenv rf_all         run rf_sys\; run rf_fs
save
printenv


********* burn xloader from MMC *****
mw.b 0x81600000 0xff 0x200000
mmc init
nand erase 0 80000
fatload mmc 1 0x81600000 MLO
nandecc hw
nand write.i 0x81600000 0 20000
nand write.i 0x81600000 20000 20000

********* burn UBOOT from MMC *****
mw.b 0x81600000 0xff 0x200000
mmc init
nandecc bch4_sw 
nand erase 80000 1e0000
fatload mmc 1 0x81600000 u-boot.bin
nand write.i 0x81600000 80000 80000


**** burn Kernel from MMC ****
mw.b 0x81600000 0xff 0x300000
mmc init
fatload mmc 1 0x81600000 uImage
nand erase 280000 400000
nandecc bch4_sw 
nand write.i 0x81600000 280000 300000


**** Load FS from MMC ****

*** Important note: 
*** The image size should be upward aligned to NAND page size which is 2KB (i.e. 0x800). 
*** For example, if the image size is 0x19B8004 the size to be passed to the NAND write command should be 0x19B8800.

mw.b 0x81600000 0xff 0xA000000
mmc init
fatload mmc 1 0x81600000 am3517-05.02.00.00-fs.jffs2
nand erase 780000
nandecc bch4_sw 
nand write.i 0x81600000 780000 93BD800