uboot4grub-am335x_bone.install 1.0 KB

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