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.wall...@linaro.org> --- .../lib/preinit/05_set_ether_mac_gemini | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 6072e828c678..ecf4a8238143 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 @@ -18,6 +18,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 + CONFIG_PARTITION="$(grep "RedBoot" /proc/mtd | cut -d: -f1)" + if [ ! -z $CONFIG_PARTITION ] ; then + DEVID="$(dd if=/dev/mtdblock0 bs=1 skip=81516 count=7 2>/dev/null)" + if [ "x$DEVID" = "xILI9322" ] ; then + MAC1="$(dd if=/dev/mtdblock0 bs=1 skip=95040 count=6 2>/dev/null | hexdump -n6 -v -e '/1 ":%02X"' | sed s/^://g)" + MAC2="$(dd if=/dev/mtdblock0 bs=1 skip=95046 count=6 2>/dev/null | hexdump -n6 -v -e '/1 ":%02X"' | sed s/^://g)" + ifconfig eth0 hw ether $MAC1 2>/dev/null + ifconfig eth1 hw ether $MAC2 2>/dev/null + return 0 + fi + fi + ;; esac # Most devices have a standard "VCTL" partition -- 2.20.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel