2014-11-27 14:27:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. /lib/functions/system.sh
|
|
|
|
. /lib/ar71xx.sh
|
|
|
|
|
|
|
|
|
|
|
|
do_patch_ath10k_firmware() {
|
2014-12-13 08:06:01 +00:00
|
|
|
local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-3.bin"
|
|
|
|
local firmware_md5_orig="5163aa8de591f80b06c77f22e9777473"
|
|
|
|
local firmware_md5_current="$(md5sum $firmware_file)"
|
|
|
|
local firmware_md5_current="${firmware_md5_current%% *}"
|
|
|
|
|
2014-11-27 14:27:34 +00:00
|
|
|
# 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)
|
|
|
|
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=280 count=6
|
|
|
|
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
[ -f /tmp/ath10k-firmware.bin ] || {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
cp /tmp/ath10k-firmware.bin $firmware_file
|
|
|
|
rm /tmp/ath10k-firmware.bin
|
|
|
|
}
|
|
|
|
|
2014-12-13 08:06:01 +00:00
|
|
|
check_patch_ath10k_firmware() {
|
|
|
|
case $(ar71xx_board_name) in
|
|
|
|
dgl-5500-a1)
|
|
|
|
do_patch_ath10k_firmware
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
boot_hook_add preinit_main check_patch_ath10k_firmware
|