4 echo "rt2x00 eeprom: " "$*"
8 rt2x00_eeprom_extract
() {
14 mtd
=$
(find_mtd_part
$part)
16 rt2x00_eeprom_die
"no mtd device found for partition $part"
18 dd if=$mtd of
=/lib
/firmware
/$FIRMWARE bs
=1 skip
=$offset count
=$count 2>/dev
/null || \
19 rt2x00_eeprom_die
"failed to extract from $mtd"
22 rt2x00_eeprom_set_macaddr
() {
25 [ -n "$macaddr" ] || \
26 rt2x00_eeprom_die
"invalid wlan mac address"
28 macaddr_2bin
$macaddr |
dd of
=/lib
/firmware
/$FIRMWARE \
29 conv
=notrunc bs
=1 seek
=4 count
=6 2>/dev
/null || \
30 rt2x00_eeprom_die
"failed to write mac address to eeprom file"
33 FW
="/lib/firmware/$FIRMWARE"
34 [ -e "$FW" ] && exit 0
37 .
/lib
/functions
/system.sh
45 wifi_mac
=$
(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR
)
46 rt2x00_eeprom_extract
"factory" 0 512
47 rt2x00_eeprom_set_macaddr
$wifi_mac
50 rt2x00_eeprom_die
"Please define mtd-eeprom in $board DTS file!"