kumquat-buildroot/board/boundarydevices/nitrogen6x/6q_upgrade

45 lines
1.5 KiB
Plaintext
Raw Normal View History

'V<> zP<05><05><00>v<EFBFBD>Wboot script<05>echo "check U-Boot" ;
if ${fs}load mmc ${disk}:1 12000000 u-boot.bin ; then
echo "read $filesize bytes from SD card" ;
if sf probe 1 27000000 ; then
echo "probed SPI ROM" ;
if sf read 0x12400000 0 $filesize ; then
if cmp.b 0x12000000 0x12400000 $filesize ; then
echo "------- U-Boot versions match" ;
else
echo "Need U-Boot upgrade" ;
echo "Program in 10 seconds" ;
for n in 9 8 7 6 5 4 3 2 1 0 ; do
echo $n ;
sleep 1 ;
done
echo "erasing" ;
sf erase 0 0x40000 ;
# two steps to prevent bricking
echo "programming" ;
sf write 0x12000000 0 $filesize ;
echo "verifying" ;
if sf read 0x12400000 0 $filesize ; then
if cmp.b 0x12000000 0x12400000 $filesize ; then
while echo "---- U-Boot upgraded. reset" ; do
sleep 120
done
else
echo "Read verification error" ;
fi
else
echo "Error re-reading EEPROM" ;
fi
fi
else
echo "Error reading boot loader from EEPROM" ;
fi
else
echo "Error initializing EEPROM" ;
fi ;
else
echo "No U-Boot image found on SD card" ;
fi