X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Far71xx%2Fbase-files%2Flib%2Fupgrade%2Fplatform.sh;h=dfec1336fcdb28aaed4dee5d4a26b767333fecc7;hb=803e9c704e9b69f229f9aaefc3a03ad668c17051;hp=f7e0507043673ce97aeb8aef1ffa62b9079243e1;hpb=b81e5c478443aea092a42b9774cd1f04eab441b7;p=openwrt.git diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index f7e0507043..dfec1336fc 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="" @@ -73,12 +73,45 @@ 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")" local magic_long="$(get_magic_long "$1")" - [ "$ARGC" -gt 1 ] && return 1 + [ "$#" -gt 1 ] && return 1 case "$board" in all0315n | \ @@ -98,6 +131,7 @@ platform_check_image() { ap96 | \ db120 | \ hornet-ub | \ + bxu2000n-2-a1 | \ zcn-1523h-2 | \ zcn-1523h-5) [ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && { @@ -115,6 +149,7 @@ platform_check_image() { dir-615-e4 | \ dir-825-c1 | \ dir-835-a1 | \ + dragino2 | \ ew-dorin | \ ew-dorin-router | \ hornet-ub-x2 | \ @@ -154,7 +189,14 @@ platform_check_image() { dir825b_check_image "$1" && return 0 ;; - mynet-n600) + 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 @@ -178,20 +220,27 @@ platform_check_image() { ;; 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 | \ @@ -200,9 +249,12 @@ platform_check_image() { tl-wr841n-v1 | \ tl-wr841n-v7 | \ tl-wr841n-v8 | \ + tl-wr841n-v9 | \ + tl-wr842n-v2 | \ tl-wr941nd | \ tl-wr1041n-v2 | \ tl-wr1043nd | \ + tl-wr1043nd-v2 | \ tl-wr2543n) [ "$magic" != "0100" ] && { echo "Invalid image type." @@ -248,13 +300,6 @@ platform_check_image() { } return 0 ;; - wrt160nl) - [ "$magic" != "4e4c" ] && { - echo "Invalid image type." - return 1 - } - return 0 - ;; routerstation | \ routerstation-pro | \ ls-sr71 | \ @@ -264,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 @@ -303,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" ;; @@ -323,6 +374,10 @@ platform_do_upgrade() { om2p-lc) platform_do_upgrade_openmesh "$ARGV" ;; + uap-pro) + MTD_CONFIG_ARGS="-s 0x180000" + default_do_upgrade "$ARGV" + ;; *) default_do_upgrade "$ARGV" ;;