ramips: Support for NexAira BC2
[openwrt.git] / target / linux / ramips / base-files / lib / preinit / 06_set_iface_mac
1 #
2 # Copyright (C) 2011 OpenWrt.org
3 #
4
5 nw718_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
23 preinit_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
33 boot_hook_add preinit_main preinit_set_mac_address
This page took 0.064068 seconds and 5 git commands to generate.