2 . /lib/functions/system.sh
10 case "$(board_name)" in
12 # The DNS-313 has a special field in its RedBoot
13 # binary that we need to check
14 part="$(find_mtd_part RedBoot)"
15 if [ -n "$part" ]; then
16 DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)"
17 if [ "$DEVID" = "dns-313" ]; then
18 MAC1="$(mtd_get_mac_binary RedBoot 0x1d2f4)"
19 ip link set eth0 address "$MAC1" 2>/dev/null
25 # The DIR-685 has a special field in its RedBoot
26 # binary that we need to check
27 part=$(find_mtd_part RedBoot)
28 if [ -n "$part" ] ; then
29 DEVID="$(dd if=$part bs=1 skip=81516 count=7 2>/dev/null)"
30 if [ "$DEVID" = "ILI9322" ] ; then
31 MAC1=$(mtd_get_mac_binary RedBoot 0x17340)
32 MAC2=$(mtd_get_mac_binary RedBoot 0x17346)
33 ip link set eth0 address "$MAC1" 2>/dev/null
34 ip link set eth1 address "$MAC2" 2>/dev/null
41 # Most devices have a standard "VCTL" partition
42 part="$(find_mtd_part VCTL)"
43 if [ -n "$part" ]; then
44 MAC1="$(strings $part |grep MAC|cut -d: -f2|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
45 MAC2="$(strings $part |grep MAC|cut -d: -f8|cut -c3-14|sed -e 's,\(..\),:\1,g' -e 's,^:,,')"
47 ip link set eth0 address "$MAC1" 2>/dev/null
48 ip link set eth1 address "$MAC2" 2>/dev/null
53 boot_hook_add preinit_main set_ether_mac