platform.sh 1.9 KB

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