ar71xx: add user-space support for the BXU2000n-2 A1 board
[openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
index 9542295..ae04a8c 100755 (executable)
@@ -49,7 +49,7 @@ platform_do_upgrade_combined() {
 
        if [ -n "$partitions" ] && [ -n "$kernelpart" ] && \
           [ ${kern_blocks:-0} -gt 0 ] && \
-          [ ${root_blocks:-0} -gt ${kern_blocks:-0} ] && \
+          [ ${root_blocks:-0} -gt 0 ] && \
           [ ${erase_size:-0} -gt 0 ];
        then
                local append=""
@@ -69,6 +69,10 @@ 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"'
 }
 
+seama_get_type_magic() {
+       get_image "$@" | dd bs=1 count=4 skip=53 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
 platform_check_image() {
        local board=$(ar71xx_board_name)
        local magic="$(get_magic_word "$1")"
@@ -94,6 +98,7 @@ platform_check_image() {
        ap96 | \
        db120 | \
        hornet-ub | \
+       bxu2000n-2-a1 | \
        zcn-1523h-2 | \
        zcn-1523h-5)
                [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
@@ -105,6 +110,7 @@ platform_check_image() {
        ap81 | \
        ap83 | \
        ap132 | \
+       dir-505-a1 | \
        dir-600-a1 | \
        dir-615-c1 | \
        dir-615-e4 | \
@@ -112,10 +118,12 @@ platform_check_image() {
        dir-835-a1 | \
        ew-dorin | \
        ew-dorin-router | \
+       hornet-ub-x2 | \
        mzk-w04nu | \
        mzk-w300nh | \
        tew-632brp | \
        tew-712br | \
+       tew-732br | \
        wrt400n | \
        airrouter | \
        bullet-m | \
@@ -147,6 +155,20 @@ platform_check_image() {
                dir825b_check_image "$1" && return 0
                ;;
 
+       mynet-n600)
+               [ "$magic_long" != "5ea3a417" ] && {
+                       echo "Invalid image, bad magic: $magic_long"
+                       return 1
+               }
+
+               local typemagic=$(seama_get_type_magic "$1")
+               [ "$typemagic" != "6669726d" ] && {
+                       echo "Invalid image, bad type: $typemagic"
+                       return 1
+               }
+
+               return 0;
+               ;;
        mr600 | \
        mr600v2 | \
        om2p | \
@@ -157,9 +179,12 @@ platform_check_image() {
                ;;
 
        archer-c7 | \
+       tl-mr10u | \
        tl-mr11u | \
+       tl-mr13u | \
        tl-mr3020 | \
        tl-mr3040 | \
+       tl-mr3040-v2 | \
        tl-mr3220 | \
        tl-mr3220-v2 | \
        tl-mr3420 | \
@@ -170,6 +195,7 @@ platform_check_image() {
        tl-wdr3500 | \
        tl-wdr4300 | \
        tl-wr703n | \
+       tl-wr710n | \
        tl-wr720n-v3 | \
        tl-wr741nd | \
        tl-wr741nd-v4 | \
@@ -213,7 +239,8 @@ platform_check_image() {
                }
                return 0
                ;;
-       wndr3700)
+       wndr3700 | \
+       wnr612-v2)
                local hw_magic
 
                hw_magic="$(ar71xx_get_mtd_part_magic firmware)"