ar71xx: add support for the TP-LINK TL-WR841N/ND v9
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / platform.sh
index b5a7da7d6ad2dc0ede6ac352bdf26a10580e2782..37ceea6073e8963a0db12fc9acf700b573782f9d 100755 (executable)
@@ -89,6 +89,23 @@ cybertan_check_image() {
        return 0
 }
 
+platform_do_upgrade_compex() {
+       local fw_file=$1
+       local fw_part=$PART_NAME
+       local fw_mtd=$(find_mtd_part $fw_part)
+       local fw_length=0x$(dd if="$fw_file" bs=2 skip=1 count=4 2>/dev/null)
+       local fw_blocks=$(($fw_length / 65536))
+
+       if [ -n "$fw_mtd" ] &&  [ ${fw_blocks:-0} -gt 0 ]; then
+               local append=""
+               [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR"
+
+               sync
+               dd if="$fw_file" bs=64k skip=1 count=$fw_blocks 2>/dev/null | \
+                       mtd $append write - "$fw_part"
+       fi
+}
+
 platform_check_image() {
        local board=$(ar71xx_board_name)
        local magic="$(get_magic_word "$1")"
@@ -132,6 +149,7 @@ platform_check_image() {
        dir-615-e4 | \
        dir-825-c1 | \
        dir-835-a1 | \
+       dragino2 | \
        ew-dorin | \
        ew-dorin-router | \
        hornet-ub-x2 | \
@@ -177,7 +195,8 @@ platform_check_image() {
                return 1
                ;;
 
-       mynet-n600)
+       mynet-n600 | \
+       mynet-n750)
                [ "$magic_long" != "5ea3a417" ] && {
                        echo "Invalid image, bad magic: $magic_long"
                        return 1
@@ -201,6 +220,7 @@ platform_check_image() {
                ;;
 
        archer-c7 | \
+       oolite | \
        tl-mr10u | \
        tl-mr11u | \
        tl-mr13u | \
@@ -214,10 +234,13 @@ platform_check_image() {
        tl-wa7510n | \
        tl-wa750re | \
        tl-wa850re | \
+       tl-wa801nd-v2 | \
        tl-wa901nd | \
        tl-wa901nd-v2 | \
+       tl-wa901nd-v3 | \
        tl-wdr3500 | \
        tl-wdr4300 | \
+       tl-wdr4900-v2 | \
        tl-wr703n | \
        tl-wr710n | \
        tl-wr720n-v3 | \
@@ -226,6 +249,7 @@ platform_check_image() {
        tl-wr841n-v1 | \
        tl-wr841n-v7 | \
        tl-wr841n-v8 | \
+       tl-wr841n-v9 | \
        tl-wr842n-v2 | \
        tl-wr941nd | \
        tl-wr1041n-v2 | \
@@ -285,7 +309,9 @@ platform_check_image() {
        eap7660d | \
        ja76pf | \
        ja76pf2 | \
-       jwap003)
+       jwap003 | \
+       wp543 | \
+       wpe72)
                [ "$magic" != "4349" ] && {
                        echo "Invalid image. Use *-sysupgrade.bin files on this board"
                        return 1
@@ -324,6 +350,10 @@ platform_do_upgrade() {
        jwap003)
                platform_do_upgrade_combined "$ARGV"
                ;;
+       wp543|\
+       wpe72)
+               platform_do_upgrade_compex "$ARGV"
+               ;;
        all0258n )
                platform_do_upgrade_allnet "0x9f050000" "$ARGV"
                ;;