aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/gemini
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-06-11 23:06:55 +0200
committerJo-Philipp Wich <jo@mein.io>2019-09-04 13:10:00 +0200
commit0b1f62a27722d1dfa417fc63fe0d7c49ecdcafe0 (patch)
tree577fc968beaf80c4762f064833dfe140a6d2c0cf /target/linux/gemini
parentb790e346b969c32524c82b6941f3c893c3d9c516 (diff)
downloadupstream-0b1f62a27722d1dfa417fc63fe0d7c49ecdcafe0.tar.gz
upstream-0b1f62a27722d1dfa417fc63fe0d7c49ecdcafe0.tar.bz2
upstream-0b1f62a27722d1dfa417fc63fe0d7c49ecdcafe0.zip
gemini: Fix MAC address assignment for DIR-685
The DIR-685 has the MAC addresses in the RedBoot code just like DNS-313. Check some magic numbers to determine that the MAC address is where we want it and extract it from RedBoot. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [replaced ifconfig with ip, ! -z = -n, added string quotes] (cherry picked from commit 86098ea87e8ef4051da5f3a1d7f75737e36df512)
Diffstat (limited to 'target/linux/gemini')
-rw-r--r--target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini15
1 files changed, 15 insertions, 0 deletions
diff --git a/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini b/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
index f63a6f1d39..e387b3c72e 100644
--- a/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
+++ b/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
@@ -23,6 +23,21 @@ set_ether_mac() {
fi
fi
;;
+ dlink,dir-685)
+ # The DIR-685 has a special field in its RedBoot
+ # binary that we need to check
+ part=$(find_mtd_part RedBoot)
+ if [ -n "$part" ] ; then
+ DEVID="$(dd if=$part bs=1 skip=81516 count=7 2>/dev/null)"
+ if [ "$DEVID" = "ILI9322" ] ; then
+ MAC1=$(mtd_get_mac_binary RedBoot 95040)
+ MAC2=$(mtd_get_mac_binary RedBoot 95046)
+ ip link set eth0 address "$MAC1" 2>/dev/null
+ ip link set eth1 address "$MAC2" 2>/dev/null
+ return 0
+ fi
+ fi
+ ;;
esac
# Most devices have a standard "VCTL" partition