3 [ -e /lib
/firmware
/$FIRMWARE ] && exit 0
6 .
/lib
/functions
/system.sh
9 echo "ath9k eeprom: " "$*"
13 ath9k_eeprom_extract
() {
19 mtd
=$
(find_mtd_chardev
$part)
21 ath9k_eeprom_die
"no mtd device found for partition $part"
23 dd if=$mtd of
=/lib
/firmware
/$FIRMWARE bs
=1 skip
=$offset count
=$count 2>/dev
/null || \
24 ath9k_eeprom_die
"failed to extract from $mtd"
27 ath9k_ubi_eeprom_extract
() {
31 local ubidev
=$
(nand_find_ubi
$CI_UBIPART)
34 ubi
=$
(nand_find_volume
$ubidev $part)
36 ath9k_eeprom_die
"no UBI volume found for $part"
38 dd if=/dev
/$ubi of
=/lib
/firmware
/$FIRMWARE bs
=1 skip
=$offset count
=$count 2>/dev
/null || \
39 ath9k_eeprom_die
"failed to extract from $ubi"
42 ath9k_patch_firmware_mac
() {
45 [ -z "$mac" ] && return
47 macaddr_2bin
$mac |
dd of
=/lib
/firmware
/$FIRMWARE conv
=notrunc bs
=1 seek
=2 count
=6
56 .
/lib
/upgrade
/nand.sh
58 if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
59 ath9k_ubi_eeprom_extract
"caldata" 20480 4096
61 ath9k_eeprom_extract
"wifi_data" 20480 4096
62 ath9k_patch_firmware_mac $
(mtd_get_mac_binary wifi_data
12)
66 ath9k_eeprom_die
"board $board is not supported yet"
74 .
/lib
/upgrade
/nand.sh
76 if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
77 ath9k_ubi_eeprom_extract
"caldata" 4096 4096
79 ath9k_eeprom_extract
"wifi_data" 4096 4096
80 ath9k_patch_firmware_mac $
(mtd_get_mac_binary wifi_data
0)
84 ath9k_eeprom_die
"board $board is not supported yet"