aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-11-02 10:17:41 +0000
committerJohn Crispin <blogic@openwrt.org>2015-11-02 10:17:41 +0000
commit7a7b5c5cc10f972d331c5b7a909b3cad494611cf (patch)
treeb16733da871f76f5dff4e22060213fac7a502b45
parenta4e58d8137d61db28bdebce798de600270ba2640 (diff)
downloadmaster-187ad058-7a7b5c5cc10f972d331c5b7a909b3cad494611cf.tar.gz
master-187ad058-7a7b5c5cc10f972d331c5b7a909b3cad494611cf.tar.bz2
master-187ad058-7a7b5c5cc10f972d331c5b7a909b3cad494611cf.zip
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 <andrej.vlasic0@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47347 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
index 0cd95a5abd..1ba6728b2b 100644
--- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
+++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -21,10 +21,22 @@ rt2x00_eeprom_extract() {
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)