platform.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #
  2. # Copyright (C) 2011 OpenWrt.org
  3. #
  4. PART_NAME=firmware
  5. REQUIRE_IMAGE_METADATA=1
  6. RAMFS_COPY_BIN='fw_printenv fw_setenv'
  7. RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
  8. platform_check_image() {
  9. local board=$(board_name)
  10. case "$board" in
  11. jjplus,ja76pf2|\
  12. ubnt,routerstation|\
  13. ubnt,routerstation-pro)
  14. platform_check_image_redboot_fis "$1"
  15. ;;
  16. nec,wg1400hp|\
  17. nec,wg1800hp|\
  18. nec,wg1800hp2)
  19. local uboot_mtd=$(find_mtd_part "bootloader")
  20. # check "U-Boot <year>.<month>" string in the "bootloader" partition
  21. if ! grep -q "U-Boot [0-9]\{4\}\.[0-9]\{2\}" $uboot_mtd; then
  22. v "The bootloader doesn't seem to be replaced to U-Boot!"
  23. return 1
  24. fi
  25. ;;
  26. *)
  27. return 0
  28. ;;
  29. esac
  30. }
  31. platform_do_upgrade() {
  32. local board=$(board_name)
  33. case "$board" in
  34. adtran,bsap1800-v2|\
  35. adtran,bsap1840)
  36. platform_do_upgrade_redboot_fis "$1" vmlinux_2
  37. ;;
  38. allnet,all-wap02860ac|\
  39. araknis,an-300-ap-i-n|\
  40. araknis,an-500-ap-i-ac|\
  41. araknis,an-700-ap-i-ac|\
  42. engenius,eap1200h|\
  43. engenius,eap1750h|\
  44. engenius,eap300-v2|\
  45. engenius,eap600|\
  46. engenius,ecb600|\
  47. engenius,ens1750|\
  48. engenius,ens202ext-v1|\
  49. engenius,enstationac-v1|\
  50. engenius,ews660ap|\
  51. watchguard,ap100|\
  52. watchguard,ap200|\
  53. watchguard,ap300)
  54. ENV_SCRIPT="/tmp/fw_env"
  55. IMAGE_LIST="tar tzf $1"
  56. IMAGE_CMD="tar xzOf $1"
  57. KERNEL_PART="loader"
  58. ROOTFS_PART="fwconcat0"
  59. KERNEL_FILE="uImage-lzma.bin"
  60. ROOTFS_FILE="root.squashfs"
  61. platform_do_upgrade_failsafe_datachk "$1"
  62. ;;
  63. fortinet,fap-220-b|\
  64. fortinet,fap-221-b|\
  65. fortinet,fap-221-c)
  66. SKIP_HASH="1"
  67. ENV_SCRIPT="/dev/null"
  68. IMAGE_LIST="tar tzf $1"
  69. IMAGE_CMD="tar xzOf $1"
  70. KERNEL_PART="loader"
  71. ROOTFS_PART="fwconcat0"
  72. KERNEL_FILE="uImage-lzma.bin"
  73. ROOTFS_FILE="root.squashfs"
  74. platform_do_upgrade_failsafe_datachk "$1"
  75. ;;
  76. huawei,ap5030dn|\
  77. huawei,ap6010dn)
  78. # Store beginning address of the "firmware" partition
  79. # as KernelA address and KernelB address, each to BootupA & BootupB
  80. # This is the address from which the bootloader will try to load the kernel.
  81. echo -n -e "\x9e\x10\x00\x00\x9e\x10\x00\x00" | dd of=$(find_mtd_part BootupA) bs=1 seek=$((0x254)) conv=notrunc
  82. echo -n -e "\x9e\x10\x00\x00\x9e\x10\x00\x00" | dd of=$(find_mtd_part BootupB) bs=1 seek=$((0x254)) conv=notrunc
  83. default_do_upgrade "$1"
  84. ;;
  85. jjplus,ja76pf2)
  86. platform_do_upgrade_redboot_fis "$1" linux
  87. ;;
  88. openmesh,a40|\
  89. openmesh,a60|\
  90. openmesh,mr600-v1|\
  91. openmesh,mr600-v2|\
  92. openmesh,mr900-v1|\
  93. openmesh,mr900-v2|\
  94. openmesh,mr1750-v1|\
  95. openmesh,mr1750-v2|\
  96. openmesh,om2p-v1|\
  97. openmesh,om2p-v2|\
  98. openmesh,om2p-v4|\
  99. openmesh,om2p-hs-v1|\
  100. openmesh,om2p-hs-v2|\
  101. openmesh,om2p-hs-v3|\
  102. openmesh,om2p-hs-v4|\
  103. openmesh,om2p-lc|\
  104. openmesh,om5p|\
  105. openmesh,om5p-ac-v1|\
  106. openmesh,om5p-ac-v2|\
  107. openmesh,om5p-an)
  108. PART_NAME="inactive"
  109. platform_do_upgrade_openmesh "$1"
  110. ;;
  111. plasmacloud,pa300|\
  112. plasmacloud,pa300e)
  113. PART_NAME="inactive"
  114. platform_do_upgrade_dualboot_datachk "$1"
  115. ;;
  116. ubnt,routerstation|\
  117. ubnt,routerstation-pro)
  118. platform_do_upgrade_redboot_fis "$1" kernel
  119. ;;
  120. *)
  121. default_do_upgrade "$1"
  122. ;;
  123. esac
  124. }