X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=target%2Flinux%2Far71xx%2Fbase-files%2Flib%2Fupgrade%2Fplatform.sh;h=d08799e44ba2a68d2bef4456100ef711e1801bf5;hp=81535ce9b19f5e02ed92097cdbdcac7eace13206;hb=02f2e90d5f9071ff3641a8dccfd54ab1354a0c13;hpb=3a86affcdd3daa258c9d94578857da9c124a1574 diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 81535ce9b1..d08799e44b 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -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,43 @@ 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"' +} + +cybertan_get_image_magic() { + get_image "$@" | dd bs=8 count=1 skip=0 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"' +} + +cybertan_check_image() { + local magic="$(cybertan_get_image_magic "$1")" + local fw_magic="$(cybertan_get_hw_magic)" + + [ "$fw_magic" != "$magic" ] && { + echo "Invalid image, ID mismatch, got:$magic, but need:$fw_magic" + return 1 + } + + 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")" @@ -88,10 +125,13 @@ platform_check_image() { ap113 | \ ap121 | \ ap121-mini | \ - ap136 | \ + ap136-010 | \ + ap136-020 | \ + ap135-020 | \ ap96 | \ db120 | \ hornet-ub | \ + bxu2000n-2-a1 | \ zcn-1523h-2 | \ zcn-1523h-5) [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && { @@ -102,21 +142,29 @@ platform_check_image() { ;; ap81 | \ ap83 | \ + ap132 | \ + dir-505-a1 | \ dir-600-a1 | \ dir-615-c1 | \ dir-615-e4 | \ + dir-825-c1 | \ + dir-835-a1 | \ + dragino2 | \ ew-dorin | \ ew-dorin-router | \ + hornet-ub-x2 | \ mzk-w04nu | \ mzk-w300nh | \ tew-632brp | \ tew-712br | \ + tew-732br | \ wrt400n | \ airrouter | \ bullet-m | \ nanostation-m | \ rocket-m | \ rw2458n | \ + wndap360 | \ wzr-hp-g300nh2 | \ wzr-hp-g300nh | \ wzr-hp-g450h | \ @@ -126,7 +174,9 @@ platform_check_image() { whr-hp-gn | \ wlae-ag300n | \ nbg460n_550n_550nh | \ - unifi ) + unifi | \ + unifi-outdoor | \ + carambola2 ) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 @@ -139,29 +189,71 @@ platform_check_image() { dir825b_check_image "$1" && return 0 ;; + mynet-rext|\ + wrt160nl) + cybertan_check_image "$1" && return 0 + return 1 + ;; + + mynet-n600 | \ + mynet-n750) + [ "$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 | \ om2p-hs | \ om2p-lc) - platform_check_image_om2p "$magic_long" "$1" && return 0 + platform_check_image_openmesh "$magic_long" "$1" && return 0 return 1 ;; + + archer-c7 | \ + oolite | \ + tl-mr10u | \ tl-mr11u | \ + tl-mr13u | \ tl-mr3020 | \ tl-mr3040 | \ + tl-mr3040-v2 | \ tl-mr3220 | \ + tl-mr3220-v2 | \ tl-mr3420 | \ + tl-mr3420-v2 | \ + 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 | \ tl-wr741nd | \ tl-wr741nd-v4 | \ tl-wr841n-v1 | \ tl-wr841n-v7 | \ tl-wr841n-v8 | \ + tl-wr842n-v2 | \ tl-wr941nd | \ tl-wr1041n-v2 | \ tl-wr1043nd | \ + tl-wr1043nd-v2 | \ tl-wr2543n) [ "$magic" != "0100" ] && { echo "Invalid image type." @@ -189,7 +281,15 @@ platform_check_image() { return 0 ;; - wndr3700) + uap-pro) + [ "$magic_long" != "19852003" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + wndr3700 | \ + wnr612-v2) local hw_magic hw_magic="$(ar71xx_get_mtd_part_magic firmware)" @@ -199,13 +299,6 @@ platform_check_image() { } return 0 ;; - wrt160nl) - [ "$magic" != "4e4c" ] && { - echo "Invalid image type." - return 1 - } - return 0 - ;; routerstation | \ routerstation-pro | \ ls-sr71 | \ @@ -215,7 +308,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 @@ -254,6 +349,10 @@ platform_do_upgrade() { jwap003) platform_do_upgrade_combined "$ARGV" ;; + wp543|\ + wpe72) + platform_do_upgrade_compex "$ARGV" + ;; all0258n ) platform_do_upgrade_allnet "0x9f050000" "$ARGV" ;; @@ -267,10 +366,16 @@ platform_do_upgrade() { tew-673gru) platform_do_upgrade_dir825b "$ARGV" ;; + mr600 | \ + mr600v2 | \ om2p | \ om2p-hs | \ om2p-lc) - platform_do_upgrade_om2p "$ARGV" + platform_do_upgrade_openmesh "$ARGV" + ;; + uap-pro) + MTD_CONFIG_ARGS="-s 0x180000" + default_do_upgrade "$ARGV" ;; *) default_do_upgrade "$ARGV"