aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
diff options
context:
space:
mode:
authorThibaut VARENE <hacks@slashdirt.org>2017-01-04 22:44:54 +0100
committerFelix Fietkau <nbd@nbd.name>2017-02-01 14:59:11 +0100
commitca2a03d1f6fc5288f1f1e9098c317ca9249e50b9 (patch)
tree29f41ea9f5bcd906ff6eef24f8ea353ee42a8ae7 /target/linux/ar71xx/base-files/lib/upgrade/platform.sh
parent0656bee36b157c19a248f35999001f48b91c8ec1 (diff)
downloadupstream-ca2a03d1f6fc5288f1f1e9098c317ca9249e50b9.tar.gz
upstream-ca2a03d1f6fc5288f1f1e9098c317ca9249e50b9.tar.bz2
upstream-ca2a03d1f6fc5288f1f1e9098c317ca9249e50b9.zip
ar71xx: add support for RB-941-2nD
Add full support for Mikrotik RB-941-2nD (hAP lite) Original patch by Sergey Sergeev <adron@yapic.net> and more information is available here: https://wiki.openwrt.org/toh/mikrotik/rb941_2nd I updated and adapted the patch to apply cleanly to LEDE trunk and added proper numbering for the switch ports (matching case labels). Tested working on actual hardware with the information provided in the above webpage. Sysupgrade works. Signed-off-by: Thibaut VARENE <hacks@slashdirt.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/ar71xx/base-files/lib/upgrade/platform.sh')
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh29
1 files changed, 26 insertions, 3 deletions
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 82ed041d66..80da9131c7 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -12,6 +12,8 @@ RAMFS_COPY_DATA=/lib/ar71xx.sh
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
@@ -41,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#*:}")
@@ -54,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() {
@@ -318,6 +336,7 @@ platform_check_image() {
ls-sr71|\
pb42|\
pb44|\
+ rb-941-2nd|\
routerstation-pro|\
routerstation|\
wp543|\
@@ -618,6 +637,10 @@ 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"
;;