platform.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. platform_do_upgrade() {
  2. local board=$(board_name)
  3. case "$board" in
  4. "unielec,u7623"*)
  5. #Keep the persisten random mac address (if it exists)
  6. mkdir -p /tmp/recovery
  7. mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery
  8. [ -f "/tmp/recovery/mac_addr" ] && \
  9. mv -f /tmp/recovery/mac_addr /tmp/
  10. umount /tmp/recovery
  11. #1310720 is the offset in bytes from the start of eMMC and to
  12. #the location of the kernel (2560 512 byte sectors)
  13. get_image "$1" | dd of=/dev/mmcblk0 bs=1310720 seek=1 conv=fsync
  14. mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery
  15. [ -f "/tmp/mac_addr" ] && mv -f /tmp/mac_addr /tmp/recovery
  16. sync
  17. umount /tmp/recovery
  18. ;;
  19. *)
  20. default_do_upgrade "$ARGV"
  21. ;;
  22. esac
  23. }
  24. PART_NAME=firmware
  25. platform_check_image() {
  26. local board=$(board_name)
  27. local magic="$(get_magic_long "$1")"
  28. [ "$#" -gt 1 ] && return 1
  29. case "$board" in
  30. bananapi,bpi-r2|\
  31. "unielec,u7623"*)
  32. [ "$magic" != "27051956" ] && {
  33. echo "Invalid image type."
  34. return 1
  35. }
  36. return 0
  37. ;;
  38. *)
  39. echo "Sysupgrade is not supported on your board yet."
  40. return 1
  41. ;;
  42. esac
  43. return 0
  44. }
  45. platform_copy_config_emmc() {
  46. mkdir -p /recovery
  47. mount -o rw,noatime /dev/mmcblk0p1 /recovery
  48. cp -af "$CONF_TAR" /recovery/
  49. sync
  50. umount /recovery
  51. }
  52. platform_copy_config() {
  53. case "$(board_name)" in
  54. "unielec,u7623"*)
  55. platform_copy_config_emmc
  56. ;;
  57. esac
  58. }