platform.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. PART_NAME=firmware
  2. REQUIRE_IMAGE_METADATA=1
  3. RAMFS_COPY_BIN='fw_printenv fw_setenv'
  4. RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
  5. platform_check_image() {
  6. case "$(board_name)" in
  7. asus,rt-ac58u)
  8. CI_UBIPART="UBI_DEV"
  9. local ubidev=$(nand_find_ubi $CI_UBIPART)
  10. local asus_root=$(nand_find_volume $ubidev jffs2)
  11. [ -n "$asus_root" ] || return 0
  12. cat << EOF
  13. jffs2 partition is still present.
  14. There's probably no space left
  15. to install the filesystem.
  16. You need to delete the jffs2 partition first:
  17. # ubirmvol /dev/ubi0 --name=jffs2
  18. Once this is done. Retry.
  19. EOF
  20. return 1
  21. ;;
  22. esac
  23. return 0;
  24. }
  25. zyxel_do_upgrade() {
  26. local tar_file="$1"
  27. local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
  28. board_dir=${board_dir%/}
  29. tar Oxf $tar_file ${board_dir}/kernel | mtd write - kernel
  30. if [ "$SAVE_CONFIG" -eq 1 ]; then
  31. tar Oxf $tar_file ${board_dir}/root | mtd -j "$CONF_TAR" write - rootfs
  32. else
  33. tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs
  34. fi
  35. }
  36. platform_do_upgrade() {
  37. case "$(board_name)" in
  38. 8dev,jalapeno)
  39. nand_do_upgrade "$ARGV"
  40. ;;
  41. asus,rt-ac58u)
  42. CI_UBIPART="UBI_DEV"
  43. CI_KERNPART="linux"
  44. nand_do_upgrade "$1"
  45. ;;
  46. openmesh,a42 |\
  47. openmesh,a62)
  48. PART_NAME="inactive"
  49. platform_do_upgrade_openmesh "$ARGV"
  50. ;;
  51. meraki,mr33)
  52. CI_KERNPART="part.safe"
  53. nand_do_upgrade "$1"
  54. ;;
  55. zyxel,nbg6617)
  56. zyxel_do_upgrade "$1"
  57. ;;
  58. *)
  59. default_do_upgrade "$ARGV"
  60. ;;
  61. esac
  62. }
  63. platform_nand_pre_upgrade() {
  64. case "$(board_name)" in
  65. asus,rt-ac58u)
  66. CI_UBIPART="UBI_DEV"
  67. CI_KERNPART="linux"
  68. ;;
  69. meraki,mr33)
  70. CI_KERNPART="part.safe"
  71. ;;
  72. esac
  73. }