[OpenWrt-Devel] [PATCH 2/3 v2] gemini: Make a per-board case for ethernet MAC
Linus Walleij
linus.walleij at linaro.org
Tue Jun 11 17:06:54 EDT 2019
The DNS-313 isn't the only special board so let's bite the
bullet and create a case ladder in preparation for DIR-685.
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
ChangeLog v1->v2:
- Rebase on the new patch using library functions
---
.../lib/preinit/05_set_ether_mac_gemini | 28 +++++++++++--------
1 file changed, 16 insertions(+), 12 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 a79ee5057ffc..a51c223d85c9 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
@@ -4,6 +4,22 @@
. /lib/functions/system.sh
set_ether_mac() {
+ case $(board_name) in
+ dlink,dns-313)
+ # The DNS-313 has a special field in its RedBoot
+ # binary that we need to check
+ part=$(find_mtd_part RedBoot)
+ if [ ! -z $part ] ; then
+ DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)"
+ if [ "x$DEVID" = "xdns-313" ] ; then
+ MAC1=$(mtd_get_mac_binary RedBoot 119540)
+ ifconfig eth0 hw ether $MAC1 2>/dev/null
+ return 0
+ fi
+ fi
+ ;;
+ esac
+
# Most devices have a standard "VCTL" partition
part=$(find_mtd_part VCTL)
if [ ! -z $part ] ; then
@@ -14,18 +30,6 @@ set_ether_mac() {
ifconfig eth1 hw ether $MAC2 2>/dev/null
return 0
fi
-
- # The DNS-313 has a special field in its RedBoot
- # binary that we need to check
- part=$(find_mtd_part RedBoot)
- if [ ! -z $part ] ; then
- DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)"
- if [ "x$DEVID" = "xdns-313" ] ; then
- MAC1=$(mtd_get_mac_binary RedBoot 119540)
- ifconfig eth0 hw ether $MAC1 2>/dev/null
- return 0
- fi
- fi
}
boot_hook_add preinit_main set_ether_mac
--
2.21.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list