2013-03-11 08:44:53 +00:00
|
|
|
setenv stdout serial,vga
|
|
|
|
echo "check U-Boot" ;
|
|
|
|
setenv offset 0x400
|
|
|
|
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
|
|
|
|
echo "probed SPI ROM" ;
|
2013-10-04 15:43:24 +00:00
|
|
|
if sf read 0x12400000 $offset $filesize ; then
|
|
|
|
if cmp.b 0x12000000 0x12400000 $filesize ; then
|
|
|
|
echo "------- U-Boot versions match" ;
|
|
|
|
else
|
|
|
|
echo "Need U-Boot upgrade" ;
|
|
|
|
echo "Program in 5 seconds" ;
|
|
|
|
for n in 5 4 3 2 1 ; do
|
|
|
|
echo $n ;
|
|
|
|
sleep 1 ;
|
|
|
|
done
|
2013-03-11 08:44:53 +00:00
|
|
|
echo "erasing" ;
|
2013-10-09 19:25:15 +00:00
|
|
|
sf erase 0 0xC0000 ;
|
2013-03-11 08:44:53 +00:00
|
|
|
# two steps to prevent bricking
|
|
|
|
echo "programming" ;
|
2013-10-04 15:43:24 +00:00
|
|
|
sf write 0x12000000 $offset $filesize ;
|
2013-03-11 08:44:53 +00:00
|
|
|
echo "verifying" ;
|
2013-10-04 15:43:24 +00:00
|
|
|
if sf read 0x12400000 $offset $filesize ; then
|
|
|
|
if cmp.b 0x12000000 0x12400000 $filesize ; then
|
|
|
|
while echo "---- U-Boot upgraded. reset" ; do
|
2013-03-11 08:44:53 +00:00
|
|
|
sleep 120
|
|
|
|
done
|
2013-10-04 15:43:24 +00:00
|
|
|
else
|
|
|
|
echo "Read verification error" ;
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Error re-reading EEPROM" ;
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Error reading boot loader from EEPROM" ;
|
|
|
|
fi
|
2013-03-11 08:44:53 +00:00
|
|
|
else
|
2013-10-04 15:43:24 +00:00
|
|
|
echo "Error initializing EEPROM" ;
|
2013-03-11 08:44:53 +00:00
|
|
|
fi ;
|
|
|
|
else
|
|
|
|
echo "No U-Boot image found on SD card" ;
|
|
|
|
fi
|