treewide: convert WiFi caldata size and offset to hexadecimal

This changes size and offset set for WiFi caldata extraction and
MAC address adjustment to hexadecimal notation.

This will be much clearer for the reader when numbers are big, and
will also match the style used for mtd-cal-data in DTS files.

Since dd cannot deal with hexadecimal notation, one has to convert
back to decimal by simple $(($hexnum)).

Acked-by: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2019-08-09 17:45:13 +02:00 committed by Alexander Couzens
parent 75bfc393ba
commit b133e466b0
No known key found for this signature in database
GPG Key ID: C29E9DA6A0DF8604
11 changed files with 202 additions and 202 deletions

View File

@ -12,8 +12,8 @@ ath9k_eeprom_die() {
ath9k_eeprom_extract() { ath9k_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -26,8 +26,8 @@ ath9k_eeprom_extract() {
ath9k_ubi_eeprom_extract() { ath9k_ubi_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local ubidev=$(nand_find_ubi $CI_UBIPART) local ubidev=$(nand_find_ubi $CI_UBIPART)
local ubi local ubi
@ -40,11 +40,11 @@ ath9k_ubi_eeprom_extract() {
} }
ath9k_patch_firmware_mac() { ath9k_patch_firmware_mac() {
local mac=$1 local mac=$1
[ -z "$mac" ] && return [ -z "$mac" ] && return
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=2 count=6 macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=2 count=6
} }
board=$(board_name) board=$(board_name)
@ -56,9 +56,9 @@ case "$FIRMWARE" in
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 20480 4096 ath9k_ubi_eeprom_extract "caldata" 0x5000 0x1000
else else
ath9k_eeprom_extract "wifi_data" 20480 4096 ath9k_eeprom_extract "wifi_data" 0x5000 0x1000
ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0xc) ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0xc)
fi fi
;; ;;
@ -74,9 +74,9 @@ case "$FIRMWARE" in
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 4096 4096 ath9k_ubi_eeprom_extract "caldata" 0x1000 0x1000
else else
ath9k_eeprom_extract "wifi_data" 4096 4096 ath9k_eeprom_extract "wifi_data" 0x1000 0x1000
ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0x0) ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0x0)
fi fi
;; ;;

View File

@ -12,8 +12,8 @@ ath9k_eeprom_die() {
ath9k_eeprom_extract() { ath9k_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -26,8 +26,8 @@ ath9k_eeprom_extract() {
ath9k_ubi_eeprom_extract() { ath9k_ubi_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local ubidev=$(nand_find_ubi $CI_UBIPART) local ubidev=$(nand_find_ubi $CI_UBIPART)
local ubi local ubi
@ -42,7 +42,7 @@ ath9k_ubi_eeprom_extract() {
ath9k_eeprom_extract_reverse() { ath9k_eeprom_extract_reverse() {
local part=$1 local part=$1
local offset=$2 local offset=$2
local count=$3 local count=$(($3))
local mtd local mtd
local reversed local reversed
local caldata local caldata
@ -72,43 +72,43 @@ case "$FIRMWARE" in
case $board in case $board in
c-55|\ c-55|\
c-60) c-60)
ath9k_eeprom_extract "art" 4096 2048 ath9k_eeprom_extract "art" 0x1000 0x800
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1)
;; ;;
fritz4020|\ fritz4020|\
fritz450e) fritz450e)
ath9k_eeprom_extract_reverse "urlader" 5441 1088 ath9k_eeprom_extract_reverse "urlader" 0x1541 0x440
;; ;;
mr18) mr18)
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 4096 2048 ath9k_ubi_eeprom_extract "caldata" 0x1000 0x800
else else
ath9k_eeprom_extract "odm-caldata" 4096 2048 ath9k_eeprom_extract "odm-caldata" 0x1000 0x800
fi fi
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +1) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +1)
;; ;;
r6100 | \ r6100 | \
wndr3700v4 | \ wndr3700v4 | \
wndr4300) wndr4300)
ath9k_eeprom_extract "caldata" 4096 2048 ath9k_eeprom_extract "caldata" 0x1000 0x800
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0x0) ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0x0)
;; ;;
rambutan) rambutan)
ath9k_eeprom_extract "art" 4096 2048 ath9k_eeprom_extract "art" 0x1000 0x800
;; ;;
wlr8100) wlr8100)
ath9k_eeprom_extract "art" 4096 2048 ath9k_eeprom_extract "art" 0x1000 0x800
ath9k_patch_firmware_mac $(mtd_get_mac_ascii u-boot-env "ethaddr") ath9k_patch_firmware_mac $(mtd_get_mac_ascii u-boot-env "ethaddr")
;; ;;
z1) z1)
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 4096 2048 ath9k_ubi_eeprom_extract "caldata" 0x1000 0x800
else else
ath9k_eeprom_extract "origcaldata" 4096 2048 ath9k_eeprom_extract "origcaldata" 0x1000 0x800
fi fi
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +2) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +2)
;; ;;
@ -121,34 +121,34 @@ case "$FIRMWARE" in
"pci_wmac0.eeprom") "pci_wmac0.eeprom")
case $board in case $board in
c-55) c-55)
ath9k_eeprom_extract "art" 20480 2048 ath9k_eeprom_extract "art" 0x5000 0x800
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2)
;; ;;
fritz300e) fritz300e)
ath9k_eeprom_extract_reverse "urloader" 5441 1088 ath9k_eeprom_extract_reverse "urloader" 0x1541 0x440
;; ;;
mr18) mr18)
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 20480 2048 ath9k_ubi_eeprom_extract "caldata" 0x5000 0x800
else else
ath9k_eeprom_extract "odm-caldata" 20480 2048 ath9k_eeprom_extract "odm-caldata" 0x5000 0x800
fi fi
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +2) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +2)
;; ;;
wndr3700v4 | \ wndr3700v4 | \
wndr4300) wndr4300)
ath9k_eeprom_extract "caldata" 20480 2048 ath9k_eeprom_extract "caldata" 0x5000 0x800
ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0xc) ath9k_patch_firmware_mac $(mtd_get_mac_binary caldata 0xc)
;; ;;
z1) z1)
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 86016 4096 ath9k_ubi_eeprom_extract "caldata" 0x15000 0x1000
else else
ath9k_eeprom_extract "origcaldata" 86016 4096 ath9k_eeprom_extract "origcaldata" 0x15000 0x1000
fi fi
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +3) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +3)
;; ;;
@ -164,9 +164,9 @@ case "$FIRMWARE" in
. /lib/upgrade/nand.sh . /lib/upgrade/nand.sh
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
ath9k_ubi_eeprom_extract "caldata" 36864 2048 ath9k_ubi_eeprom_extract "caldata" 0x9000 0x800
else else
ath9k_eeprom_extract "odm-caldata" 36864 2048 ath9k_eeprom_extract "odm-caldata" 0x9000 0x800
fi fi
ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +3) ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 0x66) +3)
;; ;;

View File

@ -7,8 +7,8 @@ ath10kcal_die() {
ath10kcal_from_file() { ath10kcal_from_file() {
local source=$1 local source=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $source" ath10kcal_die "failed to extract calibration data from $source"
@ -16,8 +16,8 @@ ath10kcal_from_file() {
ath10kcal_extract() { ath10kcal_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd cal_size local mtd cal_size
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -57,17 +57,17 @@ case "$FIRMWARE" in
mr1750|\ mr1750|\
mr1750v2|\ mr1750v2|\
om5p-acv2) om5p-acv2)
ath10kcal_extract "ART" 20480 2116 ath10kcal_extract "ART" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
;; ;;
archer-c25-v1|\ archer-c25-v1|\
tl-wdr6500-v2) tl-wdr6500-v2)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
;; ;;
archer-c7-v4|\ archer-c7-v4|\
archer-c7-v5) archer-c7-v5)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
;; ;;
cf-e355ac-v1|\ cf-e355ac-v1|\
@ -81,60 +81,60 @@ case "$FIRMWARE" in
oolite-v5.2-dev|\ oolite-v5.2-dev|\
sr3200|\ sr3200|\
xd3200) xd3200)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
;; ;;
dap-2695-a1) dap-2695-a1)
ath10kcal_extract "radiocfg" 20480 2116 ath10kcal_extract "radiocfg" 0x5000 0x844
ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a) ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a)
;; ;;
dir-869-a1|\ dir-869-a1|\
qihoo-c301) qihoo-c301)
ath10kcal_extract "radiocfg" 20480 2116 ath10kcal_extract "radiocfg" 0x5000 0x844
ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
;; ;;
dw33d) dw33d)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(mtd_get_mac_binary art 0x12) ath10kcal_patch_mac $(mtd_get_mac_binary art 0x12)
;; ;;
epg5000|\ epg5000|\
esr1750) esr1750)
ath10kcal_extract "caldata" 20480 2116 ath10kcal_extract "caldata" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
;; ;;
gl-ar750s|\ gl-ar750s|\
gl-ar750|\ gl-ar750|\
tl-wpa8630) tl-wpa8630)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
;; ;;
koala) koala)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0xc) +0) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0xc) +0)
;; ;;
mc-mac1200r) mc-mac1200r)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
;; ;;
r6100) r6100)
ath10kcal_extract "caldata" 20480 2116 ath10kcal_extract "caldata" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2)
;; ;;
rb-952ui-5ac2nd|\ rb-952ui-5ac2nd|\
rb-wapg-5hact2hnd) rb-wapg-5hact2hnd)
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 0x5000 0x844
;; ;;
re355|\ re355|\
re450|\ re450|\
tl-wr902ac-v1) tl-wr902ac-v1)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;; ;;
unifiac-lite|\ unifiac-lite|\
unifiac-pro) unifiac-pro)
ath10kcal_extract "EEPROM" 20480 2116 ath10kcal_extract "EEPROM" 0x5000 0x844
;; ;;
wi2a-ac200i) wi2a-ac200i)
ath10kcal_extract "ART" 20480 2116 ath10kcal_extract "ART" 0x5000 0x844
;; ;;
esac esac
;; ;;
@ -142,26 +142,26 @@ case "$FIRMWARE" in
case $board in case $board in
archer-c5|\ archer-c5|\
archer-c7) archer-c7)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
;; ;;
nbg6616|\ nbg6616|\
nbg6716) nbg6716)
ath10kcal_extract "RFdata" 20480 2116 ath10kcal_extract "RFdata" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
;; ;;
om5p-ac) om5p-ac)
ath10kcal_extract "ART" 20480 2116 ath10kcal_extract "ART" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
;; ;;
rb-911g-5hpacd|\ rb-911g-5hpacd|\
rb-921gs-5hpacd-r2|\ rb-921gs-5hpacd-r2|\
rb-922uags-5hpacd|\ rb-922uags-5hpacd|\
rb-962uigs-5hact2hnt) rb-962uigs-5hact2hnt)
ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116 ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 0x5000 0x844
;; ;;
wlr8100) wlr8100)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
;; ;;
esac esac
@ -174,18 +174,18 @@ case "$FIRMWARE" in
archer-c60-v1|\ archer-c60-v1|\
cf-e355ac-v2|\ cf-e355ac-v2|\
cf-e375ac) cf-e375ac)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;; ;;
archer-c60-v2) archer-c60-v2)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
;; ;;
cf-e385ac) cf-e385ac)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
;; ;;
esac esac
;; ;;

View File

@ -12,8 +12,8 @@ ath9k_eeprom_die() {
ath9k_eeprom_extract() { ath9k_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -27,7 +27,7 @@ ath9k_eeprom_extract() {
ath9k_eeprom_extract_reverse() { ath9k_eeprom_extract_reverse() {
local part=$1 local part=$1
local offset=$2 local offset=$2
local count=$3 local count=$(($3))
local mtd local mtd
local reversed local reversed
local caldata local caldata
@ -59,8 +59,8 @@ xor() {
ath9k_patch_fw_mac() { ath9k_patch_fw_mac() {
local mac=$1 local mac=$1
local mac_offset=$2 local mac_offset=$(($2))
local chksum_offset=$3 local chksum_offset=$(($3))
local xor_mac local xor_mac
local xor_fw_mac local xor_fw_mac
local xor_fw_chksum local xor_fw_chksum
@ -98,12 +98,12 @@ case "$FIRMWARE" in
"ath9k-eeprom-ahb-18100000.wmac.bin") "ath9k-eeprom-ahb-18100000.wmac.bin")
case $board in case $board in
avm,fritz4020) avm,fritz4020)
ath9k_eeprom_extract_reverse "urlader" 5441 1088 ath9k_eeprom_extract_reverse "urlader" 0x1541 0x440
;; ;;
dlink,dir-825-c1|\ dlink,dir-825-c1|\
dlink,dir-835-a1) dlink,dir-835-a1)
ath9k_eeprom_extract "art" 4096 1088 ath9k_eeprom_extract "art" 0x1000 0x440
ath9k_patch_fw_mac_crc $(mtd_get_mac_text "mac" 0x4) 2 ath9k_patch_fw_mac_crc $(mtd_get_mac_text "mac" 0x4) 0x2
;; ;;
dlink,dir-842-c1|\ dlink,dir-842-c1|\
dlink,dir-842-c2|\ dlink,dir-842-c2|\
@ -111,28 +111,28 @@ case "$FIRMWARE" in
dlink,dir-859-a1|\ dlink,dir-859-a1|\
nec,wg1200cr|\ nec,wg1200cr|\
wd,mynet-n750) wd,mynet-n750)
ath9k_eeprom_extract "art" 4096 1088 ath9k_eeprom_extract "art" 0x1000 0x440
ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 2 ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 0x2
;; ;;
engenius,ecb1750) engenius,ecb1750)
ath9k_eeprom_extract "art" 4096 1088 ath9k_eeprom_extract "art" 0x1000 0x440
ath9k_patch_fw_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env "athaddr") +1) 2 ath9k_patch_fw_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env "athaddr") +1) 0x2
;; ;;
engenius,epg5000|\ engenius,epg5000|\
iodata,wn-ac1167dgr|\ iodata,wn-ac1167dgr|\
iodata,wn-ac1600dgr|\ iodata,wn-ac1600dgr|\
iodata,wn-ac1600dgr2|\ iodata,wn-ac1600dgr2|\
iodata,wn-ag300dgr) iodata,wn-ag300dgr)
ath9k_eeprom_extract "art" 4096 1088 ath9k_eeprom_extract "art" 0x1000 0x440
ath9k_patch_fw_mac $(mtd_get_mac_ascii u-boot-env ethaddr) 2 ath9k_patch_fw_mac $(mtd_get_mac_ascii u-boot-env ethaddr) 0x2
;; ;;
nec,wg800hp) nec,wg800hp)
ath9k_eeprom_extract "art" 4096 1088 ath9k_eeprom_extract "art" 0x1000 0x440
ath9k_patch_fw_mac $(mtd_get_mac_text board_data 0x680) 2 ath9k_patch_fw_mac $(mtd_get_mac_text board_data 0x680) 0x2
;; ;;
qihoo,c301) qihoo,c301)
ath9k_eeprom_extract "radiocfg" 4096 1088 ath9k_eeprom_extract "radiocfg" 0x1000 0x440
ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 2 ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 0x2
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"
@ -142,28 +142,28 @@ case "$FIRMWARE" in
"ath9k-eeprom-pci-0000:00:00.0.bin") "ath9k-eeprom-pci-0000:00:00.0.bin")
case $board in case $board in
avm,fritz300e) avm,fritz300e)
ath9k_eeprom_extract_reverse "urloader" 5441 1088 ath9k_eeprom_extract_reverse "urloader" 0x1541 0x440
;; ;;
buffalo,whr-g301n|\ buffalo,whr-g301n|\
buffalo,wzr-hp-g302h-a1a0|\ buffalo,wzr-hp-g302h-a1a0|\
tplink,tl-wr841-v5|\ tplink,tl-wr841-v5|\
tplink,tl-wr941-v4) tplink,tl-wr941-v4)
ath9k_eeprom_extract "art" 4096 3768 ath9k_eeprom_extract "art" 0x1000 0xeb8
;; ;;
buffalo,wzr-hp-g450h) buffalo,wzr-hp-g450h)
ath9k_eeprom_extract "art" 4096 1088 ath9k_eeprom_extract "art" 0x1000 0x440
;; ;;
dlink,dir-825-c1|\ dlink,dir-825-c1|\
dlink,dir-835-a1) dlink,dir-835-a1)
ath9k_eeprom_extract "art" 20480 1088 ath9k_eeprom_extract "art" 0x5000 0x440
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "mac" 0x18) 1) 2 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "mac" 0x18) 1) 0x2
;; ;;
ocedo,raccoon|\ ocedo,raccoon|\
tplink,tl-wdr3600-v1|\ tplink,tl-wdr3600-v1|\
tplink,tl-wdr4300-v1|\ tplink,tl-wdr4300-v1|\
tplink,tl-wdr4900-v2|\ tplink,tl-wdr4900-v2|\
winchannel,wb2000) winchannel,wb2000)
ath9k_eeprom_extract "art" 20480 1088 ath9k_eeprom_extract "art" 0x5000 0x440
;; ;;
netgear,wnr612-v2|\ netgear,wnr612-v2|\
on,n150r|\ on,n150r|\
@ -181,21 +181,21 @@ case "$FIRMWARE" in
ubnt,bullet-m|\ ubnt,bullet-m|\
ubnt,nano-m|\ ubnt,nano-m|\
ubnt,rocket-m) ubnt,rocket-m)
ath9k_eeprom_extract "art" 4096 4096 ath9k_eeprom_extract "art" 0x1000 0x1000
;; ;;
pqi,air-pen) pqi,air-pen)
ath9k_eeprom_extract "art" 4096 2002 ath9k_eeprom_extract "art" 0x1000 0x7d2
;; ;;
ubnt,unifi) ubnt,unifi)
ath9k_eeprom_extract "art" 4096 2048 ath9k_eeprom_extract "art" 0x1000 0x800
;; ;;
wd,mynet-n750) wd,mynet-n750)
ath9k_eeprom_extract "art" 20480 1088 ath9k_eeprom_extract "art" 0x5000 0x440
ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan5mac") 2 ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan5mac") 0x2
;; ;;
wd,mynet-wifi-rangeextender) wd,mynet-wifi-rangeextender)
ath9k_eeprom_extract "art" 4096 4096 ath9k_eeprom_extract "art" 0x1000 0x1000
ath9k_patch_fw_mac_crc $(nvram get wl0_hwaddr) "$mac" 2 ath9k_patch_fw_mac_crc $(nvram get wl0_hwaddr) "$mac" 0x2
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"
@ -208,11 +208,11 @@ case "$FIRMWARE" in
netgear,wndr3700|\ netgear,wndr3700|\
netgear,wndr3700v2|\ netgear,wndr3700v2|\
netgear,wndr3800) netgear,wndr3800)
ath9k_eeprom_extract "art" 4096 3768 ath9k_eeprom_extract "art" 0x1000 0xeb8
;; ;;
dlink,dir-825-b1) dlink,dir-825-b1)
ath9k_eeprom_extract "caldata" 4096 3768 ath9k_eeprom_extract "caldata" 0x1000 0xeb8
ath9k_patch_fw_mac_crc $(mtd_get_mac_text "caldata" 0xffa0) 524 ath9k_patch_fw_mac_crc $(mtd_get_mac_text "caldata" 0xffa0) 0x20c
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"
@ -225,11 +225,11 @@ case "$FIRMWARE" in
netgear,wndr3700|\ netgear,wndr3700|\
netgear,wndr3700v2|\ netgear,wndr3700v2|\
netgear,wndr3800) netgear,wndr3800)
ath9k_eeprom_extract "art" 20480 3768 ath9k_eeprom_extract "art" 0x5000 0xeb8
;; ;;
dlink,dir-825-b1) dlink,dir-825-b1)
ath9k_eeprom_extract "caldata" 20480 3768 ath9k_eeprom_extract "caldata" 0x5000 0xeb8
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 0xffb4) 1) 524 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 0xffb4) 1) 0x20c
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"

View File

@ -25,8 +25,8 @@ ath10kcal_die() {
ath10kcal_from_file() { ath10kcal_from_file() {
local source=$1 local source=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $source" ath10kcal_die "failed to extract calibration data from $source"
@ -34,8 +34,8 @@ ath10kcal_from_file() {
ath10kcal_extract() { ath10kcal_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -90,7 +90,7 @@ case "$FIRMWARE" in
comfast,cf-wr650ac-v1|\ comfast,cf-wr650ac-v1|\
comfast,cf-wr650ac-v2|\ comfast,cf-wr650ac-v2|\
yuncore,a770) yuncore,a770)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
;; ;;
devolo,dvl1200e|\ devolo,dvl1200e|\
devolo,dvl1200i|\ devolo,dvl1200i|\
@ -98,53 +98,53 @@ case "$FIRMWARE" in
devolo,dvl1750e|\ devolo,dvl1750e|\
devolo,dvl1750i|\ devolo,dvl1750i|\
devolo,dvl1750x) devolo,dvl1750x)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x0) -1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x0) -1)
;; ;;
dlink,dir-859-a1) dlink,dir-859-a1)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac") ath10kcal_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")
;; ;;
elecom,wrc-1750ghbk2-i) elecom,wrc-1750ghbk2-i)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
;; ;;
engenius,ecb1750) engenius,ecb1750)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr) ath10kcal_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr)
;; ;;
engenius,epg5000|\ engenius,epg5000|\
iodata,wn-ac1167dgr|\ iodata,wn-ac1167dgr|\
iodata,wn-ac1600dgr2) iodata,wn-ac1600dgr2)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
;; ;;
engenius,ews511ap) engenius,ews511ap)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
;; ;;
glinet,gl-ar750s) glinet,gl-ar750s)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1)
;; ;;
glinet,gl-x750) glinet,gl-x750)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2)
;; ;;
nec,wg800hp) nec,wg800hp)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac_crc $(mtd_get_mac_text board_data 0x880) ath10kcal_patch_mac_crc $(mtd_get_mac_text board_data 0x880)
;; ;;
ocedo,koala|\ ocedo,koala|\
ocedo,ursus) ocedo,ursus)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(mtd_get_mac_binary art 0xc) ath10kcal_patch_mac $(mtd_get_mac_binary art 0xc)
;; ;;
openmesh,om5p-ac-v2) openmesh,om5p-ac-v2)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
;; ;;
qihoo,c301) qihoo,c301)
ath10kcal_extract "radiocfg" 20480 2116 ath10kcal_extract "radiocfg" 0x5000 0x844
ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac) ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac)
;; ;;
tplink,archer-a7-v5|\ tplink,archer-a7-v5|\
@ -152,29 +152,29 @@ case "$FIRMWARE" in
tplink,archer-c7-v4|\ tplink,archer-c7-v4|\
tplink,archer-c7-v5|\ tplink,archer-c7-v5|\
tplink,archer-c25-v1) tplink,archer-c25-v1)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1)
;; ;;
tplink,archer-c5-v1|\ tplink,archer-c5-v1|\
tplink,archer-c7-v2) tplink,archer-c7-v2)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x1fc00) -1) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x1fc00) -1)
;; ;;
tplink,archer-d50-v1) tplink,archer-d50-v1)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary romfile 0xf100) +2) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary romfile 0xf100) +2)
;; ;;
tplink,re350k-v1) tplink,re350k-v1)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x10008) +2) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x10008) +2)
;; ;;
tplink,re355-v1|\ tplink,re355-v1|\
tplink,re450-v1) tplink,re450-v1)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;; ;;
tplink,re450-v2) tplink,re450-v2)
ath10kcal_extract "art" 20480 2116 ath10kcal_extract "art" 0x5000 0x844
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +1) ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +1)
;; ;;
ubnt,unifiac-lite|\ ubnt,unifiac-lite|\
@ -185,7 +185,7 @@ case "$FIRMWARE" in
ubnt,nanostation-ac|\ ubnt,nanostation-ac|\
ubnt,nanostation-ac-loco|\ ubnt,nanostation-ac-loco|\
ubnt,unifiac-pro) ubnt,unifiac-pro)
ath10kcal_extract "EEPROM" 20480 2116 ath10kcal_extract "EEPROM" 0x5000 0x844
;; ;;
esac esac
;; ;;
@ -195,18 +195,18 @@ case "$FIRMWARE" in
dlink,dir-842-c2|\ dlink,dir-842-c2|\
dlink,dir-842-c3|\ dlink,dir-842-c3|\
nec,wg1200cr) nec,wg1200cr)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac) ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;; ;;
netgear,ex6400|\ netgear,ex6400|\
netgear,ex7300) netgear,ex7300)
ath10kcal_extract "caldata" 20480 12064 ath10kcal_extract "caldata" 0x5000 0x2f20
ath10kcal_patch_mac $(mtd_get_mac_binary caldata 0xc) ath10kcal_patch_mac $(mtd_get_mac_binary caldata 0xc)
;; ;;
phicomm,k2t) phicomm,k2t)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(k2t_get_mac "5g_mac") ath10kcal_patch_mac_crc $(k2t_get_mac "5g_mac")
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
@ -216,7 +216,7 @@ case "$FIRMWARE" in
tplink,archer-c60-v1|\ tplink,archer-c60-v1|\
tplink,archer-c60-v2|\ tplink,archer-c60-v2|\
tplink,archer-c6-v2) tplink,archer-c6-v2)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1)
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin /lib/firmware/ath10k/QCA9888/hw2.0/board.bin

View File

@ -8,8 +8,8 @@ rt2x00_eeprom_die() {
rt2x00_eeprom_extract() { rt2x00_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_part $part) mtd=$(find_mtd_part $part)
@ -30,11 +30,11 @@ case "$FIRMWARE" in
"rt2x00.eeprom" ) "rt2x00.eeprom" )
case $board in case $board in
hg556a_c) hg556a_c)
rt2x00_eeprom_extract "cal_data" 130560 512 rt2x00_eeprom_extract "cal_data" 0x1fe00 0x200
;; ;;
hg622 |\ hg622 |\
hg655b) hg655b)
rt2x00_eeprom_extract "cal_data" 0 512 rt2x00_eeprom_extract "cal_data" 0x0 0x200
;; ;;
*) *)
rt2x00_eeprom_die "board $board is not supported yet" rt2x00_eeprom_die "board $board is not supported yet"

View File

@ -23,8 +23,8 @@ ath10kcal_die() {
ath10kcal_extract() { ath10kcal_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -37,8 +37,8 @@ ath10kcal_extract() {
ath10kcal_ubi_extract() { ath10kcal_ubi_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local ubidev local ubidev
local ubi local ubi
@ -97,8 +97,8 @@ case "$FIRMWARE" in
"ath10k/cal-pci-0000:01:00.0.bin") "ath10k/cal-pci-0000:01:00.0.bin")
case "$board" in case "$board" in
meraki,mr33) meraki,mr33)
ath10kcal_ubi_extract "ART" 36864 2116 ath10kcal_ubi_extract "ART" 0x9000 0x844
ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 36864 2116 ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 0x9000 0x844
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1) ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1)
;; ;;
esac esac
@ -106,7 +106,7 @@ case "$FIRMWARE" in
"ath10k/pre-cal-pci-0000:01:00.0.bin") "ath10k/pre-cal-pci-0000:01:00.0.bin")
case "$board" in case "$board" in
asus,map-ac2200) asus,map-ac2200)
ath10kcal_ubi_extract "Factory" 36864 12064 ath10kcal_ubi_extract "Factory" 0x9000 0x2f20
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin /lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;; ;;
@ -115,12 +115,12 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;; ;;
linksys,ea8300) linksys,ea8300)
ath10kcal_extract "ART" 36864 12064 ath10kcal_extract "ART" 0x9000 0x2f20
# OEM assigns 4 sequential MACs # OEM assigns 4 sequential MACs
ath10kcal_patch_mac_crc $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4)) ath10kcal_patch_mac_crc $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
;; ;;
openmesh,a62) openmesh,a62)
ath10kcal_extract "0:ART" 36864 12064 ath10kcal_extract "0:ART" 0x9000 0x2f20
;; ;;
esac esac
;; ;;
@ -131,14 +131,14 @@ case "$FIRMWARE" in
glinet,gl-b1300 |\ glinet,gl-b1300 |\
linksys,ea6350v3 |\ linksys,ea6350v3 |\
qcom,ap-dk01.1-c1) qcom,ap-dk01.1-c1)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
;; ;;
asus,map-ac2200) asus,map-ac2200)
ath10kcal_ubi_extract "Factory" 4096 12064 ath10kcal_ubi_extract "Factory" 0x1000 0x2f20
;; ;;
asus,rt-ac58u) asus,rt-ac58u)
CI_UBIPART=UBI_DEV CI_UBIPART=UBI_DEV
ath10kcal_ubi_extract "Factory" 4096 12064 ath10kcal_ubi_extract "Factory" 0x1000 0x2f20
;; ;;
avm,fritzbox-4040) avm,fritzbox-4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
@ -154,29 +154,29 @@ case "$FIRMWARE" in
openmesh,a62 |\ openmesh,a62 |\
qxwlan,e2600ac-c1 |\ qxwlan,e2600ac-c1 |\
qxwlan,e2600ac-c2) qxwlan,e2600ac-c2)
ath10kcal_extract "0:ART" 4096 12064 ath10kcal_extract "0:ART" 0x1000 0x2f20
;; ;;
engenius,ens620ext) engenius,ens620ext)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2)
;; ;;
linksys,ea8300) linksys,ea8300)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
;; ;;
meraki,mr33) meraki,mr33)
ath10kcal_ubi_extract "ART" 4096 12064 ath10kcal_ubi_extract "ART" 0x1000 0x2f20
ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 4096 12064 ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2) ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2)
;; ;;
netgear,ex6100v2 |\ netgear,ex6100v2 |\
netgear,ex6150v2) netgear,ex6150v2)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0x0) ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0x0)
;; ;;
zyxel,nbg6617 |\ zyxel,nbg6617 |\
zyxel,wre6606) zyxel,wre6606)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2) ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
;; ;;
esac esac
@ -188,14 +188,14 @@ case "$FIRMWARE" in
glinet,gl-b1300 |\ glinet,gl-b1300 |\
linksys,ea6350v3 |\ linksys,ea6350v3 |\
qcom,ap-dk01.1-c1) qcom,ap-dk01.1-c1)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
;; ;;
asus,map-ac2200) asus,map-ac2200)
ath10kcal_ubi_extract "Factory" 20480 12064 ath10kcal_ubi_extract "Factory" 0x5000 0x2f20
;; ;;
asus,rt-ac58u) asus,rt-ac58u)
CI_UBIPART=UBI_DEV CI_UBIPART=UBI_DEV
ath10kcal_ubi_extract "Factory" 20480 12064 ath10kcal_ubi_extract "Factory" 0x5000 0x2f20
;; ;;
avm,fritzbox-4040) avm,fritzbox-4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
@ -211,29 +211,29 @@ case "$FIRMWARE" in
openmesh,a62 |\ openmesh,a62 |\
qxwlan,e2600ac-c1 |\ qxwlan,e2600ac-c1 |\
qxwlan,e2600ac-c2) qxwlan,e2600ac-c2)
ath10kcal_extract "0:ART" 20480 12064 ath10kcal_extract "0:ART" 0x5000 0x2f20
;; ;;
engenius,ens620ext) engenius,ens620ext)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3)
;; ;;
linksys,ea8300) linksys,ea8300)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
;; ;;
meraki,mr33) meraki,mr33)
ath10kcal_ubi_extract "ART" 20480 12064 ath10kcal_ubi_extract "ART" 0x5000 0x2f20
ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 20480 12064 ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3) ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
;; ;;
netgear,ex6100v2 |\ netgear,ex6100v2 |\
netgear,ex6150v2) netgear,ex6150v2)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0xc) ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0xc)
;; ;;
zyxel,nbg6617 |\ zyxel,nbg6617 |\
zyxel,wre6606) zyxel,wre6606)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1) ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
;; ;;
esac esac

View File

@ -23,8 +23,8 @@ ath10kcal_die() {
ath10kcal_from_file() { ath10kcal_from_file() {
local source=$1 local source=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $source" ath10kcal_die "failed to extract calibration data from $source"
@ -32,8 +32,8 @@ ath10kcal_from_file() {
ath10kcal_extract() { ath10kcal_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -80,33 +80,33 @@ case "$FIRMWARE" in
"ath10k/pre-cal-pci-0000:01:00.0.bin") "ath10k/pre-cal-pci-0000:01:00.0.bin")
case $board in case $board in
buffalo,wxr-2533dhp) buffalo,wxr-2533dhp)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 0x1e) ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 0x1e)
;; ;;
linksys,ea8500) linksys,ea8500)
ath10kcal_extract "art" 4096 12064 ath10kcal_extract "art" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1)
;; ;;
nec,wg2600hp) nec,wg2600hp)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 0xc) +1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 0xc) +1)
;; ;;
netgear,d7800 |\ netgear,d7800 |\
netgear,r7500v2 |\ netgear,r7500v2 |\
netgear,r7800) netgear,r7800)
ath10kcal_extract "art" 4096 12064 ath10kcal_extract "art" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x6) +1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x6) +1)
;; ;;
tplink,c2600) tplink,c2600)
ath10kcal_extract "radio" 4096 12064 ath10kcal_extract "radio" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0x8) -1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0x8) -1)
;; ;;
tplink,vr2600v) tplink,vr2600v)
ath10kcal_extract "ART" 4096 12064 ath10kcal_extract "ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0x0) -1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0x0) -1)
;; ;;
zyxel,nbg6817) zyxel,nbg6817)
ath10kcal_extract "0:ART" 4096 12064 ath10kcal_extract "0:ART" 0x1000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1)
;; ;;
esac esac
@ -114,33 +114,33 @@ case "$FIRMWARE" in
"ath10k/pre-cal-pci-0001:01:00.0.bin") "ath10k/pre-cal-pci-0001:01:00.0.bin")
case $board in case $board in
buffalo,wxr-2533dhp) buffalo,wxr-2533dhp)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 0x18) ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 0x18)
;; ;;
linksys,ea8500) linksys,ea8500)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2)
;; ;;
nec,wg2600hp) nec,wg2600hp)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary PRODUCTDATA 0xc) ath10kcal_patch_mac_crc $(mtd_get_mac_binary PRODUCTDATA 0xc)
;; ;;
netgear,d7800 |\ netgear,d7800 |\
netgear,r7500v2 |\ netgear,r7500v2 |\
netgear,r7800) netgear,r7800)
ath10kcal_extract "art" 20480 12064 ath10kcal_extract "art" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x6) +2) ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x6) +2)
;; ;;
tplink,c2600) tplink,c2600)
ath10kcal_extract "radio" 20480 12064 ath10kcal_extract "radio" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0x8) ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0x8)
;; ;;
tplink,vr2600v) tplink,vr2600v)
ath10kcal_extract "ART" 20480 12064 ath10kcal_extract "ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0x0) ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0x0)
;; ;;
zyxel,nbg6817) zyxel,nbg6817)
ath10kcal_extract "0:ART" 20480 12064 ath10kcal_extract "0:ART" 0x5000 0x2f20
ath10kcal_patch_mac_crc $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) ath10kcal_patch_mac_crc $(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
;; ;;
esac esac

View File

@ -30,7 +30,7 @@ ath9k_eeprom_die() {
ath9k_eeprom_extract_raw() { ath9k_eeprom_extract_raw() {
local source=$1 local source=$1
local offset=$2 local offset=$(($2))
local swap=$3 local swap=$3
local size=4096 local size=4096
local bs=1 local bs=1
@ -50,7 +50,7 @@ ath9k_eeprom_extract_raw() {
ath9k_eeprom_extract_reverse() { ath9k_eeprom_extract_reverse() {
local part=$1 local part=$1
local offset=$2 local offset=$2
local count=$3 local count=$(($3))
local mtd local mtd
local reversed local reversed
local caldata local caldata
@ -102,8 +102,8 @@ ath9k_patch_fw_mac_crc() {
ath9k_patch_fw_mac() { ath9k_patch_fw_mac() {
local mac=$1 local mac=$1
local mac_offset=$2 local mac_offset=$(($2))
local chksum_offset=$3 local chksum_offset=$(($3))
local xor_mac local xor_mac
local xor_fw_mac local xor_fw_mac
local xor_fw_chksum local xor_fw_chksum
@ -135,40 +135,40 @@ case "$FIRMWARE" in
case "$board" in case "$board" in
arcadyan,arv7518pw) arcadyan,arv7518pw)
ath9k_eeprom_extract "boardconfig" 1024 1 ath9k_eeprom_extract "boardconfig" 0x400 1
;; ;;
arcadyan,arv8539pw22) arcadyan,arv8539pw22)
ath9k_eeprom_extract "art" 1024 1 ath9k_eeprom_extract "art" 0x400 1
;; ;;
bt,homehub-v2b) bt,homehub-v2b)
ath9k_eeprom_extract "art" 0 1 ath9k_eeprom_extract "art" 0x0 1
ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 524 ath9k_patch_fw_mac_crc "00:00:00:00:00:00" 0x20c
;; ;;
bt,homehub-v3a) bt,homehub-v3a)
ath9k_eeprom_extract "art-copy" 0 1 ath9k_eeprom_extract "art-copy" 0x0 1
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 268 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 0x10c
;; ;;
bt,homehub-v5a) bt,homehub-v5a)
ath9k_ubi_eeprom_extract "caldata" 4096 0 ath9k_ubi_eeprom_extract "caldata" 0x1000 0
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +2) 268 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +2) 0x10c
;; ;;
netgear,dgn3500|netgear,dgn3500b) netgear,dgn3500|netgear,dgn3500b)
ath9k_eeprom_extract "calibration" 61440 0 ath9k_eeprom_extract "calibration" 0xf000 0
ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 524 ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 0x20c
;; ;;
avm,fritz3370-rev2-hynix|\ avm,fritz3370-rev2-hynix|\
avm,fritz3370-rev2-micron|\ avm,fritz3370-rev2-micron|\
avm,fritz7362sl) avm,fritz7362sl)
ath9k_eeprom_extract_reverse "urlader" 5441 1088 ath9k_eeprom_extract_reverse "urlader" 0x1541 0x440
;; ;;
avm,fritz7312|avm,fritz7320|avm,fritz7360sl) avm,fritz7312|avm,fritz7320|avm,fritz7360sl)
ath9k_eeprom_extract "urlader" 2437 0 ath9k_eeprom_extract "urlader" 0x985 0
;; ;;
avm,fritz7412) avm,fritz7412)
/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
;; ;;
tplink,tdw8970|tplink,tdw8980) tplink,tdw8970|tplink,tdw8980)
ath9k_eeprom_extract "boardconfig" 135168 0 ath9k_eeprom_extract "boardconfig" 0x21000 0
;; ;;
*) *)
ath9k_eeprom_die "board $board is not supported yet" ath9k_eeprom_die "board $board is not supported yet"

View File

@ -9,8 +9,8 @@ ath9k_eeprom_die() {
ath9k_eeprom_extract() { ath9k_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_chardev $part) mtd=$(find_mtd_chardev $part)
@ -43,7 +43,7 @@ case "$FIRMWARE" in
"pci_wmac0.eeprom") "pci_wmac0.eeprom")
case $board in case $board in
tplink,tl-wdr4900-v1) tplink,tl-wdr4900-v1)
ath9k_eeprom_extract "caldata" 4096 2048 ath9k_eeprom_extract "caldata" 0x1000 0x800
tpl_set_wireless_mac 0 tpl_set_wireless_mac 0
;; ;;
*) *)
@ -55,7 +55,7 @@ case "$FIRMWARE" in
"pci_wmac1.eeprom") "pci_wmac1.eeprom")
case $board in case $board in
tplink,tl-wdr4900-v1) tplink,tl-wdr4900-v1)
ath9k_eeprom_extract "caldata" 20480 2048 ath9k_eeprom_extract "caldata" 0x5000 0x800
tpl_set_wireless_mac -1 tpl_set_wireless_mac -1
;; ;;
*) *)

View File

@ -7,8 +7,8 @@ rt2x00_eeprom_die() {
rt2x00_eeprom_extract() { rt2x00_eeprom_extract() {
local part=$1 local part=$1
local offset=$2 local offset=$(($2))
local count=$3 local count=$(($3))
local mtd local mtd
mtd=$(find_mtd_part $part) mtd=$(find_mtd_part $part)
@ -68,7 +68,7 @@ case "$FIRMWARE" in
;; ;;
dovado,tiny-ac) dovado,tiny-ac)
wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR) wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR)
rt2x00_eeprom_extract "factory" 0 512 rt2x00_eeprom_extract "factory" 0x0 0x200
rt2x00_eeprom_set_macaddr $wifi_mac rt2x00_eeprom_set_macaddr $wifi_mac
;; ;;
*) *)