aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/orion
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-06-01 14:41:37 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-06-01 14:41:37 +0000
commit050d5201af2408cc3b83e8ad1af9e5a2cdb4ec53 (patch)
tree8bb1377a518df1ea07e8b4e4f5f76c8ccf7676ff /target/linux/orion
parent6210bf767fb092de7bf4b19af685bf5c873b4bbb (diff)
downloadupstream-050d5201af2408cc3b83e8ad1af9e5a2cdb4ec53.tar.gz
upstream-050d5201af2408cc3b83e8ad1af9e5a2cdb4ec53.tar.bz2
upstream-050d5201af2408cc3b83e8ad1af9e5a2cdb4ec53.zip
orion: fix lan and wan mac address for wrt530n v2 (patch by maddes from #7113)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21647 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/orion')
-rw-r--r--target/linux/orion/base-files/etc/uci-defaults/hardware17
1 files changed, 17 insertions, 0 deletions
diff --git a/target/linux/orion/base-files/etc/uci-defaults/hardware b/target/linux/orion/base-files/etc/uci-defaults/hardware
index 9c974963ef..7f727eb595 100644
--- a/target/linux/orion/base-files/etc/uci-defaults/hardware
+++ b/target/linux/orion/base-files/etc/uci-defaults/hardware
@@ -28,6 +28,23 @@ set system.wifi_led.mode='link tx rx'
set system.wifi_led.default='0'
commit system
__EOF
+
+# add mac address from U-Boot partition to lan and wan devices
+ MTD=`grep -e 'u-boot' /proc/mtd`
+ MTD=`echo ${MTD} | sed 's/[a-z]*\([0-9]*\):.*/\1/'`
+ [ -n "${MTD}" ] && {
+ MACADDR=`dd if=/dev/mtdblock${MTD} bs=1 skip=262048 count=6 2>/dev/null | hexdump -e '1/1 "%02x"'`
+ MACADDR2=$(( 0x${MACADDR} + 1))
+ MACADDR2=`printf "%012x" ${MACADDR2}`
+
+ MACADDR=`echo ${MACADDR} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
+ MACADDR2=`echo ${MACADDR2} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
+
+ uci set network.eth0.macaddr=${MACADDR}
+ uci set network.lan.macaddr=${MACADDR}
+ uci set network.wan.macaddr=${MACADDR2}
+ uci commit network
+ }
}
case "${hardware}" in