meta-digi-dbl: Modify the atheros init script.

Modify the script to fetch MAC addresses from the command line instead
of using nvram.

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2013-03-04 16:55:33 +01:00
parent 9c2567021e
commit b4ac5d171f
1 changed files with 12 additions and 7 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh -l
#===============================================================================
#
# 10-atheros_pre-up
# atheros
#
# Copyright (C) 2012 by Digi International Inc.
# All rights reserved.
@ -20,7 +20,7 @@ set -e
# Exit if not the wlan0 interface,
# or we've already run once
[ "${IFACE}" != "wlan0" -o -e /var/run/10-atheros_pre_up ] && exit 0
[ "${IFACE}" != "wlan0" -o -e /var/run/atheros ] && exit 0
# If not manufacturing mode, exit if product has no wifi
if [ -z "$1" -a ! -e /var/run/product_info/wifi ]; then
@ -33,11 +33,16 @@ RAM_DRIVE="/var/run"
MAC_FILENAME="softmac"
#
# Use $1 for the MAC address, or, if empty, extract from ethaddr2 in NVRAM
# and then strip 'ethaddr2='
# Use $1 for the MAC address, or, if empty, get the wlan MAC address
# from kernel command line. Use a default # value if the address has not
# been set.
#
MAC_ADDR=${1:-$(nvram print module ethaddr2)}
MAC_ADDR=${MAC_ADDR#*=}
MAC_ADDR_CMDLINE=`cat /proc/cmdline | sed 's/\s/\n/g' | awk '/ethaddr2/ {print}' | sed 's/ethaddr2=//g'`
MAC_ADDR=${1:-$(MAC_ADDR_CMDLINE)}
if [ -z "${MAC_ADDR}" -o "${MAC_ADDR}" = "00:00:00:00:00:00" ]; then
MAC_ADDR="00:04:F3:4C:B1:D3"
fi
mac1="$(echo ${MAC_ADDR} | cut -d':' -f1)"
mac2="$(echo ${MAC_ADDR} | cut -d':' -f2)"