platform.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 [ -n "$UPGRADE_BACKUP" ]; then
  31. tar Oxf $tar_file ${board_dir}/root | mtd -j "$UPGRADE_BACKUP" 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. avm,fritzbox-7530 |\
  40. avm,fritzrepeater-1200 |\
  41. avm,fritzrepeater-3000 |\
  42. qxwlan,e2600ac-c2)
  43. nand_do_upgrade "$1"
  44. ;;
  45. alfa-network,ap120c-ac)
  46. part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')"
  47. if [ "$part" = "rootfs1" ]; then
  48. fw_setenv active 2 || exit 1
  49. CI_UBIPART="rootfs2"
  50. else
  51. fw_setenv active 1 || exit 1
  52. CI_UBIPART="rootfs1"
  53. fi
  54. nand_do_upgrade "$1"
  55. ;;
  56. asus,map-ac2200)
  57. CI_KERNPART="linux"
  58. nand_do_upgrade "$1"
  59. ;;
  60. asus,rt-ac58u)
  61. CI_UBIPART="UBI_DEV"
  62. CI_KERNPART="linux"
  63. nand_do_upgrade "$1"
  64. ;;
  65. compex,wpj419)
  66. nand_do_upgrade "$1"
  67. ;;
  68. linksys,ea6350v3 |\
  69. linksys,ea8300)
  70. platform_do_upgrade_linksys "$1"
  71. ;;
  72. meraki,mr33)
  73. CI_KERNPART="part.safe"
  74. nand_do_upgrade "$1"
  75. ;;
  76. openmesh,a42 |\
  77. openmesh,a62)
  78. PART_NAME="inactive"
  79. platform_do_upgrade_openmesh "$1"
  80. ;;
  81. zyxel,nbg6617)
  82. zyxel_do_upgrade "$1"
  83. ;;
  84. *)
  85. default_do_upgrade "$1"
  86. ;;
  87. esac
  88. }