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 iflag
=skip_bytes bs
=$count skip
=$offset count
=1 2>/dev
/null || \
19 rt2x00_eeprom_die
"failed to extract from $mtd"
22 jboot_eeprom_extract
() {
27 mtd
=$
(find_mtd_part
$part)
29 rt2x00_eeprom_die
"no mtd device found for partition $part"
31 jboot_config_read
-i $mtd -o $offset -e /lib
/firmware
/$FIRMWARE 2>/dev
/null || \
32 rt2x00_eeprom_die
"failed to extract from $mtd"
35 rt2x00_eeprom_set_macaddr
() {
38 [ -n "$macaddr" ] || \
39 rt2x00_eeprom_die
"invalid wlan mac address"
41 macaddr_2bin
$macaddr |
dd of
=/lib
/firmware
/$FIRMWARE \
42 conv
=notrunc oflag
=seek_bytes bs
=6 seek
=4 count
=1 2>/dev
/null || \
43 rt2x00_eeprom_die
"failed to write mac address to eeprom file"
46 FW
="/lib/firmware/$FIRMWARE"
47 [ -e "$FW" ] && exit 0
50 .
/lib
/functions
/system.sh
64 wan_mac
=$
(jboot_config_read
-m -i $
(find_mtd_part
"config") -o 0xE000)
65 wifi_mac
=$
(macaddr_add
"$wan_mac" 1)
66 jboot_eeprom_extract
"config" 0xE000
67 rt2x00_eeprom_set_macaddr
$wifi_mac
70 wifi_mac
=$
(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR
)
71 rt2x00_eeprom_extract
"factory" 0x0 0x200
72 rt2x00_eeprom_set_macaddr
$wifi_mac
75 rt2x00_eeprom_die
"Please define mtd-eeprom in $board DTS file!"