6x_upgrade.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. if itest.s a$uboot_defconfig == a; then
  2. echo "Please set uboot_defconfig to the appropriate value"
  3. exit
  4. fi
  5. offset=0x400
  6. a_uImage1=0x12000000
  7. a_uImage2=0x12400000
  8. if itest.s x6SX == "x${cpu}" || itest.s x7D == "x${cpu}"; then
  9. a_uImage1=0x82000000
  10. a_uImage2=0x82400000
  11. fi
  12. setenv stdout serial,vga
  13. echo "check U-Boot" ;
  14. if load ${dtype} ${disk}:1 ${a_uImage1} u-boot.$uboot_defconfig ; then
  15. else
  16. echo "No U-Boot image found on SD card" ;
  17. exit
  18. fi
  19. echo "read $filesize bytes from SD card" ;
  20. if sf probe || sf probe || sf probe 1 27000000 || sf probe 1 27000000 ; then
  21. echo "probed SPI ROM" ;
  22. else
  23. echo "Error initializing EEPROM" ;
  24. exit
  25. fi ;
  26. if sf read ${a_uImage2} $offset $filesize ; then
  27. else
  28. echo "Error reading boot loader from EEPROM" ;
  29. exit
  30. fi
  31. if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then
  32. echo "------- U-Boot versions match" ;
  33. exit
  34. fi
  35. echo "Need U-Boot upgrade" ;
  36. echo "Program in 5 seconds" ;
  37. for n in 5 4 3 2 1 ; do
  38. echo $n ;
  39. sleep 1 ;
  40. done
  41. echo "erasing" ;
  42. sf erase 0 0xC0000 ;
  43. # two steps to prevent bricking
  44. echo "programming" ;
  45. setexpr a1 ${a_uImage1} + 0x400
  46. setexpr o1 ${offset} + 0x400
  47. setexpr s1 ${filesize} - 0x400
  48. sf write ${a1} ${o1} ${s1} ;
  49. sf write ${a_uImage1} $offset 0x400 ;
  50. echo "verifying" ;
  51. if sf read ${a_uImage2} $offset $filesize ; then
  52. else
  53. echo "Error re-reading EEPROM" ;
  54. exit
  55. fi
  56. if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then
  57. else
  58. echo "Read verification error" ;
  59. exit
  60. fi
  61. while echo "---- U-Boot upgraded. reset" ; do
  62. sleep 120
  63. done