diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2019-06-11 23:06:54 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-04 13:09:56 +0200 |
commit | b790e346b969c32524c82b6941f3c893c3d9c516 (patch) | |
tree | 5ceae4c8cc7d32c9d375feb4ee449f4cfb4bf91e /target/linux/gemini/base-files/lib/preinit | |
parent | 28d80068667baf9ae62da2044699b3bf6879b83f (diff) | |
download | upstream-b790e346b969c32524c82b6941f3c893c3d9c516.tar.gz upstream-b790e346b969c32524c82b6941f3c893c3d9c516.tar.bz2 upstream-b790e346b969c32524c82b6941f3c893c3d9c516.zip |
gemini: Make a per-board case for ethernet MAC
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@linaro.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [refreshed]
(cherry picked from commit 38d85d2c9fd9a3fd061fb56823821834dd720516)
Diffstat (limited to 'target/linux/gemini/base-files/lib/preinit')
-rw-r--r-- | target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini | 28 |
1 files 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 fed76a3e22..f63a6f1d39 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 @@ -9,6 +9,22 @@ set_ether_mac() { local MAC1 local MAC2 + 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 [ -n "$part" ]; then + DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)" + if [ "$DEVID" = "dns-313" ]; then + MAC1="$(mtd_get_mac_binary RedBoot 119540)" + ip link set eth0 address "$MAC1" 2>/dev/null + return 0 + fi + fi + ;; + esac + # Most devices have a standard "VCTL" partition part="$(find_mtd_part VCTL)" if [ -n "$part" ]; then @@ -19,18 +35,6 @@ set_ether_mac() { ip link set eth1 address "$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 [ -n "$part" ]; then - DEVID="$(dd if=$part bs=1 skip=119508 count=7 2>/dev/null)" - if [ "$DEVID" = "dns-313" ]; then - MAC1="$(mtd_get_mac_binary RedBoot 119540)" - ip link set eth0 address "$MAC1" 2>/dev/null - return 0 - fi - fi } boot_hook_add preinit_main set_ether_mac |