ar71xx: Add UBNT airGateway support
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
index d42a704e57e09f6dc0a18d83eec85ab4a5f6db18..e25410bc9fa4039550cfd6dabffc3dbbbcca4374 100755 (executable)
@@ -2,6 +2,7 @@
 # Copyright (C) 2011 OpenWrt.org
 #
 
+. /lib/functions/system.sh
 . /lib/ar71xx.sh
 
 PART_NAME=firmware
@@ -106,6 +107,29 @@ platform_do_upgrade_compex() {
        fi
 }
 
+alfa_check_image() {
+       local magic_long="$(get_magic_long "$1")"
+       local fw_part_size=$(mtd_get_part_size firmware)
+
+       case "$magic_long" in
+       "27051956")
+               [ "$fw_part_size" != "16318464" ] && {
+                       echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes"
+                       return 1
+               }
+               ;;
+
+       "68737173")
+               [ "$fw_part_size" != "7929856" ] && {
+                       echo "Invalid image magic \"$magic_long\" for $fw_part_size bytes"
+                       return 1
+               }
+               ;;
+       esac
+
+       return 0
+}
+
 platform_check_image() {
        local board=$(ar71xx_board_name)
        local magic="$(get_magic_word "$1")"
@@ -162,6 +186,7 @@ platform_check_image() {
        tew-712br | \
        tew-732br | \
        wrt400n | \
+       airgateway | \
        airrouter | \
        bullet-m | \
        nanostation-m | \
@@ -293,6 +318,12 @@ platform_check_image() {
 
                return 0
                ;;
+
+       tube2h)
+               alfa_check_image "$1" && return 0
+               return 1
+               ;;
+
        uap-pro)
                [ "$magic_long" != "19852003" ] && {
                        echo "Invalid image type."
@@ -323,6 +354,7 @@ platform_check_image() {
        pb42 | \
        pb44 | \
        all0305 | \
+       eap300v2 | \
        eap7660d | \
        ja76pf | \
        ja76pf2 | \
@@ -377,6 +409,7 @@ platform_do_upgrade() {
        all0315n )
                platform_do_upgrade_allnet "0x9f080000" "$ARGV"
                ;;
+       eap300v2 |\
        cap4200ag)
                platform_do_upgrade_allnet "0xbf0a0000" "$ARGV"
                ;;