3 [ -e /lib
/firmware
/$FIRMWARE ] && exit 0
5 .
/lib
/functions
/caldata.sh
7 jboot_eeprom_extract
() {
12 mtd
=$
(find_mtd_part
$part)
14 caldata_die
"no mtd device found for partition $part"
16 jboot_config_read
-i $mtd -o $offset -e /lib
/firmware
/$FIRMWARE 2>/dev
/null || \
17 caldata_die
"failed to extract from $mtd"
20 rt2x00_eeprom_set_macaddr
() {
23 [ -n "$macaddr" ] || \
24 caldata_die
"invalid wlan mac address"
26 macaddr_2bin
$macaddr |
dd of
=/lib
/firmware
/$FIRMWARE \
27 conv
=notrunc oflag
=seek_bytes bs
=6 seek
=4 count
=1 2>/dev
/null || \
28 caldata_die
"failed to write mac address to eeprom file"
43 wan_mac
=$
(jboot_config_read
-m -i $
(find_mtd_part
"config") -o 0xE000)
44 wifi_mac
=$
(macaddr_add
"$wan_mac" 1)
45 jboot_eeprom_extract
"config" 0xE000
46 rt2x00_eeprom_set_macaddr
$wifi_mac
49 wifi_mac
=$
(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR
)
50 caldata_extract
"factory" 0x0 0x200
51 rt2x00_eeprom_set_macaddr
$wifi_mac
54 caldata_die
"Please define mtd-eeprom in $board DTS file!"