lantiq: fix ath9k-eeprom for AVM Fritz!Box 7340

@grische noticed that the extracted wifi calibration data (ath9k-eeprom)
is incorrect.
Symptoms included:
- wrong mac address
- radio was detected like dbdc (2.4GHz and 5GHz support at the same time)

This patch fixes this by also reversing the order of bytes and throwing
away the last 4 Bytes.
Unlike caldata.sh the fritz_cal_extract.c doesn't support reversing.
So this patch combines both methods.

Signed-off-by: Felix Baumann <felix.bau@gmx.de>
This commit is contained in:
Felix Baumann 2023-02-28 04:21:07 +01:00
parent d2fc620d0a
commit 2c1c49ad18

View File

@ -23,11 +23,29 @@ case "$FIRMWARE" in
avm,fritz7360-v2) avm,fritz7360-v2)
caldata_extract "urlader" 0x985 0x1000 caldata_extract "urlader" 0x985 0x1000
;; ;;
avm,fritz7412|\ avm,fritz7412)
avm,fritz7430)
/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \ /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") /usr/bin/fritz_cal_extract -i 1 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
;; ;;
avm,fritz7430)
reversed=$( \
/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 5120 $(find_mtd_chardev "urlader") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x1e800 -e 0x207 -l 5120 $(find_mtd_chardev "urlader") | \
hexdump -v -e '/1 "%02x "')
caldata=""
i=0
count=$((${#reversed} / 3 - 4))
for byte in $reversed; do
i=$(($i+1))
if [ "$i" -gt "$count" ]; then
break
fi
caldata="\x${byte}${caldata}"
done
printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
;;
bt,homehub-v5a) bt,homehub-v5a)
caldata_extract_ubi "caldata" 0x1000 0x1000 caldata_extract_ubi "caldata" 0x1000 0x1000
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c