source: branches/backfire/target/linux/orion/base-files/etc/uci-defaults/hardware @ 21648

Last change on this file since 21648 was 21648, checked in by nbd, 6 years ago

orion: add wrt350nv2 mac address fix from r21647

File size: 1.5 KB
Line 
1#!/bin/sh
2#
3# Copyright (C) 2010 OpenWrt.org
4#
5# This is free software, licensed under the GNU General Public License v2.
6# See /LICENSE for more information.
7#
8
9#
10# This script sets system defaults for the hardware on firstboot
11#
12
13local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
14
15wrt350nv2_default() {
16# leds
17        uci batch <<__EOF
18set system.power_led=led
19set system.power_led.name='Power LED (green)'
20set system.power_led.sysfs='wrt350nv2:green:power'
21set system.power_led.default='1'
22set system.wifi_led=led
23set system.wifi_led.name='Wireless LED (green)'
24set system.wifi_led.sysfs='wrt350nv2:green:wireless'
25set system.wifi_led.trigger='netdev'
26set system.wifi_led.dev='wlan0'
27set system.wifi_led.mode='link tx rx'
28set system.wifi_led.default='0'
29commit system
30__EOF
31
32# add mac address from U-Boot partition to lan and wan devices
33        MTD=`grep -e 'u-boot' /proc/mtd`
34        MTD=`echo ${MTD} | sed 's/[a-z]*\([0-9]*\):.*/\1/'`
35        [ -n "${MTD}" ] && {
36                MACADDR=`dd if=/dev/mtdblock${MTD} bs=1 skip=262048 count=6 2>/dev/null | hexdump -e '1/1 "%02x"'`
37                MACADDR2=$(( 0x${MACADDR} + 1))
38                MACADDR2=`printf "%012x" ${MACADDR2}`
39
40                MACADDR=`echo ${MACADDR} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
41                MACADDR2=`echo ${MACADDR2} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
42
43                uci set network.eth0.macaddr=${MACADDR}
44                uci set network.lan.macaddr=${MACADDR}
45                uci set network.wan.macaddr=${MACADDR2}
46                uci commit network
47        }
48}
49
50case "${hardware}" in
51 'Linksys WRT350N v2')
52        wrt350nv2_default
53        ;;
54esac
Note: See TracBrowser for help on using the repository browser.