platform.sh 1001 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #
  2. # Copyright (C) 2010-2011 OpenWrt.org
  3. #
  4. # use default "image" for PART_NAME
  5. # use default for platform_do_upgrade()
  6. platform_check_image() {
  7. [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; }
  8. local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
  9. local magic="$(get_magic_word "$1")"
  10. local magic_long="$(get_magic_long "$1")"
  11. case "${hardware}" in
  12. # hardware with a direct uImage partition
  13. # image header format as described in U-Boot's include/image.h
  14. # see http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=include/image.h
  15. 'Linksys WRT350N v2')
  16. [ "${magic_long}" != '27051956' ] && {
  17. echo "Invalid image type ${magic_long}."
  18. return 1
  19. }
  20. return 0
  21. ;;
  22. # Netgear WNR854T (has uImage as file inside a JFFS2 partition)
  23. 'Netgear WNR854T')
  24. [ "${magic}" != '8519' ] && {
  25. echo "Invalid image type ${magic}."
  26. return 1
  27. }
  28. return 0
  29. ;;
  30. esac
  31. echo "Sysupgrade is not yet supported on ${hardware}."
  32. return 1
  33. }