From fd053f4144f558d779d7895b7d01f18f3a3569f7 Mon Sep 17 00:00:00 2001 From: Dustin Gathmann Date: Wed, 27 Nov 2024 23:10:21 +0100 Subject: [PATCH] lantiq: fritz_cal_extract with reverse option for AVM FritzBox 7430 This implementation of fritz_cal_extract can also retrieve firmware data stored in reverse byte order, as found in the AVM 7430 device. This is done by intermediate storage in a buffer presumably large enough to hold the complete data set. Currently, this buffer size is 128kB + 1kB (some extra space for skipped data). In the usual case of "forward" data, this implementation should behave like the original implementation in all common cases. limit [-l] will determine the amount of data read and size of buffer allocated. However, if you are reading reversed data or didn't set a limit, the buffer may be too small to hold all data. In this case, you can choose a higher limit [-l] to enforce a sufficient buffer size. Signed-off-by: Dustin Gathmann --- .../base-files/etc/hotplug.d/firmware/12-ath9k-eeprom | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index eefc39b30b463e..2e5bf10bf92d40 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -22,11 +22,14 @@ case "$FIRMWARE" in avm,fritz7360sl) caldata_extract "urlader" 0x985 0x1000 ;; - avm,fritz7412|\ - avm,fritz7430) + avm,fritz7412) /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") ;; + avm,fritz7430) + /usr/bin/fritz_cal_extract -r -i 4 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \ + /usr/bin/fritz_cal_extract -r -i 4 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") + ;; bt,homehub-v5a) caldata_extract_ubi "caldata" 0x1000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c