# The file name must be imi_update.txt  kevin lee add at 2021-11-15

# <- this is for comment / total file size must be less than 4KB
fatload mmc 1 0x21000000 images/cis.bin
nand erase  0x0 0x140000
nand write 0x21000000 0x0 ${filesize}
nand write 0x21000000 0x20000 ${filesize}
nand write 0x21000000 0x40000 ${filesize}
nand write 0x21000000 0x60000 ${filesize}
nand write 0x21000000 0x80000 ${filesize}
nand write 0x21000000 0xA0000 ${filesize}
nand write 0x21000000 0xC0000 ${filesize}
nand write 0x21000000 0xE0000 ${filesize}
nand write 0x21000000 0x100000 ${filesize}
nand write 0x21000000 0x120000 ${filesize}

# <- this is for comment / total file size must be less than 4KB
fatload mmc 1 0x21000000 images/BOOT.bin
nand erase.part BOOT
nand write.e 0x21000000 BOOT ${filesize}

# <- this is for comment / total file size must be less than 4KB
fatload mmc 1 0x21000000 images/ubi.rootfs.squashfs
nand erase.part ROOTFS
nand write.e 0x21000000 ROOTFS ${filesize}

# <- this is for comment / total file size must be less than 4KB
fatload mmc 1 0x21000000 images/kernel.xz.img
nand erase.part A_KERNEL
nand write.e 0x21000000 A_KERNEL ${filesize}
nand erase.part B_KERNEL
nand write.e 0x21000000 B_KERNEL ${filesize}

# <- this is for comment / total file size must be less than 4KB
fatload mmc 1 0x21000000 images/ubi.usr.squashfs
nand erase.part A_USRFS
nand write.e 0x21000000 A_USRFS ${filesize}
nand erase.part B_USRFS
nand write.e 0x21000000 B_USRFS ${filesize}

fatload mmc 1 0x21000000 images/ubi.sound.squashfs;
nand erase.part SOUND
nand write.e 0x21000000 SOUND ${filesize}

#fatload mmc 1 0x21000000 images/factory.bin;
#nand erase.part FACTORY
#nand write.e 0x21000000 FACTORY ${filesize}

# <- this is for comment / total file size must be less than 4KB
nand erase.part DATA
ubi part DATA
ubi create data
fatload mmc 1 0x21000000 images/data.ubifs
ubi write 0x21000000 data ${filesize}

# <- this is for comment / total file size must be less than 4KB
#setenv bootargs 'console=ttyS1,115200n8 ubi.mtd=8,2048 mem=128M@0x0 rmem=64M@0x8000000 nmem=64M@0xC000000 init=/linuxrc rootfstype=squashfs root=/dev/mtdblock1 ro mtdparts=sfc_nand:1024k(BOOT),3072k(ROOTFS),10240k(SPLASH),3072k(A_KERNEL),46080k(A_USRFS),3072k(B_KERNEL),46080k(B_USRFS),3072k(SOUND),256k(FACTORY),-(DATA)

#setenv mtdparts 'mtdparts=nand:1024k(BOOT),3072k(ROOTFS),10240k(SPLASH),3072k(A_KERNEL),46080k(A_USRFS),3072k(B_KERNEL),46080k(B_USRFS),3072k(SOUND),256k(FACTORY),-(DATA)'

#setenv bootcmd 'nand read 0x21000000 0x400000 0x300000;bootm 0x21000000'

#setenv boot_flag 0
#saveenv
% <- this is end of file symbol

