source: trunk/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac @ 28571

Last change on this file since 28571 was 28571, checked in by juhosg, 5 years ago

ramips: Support for NexAira BC2

The preconfiguration of the USB LED has benn move to the
/etc/uci-defaults/leds script. [juhosg]

Signed-off-by: Adam Porter <porter.adam at gmail.com>

File size: 552 bytes
Line 
1#
2# Copyright (C) 2011 OpenWrt.org
3#
4
5nw718_set_mac() {
6        local part
7        local mac
8
9        [ -z $(which maccalc) ] && return
10
11        . /etc/functions.sh
12
13        part=$(find_mtd_part "factory")
14        [ -z $part ] && return
15
16        mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc bin2mac)
17        [ -z $mac ] && return
18
19        mac=$(maccalc or "$mac" "02:00:00:00:00:00")
20        ifconfig eth0 hw ether $mac 2>/dev/null
21}
22
23preinit_set_mac_address() {
24        . /lib/ramips.sh
25
26        case $(ramips_board_name) in
27        bc2 | nw718)
28                nw718_set_mac
29                ;;
30        esac
31}
32
33boot_hook_add preinit_main preinit_set_mac_address
Note: See TracBrowser for help on using the repository browser.