Allow reading the Ethernet MAC address from different places in the firmware.
Use parameters for partition name, offset and OR-mask, so support for more boards can be added easily. Signed-off-by: Daniel Golle <dgo...@allnet.de> Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac =================================================================== --- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 29328) +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy) @@ -2,7 +2,7 @@ # Copyright (C) 2011 OpenWrt.org # -nw718_set_mac() { +extract_and_set_mac() { local part local mac @@ -10,13 +10,13 @@ . /etc/functions.sh - part=$(find_mtd_part "factory") + part=$(find_mtd_part "$1") [ -z $part ] && return - mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc bin2mac) + mac=$(dd bs=1 skip=$2 count=6 if=$part 2>/dev/null | maccalc bin2mac) [ -z $mac ] && return - mac=$(maccalc or "$mac" "02:00:00:00:00:00") + mac=$(maccalc or "$mac" "$3") ifconfig eth0 hw ether $mac 2>/dev/null } @@ -24,9 +24,12 @@ . /lib/ramips.sh case $(ramips_board_name) in bc2 | nw718) - nw718_set_mac + extract_and_set_mac "factory" 4 "02:00:00:00:00:00" ;; + hw550-3g) + extract_and_set_mac "factory" 40 "00:00:00:00:00:00" + ;; esac }
signature.asc
Description: Digital signature
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel