1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
svn-openwrt-archive/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
John Crispin e8c6d01d74 ar71xx: Update preinit script for new ath10k firmware
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

SVN-Revision: 47985
2015-12-23 14:45:30 +00:00

52 lines
1.2 KiB
Bash

#!/bin/sh
. /lib/functions/system.sh
. /lib/ar71xx.sh
do_patch_ath10k_firmware() {
local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
# bail out if firmware does not exist
[ -f "$firmware_file" ] || {
return
}
local firmware_md5_orig="fcb2fbd42d73a63fbf603505c718cbde"
local firmware_md5_current="$(md5sum $firmware_file)"
local firmware_md5_current="${firmware_md5_current%% *}"
# verify md5sum before patching
[ "$firmware_md5_orig" != "$firmware_md5_current" ] || {
return
}
# some boards have bogus mac in otp, patch the default mac in the firmware
case $(ar71xx_board_name) in
dgl-5500-a1 | tew-823dru)
local mac
mac=$(mtd_get_mac_ascii nvram wlan1_mac)
cp $firmware_file /tmp/ath10k-firmware.bin
macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \
conv=notrunc bs=1 seek=276 count=6
;;
esac
[ -f /tmp/ath10k-firmware.bin ] || {
return
}
cp /tmp/ath10k-firmware.bin $firmware_file
rm /tmp/ath10k-firmware.bin
}
check_patch_ath10k_firmware() {
case $(ar71xx_board_name) in
dgl-5500-a1 | tew-823dru)
do_patch_ath10k_firmware
;;
esac
}
boot_hook_add preinit_main check_patch_ath10k_firmware