3 [ -e /lib
/firmware
/$FIRMWARE ] && exit 0
7 .
/lib
/functions
/system.sh
10 echo "ath9k eeprom: " "$*"
14 ath9k_eeprom_extract
() {
20 mtd
=$
(find_mtd_chardev
$part)
22 ath9k_eeprom_die
"no mtd device found for partition $part"
24 dd if=$mtd of
=/lib
/firmware
/$FIRMWARE bs
=1 skip
=$offset count
=$count 2>/dev
/null || \
25 ath9k_eeprom_die
"failed to extract from $mtd"
28 ath9k_ubi_eeprom_extract
() {
32 local ubidev
=$
(nand_find_ubi
$CI_UBIPART)
35 ubi
=$
(nand_find_volume
$ubidev $part)
37 ath9k_eeprom_die
"no UBI volume found for $part"
39 dd if=/dev
/$ubi of
=/lib
/firmware
/$FIRMWARE bs
=1 skip
=$offset count
=$count 2>/dev
/null || \
40 ath9k_eeprom_die
"failed to extract from $ubi"
43 ath9k_patch_firmware_mac
() {
46 [ -z "$mac" ] && return
48 macaddr_2bin
$mac |
dd of
=/lib
/firmware
/$FIRMWARE conv
=notrunc bs
=1 seek
=2 count
=6
51 board
=$
(apm821xx_board_name
)
57 .
/lib
/upgrade
/nand.sh
59 if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
60 ath9k_ubi_eeprom_extract
"caldata" 20480 4096
62 ath9k_eeprom_extract
"wifi_data" 20480 4096
63 ath9k_patch_firmware_mac $
(mtd_get_mac_binary wifi_data
12)
67 ath9k_eeprom_die
"board $board is not supported yet"
75 .
/lib
/upgrade
/nand.sh
77 if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
78 ath9k_ubi_eeprom_extract
"caldata" 4096 4096
80 ath9k_eeprom_extract
"wifi_data" 4096 4096
81 ath9k_patch_firmware_mac $
(mtd_get_mac_binary wifi_data
0)
85 ath9k_eeprom_die
"board $board is not supported yet"