X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/f286b80a7419f00855954fb37ec1e2d85231325f..c952d82a6c4a10c792dd4058c2430fcd6b310062:/target/linux/orion/base-files/etc/uci-defaults/hardware?ds=sidebyside diff --git a/target/linux/orion/base-files/etc/uci-defaults/hardware b/target/linux/orion/base-files/etc/uci-defaults/hardware index 9c974963e..7f727eb59 100644 --- a/target/linux/orion/base-files/etc/uci-defaults/hardware +++ b/target/linux/orion/base-files/etc/uci-defaults/hardware @@ -28,6 +28,23 @@ set system.wifi_led.mode='link tx rx' set system.wifi_led.default='0' commit system __EOF + +# add mac address from U-Boot partition to lan and wan devices + MTD=`grep -e 'u-boot' /proc/mtd` + MTD=`echo ${MTD} | sed 's/[a-z]*\([0-9]*\):.*/\1/'` + [ -n "${MTD}" ] && { + MACADDR=`dd if=/dev/mtdblock${MTD} bs=1 skip=262048 count=6 2>/dev/null | hexdump -e '1/1 "%02x"'` + MACADDR2=$(( 0x${MACADDR} + 1)) + MACADDR2=`printf "%012x" ${MACADDR2}` + + MACADDR=`echo ${MACADDR} | sed 's/\(..\)/\1:/g' | sed 's/:$//'` + MACADDR2=`echo ${MACADDR2} | sed 's/\(..\)/\1:/g' | sed 's/:$//'` + + uci set network.eth0.macaddr=${MACADDR} + uci set network.lan.macaddr=${MACADDR} + uci set network.wan.macaddr=${MACADDR2} + uci commit network + } } case "${hardware}" in