setenv stdout lcd
mw.l 83000000 40200800
if cmp.l 82001004 83000000 1
then
  nandecc hw
  nand read 83000000 0 20000
  if cmp.b 82001000 83000000 20000
  then
    echo
    echo >>> x-load already flashed, skipped.
    echo
  else
    nand erase 0 80000
    nand write 82001000 0 20000
    nand write 82001000 20000 20000
    nand write 82001000 40000 20000
    nand write 82001000 60000 20000
    echo
    echo >>> finished flashing new x-load
    echo
  fi
  setenv bootargs console=tty1 ramdisk_size=8192 root=/dev/ram0 rw rootfstype=ext2 initrd=0x82321000,8M vram=6272K omapfb.vram=0:3000K
  bootm 0x82021000
fi

echo
echo Data corruption detected.
echo
