platform.sh 922 B

123456789101112131415161718192021222324252627282930313233343536
  1. KERNEL_IMG="openwrt-au1000-au1500-vmlinux.bin"
  2. ROOTFS_IMG="openwrt-au1000-au1500-root.fs"
  3. platform_check_image() {
  4. [ "$#" -gt 1 ] && return 1
  5. case "$(get_magic_word "$1")" in
  6. 6f70)
  7. ( get_image "$1" | tar -tf - $KERNEL_IMG >/dev/null && \
  8. get_image "$1" | tar -tf - $ROOTFS_IMG >/dev/null) || {
  9. echo "Invalid image contents"
  10. return 1
  11. }
  12. return 0;;
  13. *)
  14. echo "Invalid image type"
  15. return 1;;
  16. esac
  17. }
  18. platform_do_upgrade() {
  19. sync
  20. local conf=""
  21. [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && conf="-j $CONF_TAR"
  22. get_image "$1" | tar -Oxvf - $KERNEL_IMG | mtd write - "kernel"
  23. get_image "$1" | tar -Oxvf - $ROOTFS_IMG | mtd $conf write - "rootfs"
  24. }
  25. disable_watchdog() {
  26. killall watchdog
  27. ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
  28. echo 'Could not disable watchdog'
  29. return 1
  30. }
  31. }
  32. append sysupgrade_pre_upgrade disable_watchdog