4 echo "rt2x00 eeprom: " "$*"
8 rt2x00_eeprom_extract
() {
16 mtd
=$
(find_mtd_part
$part)
18 rt2x00_eeprom_die
"no mtd device found for partition $part"
20 dd if=$mtd of
=/lib
/firmware
/$FIRMWARE bs
=1 skip
=$offset count
=$count 2>/dev
/null || \
21 rt2x00_eeprom_die
"failed to extract from $mtd"
24 rt2x00_eeprom_set_macaddr
() {
27 [ -n "$macaddr" ] || \
28 rt2x00_eeprom_die
"invalid wlan mac address"
30 macaddr_2bin
$macaddr |
dd of
=/lib
/firmware
/$FIRMWARE \
31 conv
=notrunc bs
=1 seek
=4 count
=6 2>/dev
/null || \
32 rt2x00_eeprom_die
"failed to write mac address to eeprom file"
35 FW
="/lib/firmware/$FIRMWARE"
36 [ -e "$FW" ] && exit 0
39 .
/lib
/functions
/system.sh
41 board
=$
(ramips_board_name
)
47 wifi_mac
=$
(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR
)
48 rt2x00_eeprom_extract
"factory" 0 512
49 rt2x00_eeprom_set_macaddr
$wifi_mac
52 rt2x00_eeprom_die
"Please define mtd-eeprom in $board DTS file!"