2014-11-27 22:27:34 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. /lib/functions/system.sh
|
|
|
|
. /lib/ar71xx.sh
|
|
|
|
|
|
|
|
|
|
|
|
do_patch_ath10k_firmware() {
|
2015-07-06 18:19:21 +08:00
|
|
|
local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
|
2015-02-18 05:26:39 +08:00
|
|
|
|
|
|
|
# bail out if firmware does not exist
|
|
|
|
[ -f "$firmware_file" ] || {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2015-12-23 22:45:30 +08:00
|
|
|
local firmware_md5_orig="fcb2fbd42d73a63fbf603505c718cbde"
|
2014-12-13 16:06:01 +08:00
|
|
|
local firmware_md5_current="$(md5sum $firmware_file)"
|
|
|
|
local firmware_md5_current="${firmware_md5_current%% *}"
|
|
|
|
|
2014-11-27 22:27:34 +08:00
|
|
|
# verify md5sum before patching
|
2015-02-18 05:26:39 +08:00
|
|
|
[ "$firmware_md5_orig" != "$firmware_md5_current" ] || {
|
2014-11-27 22:27:34 +08:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
# some boards have bogus mac in otp, patch the default mac in the firmware
|
|
|
|
case $(ar71xx_board_name) in
|
2015-12-17 17:30:05 +08:00
|
|
|
dgl-5500-a1 | tew-823dru)
|
2014-11-27 22:27:34 +08:00
|
|
|
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 \
|
2015-06-15 01:41:27 +08:00
|
|
|
conv=notrunc bs=1 seek=276 count=6
|
2014-11-27 22:27:34 +08:00
|
|
|
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
[ -f /tmp/ath10k-firmware.bin ] || {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
cp /tmp/ath10k-firmware.bin $firmware_file
|
|
|
|
rm /tmp/ath10k-firmware.bin
|
|
|
|
}
|
|
|
|
|
2014-12-13 16:06:01 +08:00
|
|
|
check_patch_ath10k_firmware() {
|
|
|
|
case $(ar71xx_board_name) in
|
2015-12-17 17:30:05 +08:00
|
|
|
dgl-5500-a1 | tew-823dru)
|
2014-12-13 16:06:01 +08:00
|
|
|
do_patch_ath10k_firmware
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
boot_hook_add preinit_main check_patch_ath10k_firmware
|