3 . /lib/functions/system.sh
7 do_patch_ath10k_firmware() {
8 local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
10 # bail out if firmware does not exist
11 [ -f "$firmware_file" ] || {
15 local firmware_md5_orig="36768dc68572b3f2660211e20e89f558"
16 local firmware_md5_current="$(md5sum $firmware_file)"
17 local firmware_md5_current="${firmware_md5_current%% *}"
19 # verify md5sum before patching
20 [ "$firmware_md5_orig" != "$firmware_md5_current" ] || {
24 # some boards have bogus mac in otp, patch the default mac in the firmware
25 case $(ar71xx_board_name) in
28 mac=$(mtd_get_mac_ascii nvram wlan1_mac)
30 cp $firmware_file /tmp/ath10k-firmware.bin
31 macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \
32 conv=notrunc bs=1 seek=276 count=6
36 [ -f /tmp/ath10k-firmware.bin ] || {
39 cp /tmp/ath10k-firmware.bin $firmware_file
40 rm /tmp/ath10k-firmware.bin
43 check_patch_ath10k_firmware() {
44 case $(ar71xx_board_name) in
46 do_patch_ath10k_firmware
51 boot_hook_add preinit_main check_patch_ath10k_firmware