| setenv stdout serial,vidconsole |
| if ${fs}load ${dtype} ${disk}:1 12000000 u-boot.imx || ${fs}load ${dtype} ${disk}:1 12000000 u-boot.nopadding ; then |
| echo "read $filesize bytes from SD card" ; |
| if sf probe || sf probe || \ |
| sf probe 1 27000000 || sf probe 1 27000000 ; then |
| if sf read 0x12400000 $offset $filesize ; then |
| if cmp.b 0x12000000 0x12400000 $filesize ; then |
| echo "------- U-Boot versions match" ; |
| echo "Need U-Boot upgrade" ; |
| echo "Program in 5 seconds" ; |
| # two steps to prevent bricking |
| sf write 0x12000000 $offset $filesize ; |
| if sf read 0x12400000 $offset $filesize ; then |
| if cmp.b 0x12000000 0x12400000 $filesize ; then |
| while echo "---- U-Boot upgraded. reset" ; do |
| echo "Read verification error" ; |
| echo "Error re-reading EEPROM" ; |
| echo "Error reading boot loader from EEPROM" ; |
| echo "Error initializing EEPROM" ; |
| echo "No U-Boot image found on SD card" ; |