Author: blogic
Date: 2015-11-02 11:17:41 +0100 (Mon, 02 Nov 2015)
New Revision: 47347

Modified:
   trunk/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
Log:
ramips: add function to change rt2x00 wifi eeprom mac

Some boards like dovado tiny ac have generic ralink mac in onflash wifi eeprom.
Add eeprom_set_macaddr function to rt2x00 eeprom extract script which changes 
mac addr insde eeprom dump.

Signed-off-by: Andrej Vlasic <[email protected]>

Modified: 
trunk/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
===================================================================
--- 
trunk/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom    
    2015-11-02 10:17:35 UTC (rev 47346)
+++ 
trunk/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom    
    2015-11-02 10:17:41 UTC (rev 47347)
@@ -21,10 +21,22 @@
                rt2x00_eeprom_die "failed to extract from $mtd"
 }
 
+rt2x00_eeprom_set_macaddr() {
+       local macaddr=$1
+
+       [ -n "$macaddr" ] || \
+               rt2x00_eeprom_die "invalid wlan mac address"
+
+       macaddr_2bin $macaddr | dd of=/lib/firmware/$FIRMWARE \
+                               conv=notrunc bs=1 seek=4 count=6 2>/dev/null || 
\
+               rt2x00_eeprom_die "failed to write mac address to eeprom file"
+}
+
 FW="/lib/firmware/$FIRMWARE"
 [ -e "$FW" ] && exit 0
 
 . /lib/ramips.sh
+. /lib/functions/system.sh
 
 board=$(ramips_board_name)
 
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to