uboot-chiliboard.install 898 B

123456789101112131415161718192021222324252627282930313233
  1. flash_instructions() {
  2. echo "# dd if=/boot/MLO of=/dev/mmcblk0 count=1 seek=1 conv=notrunc bs=128k"
  3. echo "# dd if=/boot/u-boot.img of=/dev/mmcblk0 count=2 seek=1 conv=notrunc bs=384k"
  4. }
  5. flash_uboot() {
  6. root=$(mount | awk '/ on \/ / { print $1; }')
  7. if [[ $root =~ ^/dev/mmcblk.*$ ]]; then
  8. root=${root:0:12}
  9. echo "A new U-Boot version needs to be flashed onto $root."
  10. echo "Do this now? [y|N]"
  11. read -r shouldwe
  12. if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
  13. dd if=/boot/MLO of=$root count=1 seek=1 conv=notrunc bs=128k
  14. dd if=/boot/u-boot.img of=$root count=2 seek=1 conv=notrunc bs=384k
  15. else
  16. echo "You can do this later by running:"
  17. flash_instructions
  18. fi
  19. else
  20. echo "Flash the new U-Boot version onto your boot device. For example:"
  21. flash_instructions
  22. fi
  23. }
  24. post_install() {
  25. flash_uboot
  26. }
  27. post_upgrade() {
  28. flash_uboot
  29. }