summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/base-files
diff options
context:
space:
mode:
authorDaniel Dickinson <crazycshore@gmail.com>2012-09-06 18:15:26 +0000
committerDaniel Dickinson <crazycshore@gmail.com>2012-09-06 18:15:26 +0000
commitc3b7139ab229bba6f0368b5e8152fb6cf8aec008 (patch)
tree3fe8b0d363ce382759618ddd1fdd481462965db5 /target/linux/ar71xx/base-files
parent31e063d212a4b5ee910041c072a5b611eec31578 (diff)
downloadmtk-20170518-c3b7139ab229bba6f0368b5e8152fb6cf8aec008.zip
mtk-20170518-c3b7139ab229bba6f0368b5e8152fb6cf8aec008.tar.gz
mtk-20170518-c3b7139ab229bba6f0368b5e8152fb6cf8aec008.tar.bz2
dir825b1: Add image for DIR-825-B1 that uses the whole flash (must first be flashed with the 'standard' image) and an image to revert the change to allow reversion to stock firmware.
SVN-Revision: 33326
Diffstat (limited to 'target/linux/ar71xx/base-files')
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh4
-rw-r--r--target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration66
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/network2
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh6
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh2
5 files changed, 79 insertions, 1 deletions
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 420d690..570bdcb 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -64,7 +64,9 @@ get_status_led() {
dir-615-c1)
status_led="d-link:green:status"
;;
- dir-825-b1)
+ dir-825-b1 |\
+ dir-825-b1-openwrt |\
+ dir-825-b1-stock)
status_led="d-link:orange:power"
;;
eap7660d)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration
new file mode 100644
index 0000000..750ff40
--- /dev/null
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+. /lib/ar71xx.sh
+
+board=$(ar71xx_board_name)
+
+findmtd() {
+ local partname="$1"
+ grep "\"$partname\"" /proc/mtd | awk -F: '{ print $1 }'
+}
+
+getcalmac() {
+ local partname="$1"
+ local offset="$2"
+
+ hexdump -e '17/1 "%c"' -s $offset -n 17 /dev/$(findmtd $partname) | tr -d : | tr 'A-Z' 'a-z'
+}
+
+calcmacX() {
+ local mac="$1"
+ local X="$2"
+
+ local oui="$(expr substr "$mac" 1 6)"
+ local end="$(expr substr "$mac" 7 12)"
+
+ echo -n $oui
+ expr substr "$(printf "%6lx" "$(($(printf "%lu" 0x${end}) + $X))")" 1 6
+}
+
+getifmac() {
+ local ifname="$1"
+
+ local ifmac
+
+ ifmac="$(ifconfig "$ifname" | grep HWaddr)"
+ ifmac="${ifmac#*HWaddr }"
+ ifmac="${ifmac%% *}"
+
+ echo "$ifmac" | tr -d : | tr 'A-Z' 'a-z'
+}
+
+case "$board" in
+dir-825-b1)
+ mac1="$(getcalmac caldata 65440)"
+ mac1="$(calcmacX "$mac1" 2)"
+ mac2="$(calcmacX "$mac1" 1)"
+
+ if grep -q '"owrt_caldata"' /proc/mtd && [ "$mac1" = "$(getifmac eth0)" ] && [ "$mac2" = "$(getifmac eth1)" ]; then
+ dd if=/dev/$(findmtd caldata) of=/dev/$(findmtd owrt_caldata) bs=65536 count=1
+ fi
+ ;;
+dir-825-b1-tostock)
+ mac1="$(getcalmac owrt_caldata 65440)"
+ mac1="$(calcmacX "$mac1" 2)"
+ mac2="$(calcmacX "$mac1" 1)"
+ if grep -q '"owrt_caldata"' /proc/mtd && [ "$mac1" = "$(getifmac eth0)" ] && [ "$mac2" = "$(getifmac eth1)" ]; then
+ dd if=/dev/$(findmtd owrt_caldata) of=/dev/$(findmtd caldata) bs=65536 count=1
+ fi
+ ;;
+esac
+
+return 0
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network
index f251f4c..ce52d0e 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network
@@ -31,6 +31,8 @@ db120)
;;
dir-825-b1|\
+dir-825-b1-openwrt|\
+dir-825-b1-tostock|\
tew-673gru)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "rtl8366s" "1" "1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index cc24864..a1979a6 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -201,6 +201,12 @@ ar71xx_board_detect() {
*"DIR-825 rev. B1")
name="dir-825-b1"
;;
+ *"DIR-825 rev. B1 OpenWrt")
+ name="dir-825-b1-openwrt"
+ ;;
+ *"DIR-825 rev. B1 TOSTOCK")
+ name="dir-825-b1-tostock"
+ ;;
*EAP7660D)
name="eap7660d"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 02e3916..2992aed 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -101,6 +101,8 @@ platform_check_image() {
dir-615-c1 | \
dir-615-e4 | \
dir-825-b1 | \
+ dir-825-b1-openwrt | \
+ dir-825-b1-tostock | \
ew-dorin | \
ew-dorin-router | \
mzk-w04nu | \