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=c87fbff75b969f4801d252260b7638020a9c2620;hp=2358c58c8f6dcbef723f09c2be6b5665d2c3972e;hb=33154eaf41e8045def037ca037d8a29a2b3e8284;hpb=016520330440cb0aca4367150911721b748f75e8 diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 2358c58c8f..c87fbff75b 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -7,10 +7,13 @@ PART_NAME=firmware RAMFS_COPY_DATA=/lib/ar71xx.sh +[ -x /usr/sbin/nandwrite ] && RAMFS_COPY_BIN=/usr/sbin/nandwrite CI_BLKSZ=65536 CI_LDADR=0x80060000 +PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=0 + platform_find_partitions() { local first dev size erasesize name while read dev size erasesize name; do @@ -40,6 +43,13 @@ platform_find_kernelpart() { done } +platform_find_rootfspart() { + local part + for part in "${1%:*}" "${1#*:}"; do + [ "$part" != "$2" ] && echo "$part" && break + done +} + platform_do_upgrade_combined() { local partitions=$(platform_find_partitions) local kernelpart=$(platform_find_kernelpart "${partitions#*:}") @@ -53,13 +63,22 @@ platform_do_upgrade_combined() { [ ${root_blocks:-0} -gt 0 ] && \ [ ${erase_size:-0} -gt 0 ]; then + local rootfspart=$(platform_find_rootfspart "$partitions" "$kernelpart") local append="" [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" - ( dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null; \ - dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null ) | \ - mtd -r $append -F$kernelpart:$kern_length:$CI_LDADR,rootfs write - $partitions + if [ "$PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD" -ne 1 ]; then + ( dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null; \ + dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null ) | \ + mtd -r $append -F$kernelpart:$kern_length:$CI_LDADR,rootfs write - $partitions + elif [ -n "$rootfspart" ]; then + dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null | \ + mtd write - $kernelpart + dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null | \ + mtd -r $append write - $rootfspart + fi fi + PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=0 } tplink_get_image_hwid() { @@ -164,6 +183,15 @@ alfa_check_image() { return 0 } +platform_nand_board_name() { + local board=$(ar71xx_board_name) + + case "$board" in + rb*) echo "routerboard";; + *) echo "$board";; + esac +} + platform_check_image() { local board=$(ar71xx_board_name) local magic="$(get_magic_word "$1")" @@ -176,12 +204,20 @@ platform_check_image() { airgateway|\ airrouter|\ ap132|\ - ap81|\ - ap83|\ + ap90q|\ + archer-c59-v1|\ + archer-c60-v1|\ bullet-m|\ c-55|\ carambola2|\ cf-e316n-v2|\ + cf-e320n-v2|\ + cf-e380ac-v1|\ + cf-e380ac-v2|\ + cf-e520n|\ + cf-e530n|\ + cpe830|\ + cpe870|\ dgl-5500-a1|\ dhp-1565-a1|\ dir-505-a1|\ @@ -216,10 +252,15 @@ platform_check_image() { nanostation-m-xw|\ nanostation-m|\ nbg460n_550n_550nh|\ + pqi-air-pen|\ rocket-m-ti|\ rocket-m-xw|\ rocket-m|\ rw2458n|\ + sc1750|\ + sc300m|\ + sc450|\ + sr3200|\ tew-632brp|\ tew-712br|\ tew-732br|\ @@ -243,7 +284,8 @@ platform_check_image() { wzr-hp-ag300h|\ wzr-hp-g300nh2|\ wzr-hp-g300nh|\ - wzr-hp-g450h) + wzr-hp-g450h|\ + xd3200) [ "$magic" != "2705" ] && { echo "Invalid image type." return 1 @@ -253,7 +295,6 @@ platform_check_image() { ;; alfa-ap96|\ alfa-nx|\ - ap113|\ ap121-mini|\ ap121|\ ap135-020|\ @@ -301,6 +342,7 @@ platform_check_image() { ls-sr71|\ pb42|\ pb44|\ + rb-941-2nd|\ routerstation-pro|\ routerstation|\ wp543|\ @@ -336,6 +378,7 @@ platform_check_image() { omy-x1|\ onion-omega|\ oolite|\ + re450|\ smart-300|\ som9331|\ tellstick-znet-lite|\ @@ -355,6 +398,7 @@ platform_check_image() { tl-wa750re|\ tl-wa7510n|\ tl-wa801nd-v2|\ + tl-wa801nd-v3|\ tl-wa830re-v2|\ tl-wa850re|\ tl-wa860re|\ @@ -370,6 +414,7 @@ platform_check_image() { tl-wpa8630|\ tl-wr1041n-v2|\ tl-wr1043nd-v2|\ + tl-wr1043nd-v4|\ tl-wr1043nd|\ tl-wr2543n|\ tl-wr703n|\ @@ -388,6 +433,7 @@ platform_check_image() { tl-wr842n-v3|\ tl-wr941nd-v5|\ tl-wr941nd-v6|\ + tl-wr940n-v4|\ tl-wr941nd) local magic_ver="0100" @@ -432,6 +478,10 @@ platform_check_image() { tew-673gru) dir825b_check_image "$1" && return 0 ;; + rb*) + nand_do_platform_check routerboard $1 + return $? + ;; c-60|\ nbg6716|\ r6100|\ @@ -442,7 +492,9 @@ platform_check_image() { ;; cpe210|\ cpe510|\ - eap120) + eap120|\ + wbs210|\ + wbs510) tplink_pharos_check_image "$1" && return 0 return 1 ;; @@ -487,6 +539,7 @@ platform_check_image() { return 0 ;; + e2100l|\ mynet-rext|\ wrt160nl) cybertan_check_image "$1" && return 0 @@ -556,6 +609,9 @@ platform_pre_upgrade() { local board=$(ar71xx_board_name) case "$board" in + rb-941-2nd) + ;; + rb*|\ c-60|\ nbg6716|\ r6100|\ @@ -570,10 +626,29 @@ platform_pre_upgrade() { esac } +platform_nand_pre_upgrade() { + local board=$(ar71xx_board_name) + + case "$board" in + rb*) + CI_KERNPART=none + local fw_mtd=$(find_mtd_part kernel) + fw_mtd="${fw_mtd/block/}" + [ -n "$fw_mtd" ] || return + mtd erase kernel + tar xf "$1" sysupgrade-routerboard/kernel -O | nandwrite -o "$fw_mtd" - + ;; + esac +} + platform_do_upgrade() { local board=$(ar71xx_board_name) case "$board" in + rb-941-2nd) + PLATFORM_DO_UPGRADE_COMBINED_SEPARATE_MTD=1 + platform_do_upgrade_combined "$ARGV" + ;; all0258n) platform_do_upgrade_allnet "0x9f050000" "$ARGV" ;;