ar71xx: enable sysupgrade for the OpenMesh OM5P-ACv2
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
index 1d3695f372f022266429eb0122d7a51d2ef7c285..2d61638bf76cbc03ededcb6f55a28925deb74e49 100755 (executable)
@@ -66,6 +66,10 @@ tplink_get_image_hwid() {
        get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
 }
 
+tplink_get_image_mid() {
+       get_image "$@" | dd bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
 tplink_get_image_boot_size() {
        get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
 }
@@ -318,7 +322,9 @@ platform_check_image() {
        om2p-hsv2 | \
        om2p-lc | \
        om5p | \
-       om5p-an)
+       om5p-an | \
+       om5p-ac | \
+       om5p-acv2)
                platform_check_image_openmesh "$magic_long" "$1" && return 0
                return 1
                ;;
@@ -396,13 +402,17 @@ platform_check_image() {
                }
 
                local hwid
-               local imageid
+               local mid
+               local imagehwid
+               local imagemid
 
                hwid=$(tplink_get_hwid)
-               imageid=$(tplink_get_image_hwid "$1")
+               mid=$(tplink_get_mid)
+               imagehwid=$(tplink_get_image_hwid "$1")
+               imagemid=$(tplink_get_image_mid "$1")
 
-               [ "$hwid" != "$imageid" ] && {
-                       echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
+               [ "$hwid" != "$imagehwid" -o "$mid" != "$imagemid" ] && {
+                       echo "Invalid image, hardware ID mismatch, hw:$hwid $mid image:$imagehwid $imagemid."
                        return 1
                }
 
@@ -567,7 +577,9 @@ platform_do_upgrade() {
        om2p-hsv2 | \
        om2p-lc | \
        om5p | \
-       om5p-an)
+       om5p-an | \
+       om5p-ac | \
+       om5p-acv2)
                platform_do_upgrade_openmesh "$ARGV"
                ;;
        unifi-outdoor-plus | \