[OpenWrt-Devel] ar71xx: add an extra check on board_name for ath10k firmware patchs
diff mbox

Message ID 1418455151-18576-1-git-send-email-lynxis@fe80.eu
State Accepted
Headers show

Commit Message

Alexander Couzens Dec. 13, 2014, 7:19 a.m. UTC
It moves firmware patch code behind an extra check on board_name.
Otherwise it will calculate firmware checksum for unaffected boards.
It also reduce boottime by a md5 calculation and removes error message
on boot if firmware not found.
---
 .../ar71xx/base-files/lib/preinit/82_patch_ath10k    | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

John Crispin Dec. 13, 2014, 7:25 a.m. UTC | #1
Hi lynxis,

ah the stray ath10k fw warning ... thanks, one todo less on my list :)

	John

On 13/12/2014 08:19, Alexander Couzens wrote:
> It moves firmware patch code behind an extra check on board_name.
> Otherwise it will calculate firmware checksum for unaffected boards.
> It also reduce boottime by a md5 calculation and removes error message
> on boot if firmware not found.
> ---
>  .../ar71xx/base-files/lib/preinit/82_patch_ath10k    | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
> index c5c60ef..0455ecb 100644
> --- a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
> +++ b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
> @@ -3,13 +3,13 @@
>  . /lib/functions/system.sh
>  . /lib/ar71xx.sh
>  
> -firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-3.bin"
> -firmware_md5_orig="5163aa8de591f80b06c77f22e9777473"
> -firmware_md5_current="$(md5sum $firmware_file)"
> -firmware_md5_current="${firmware_md5_current%% *}"
> -
>  
>  do_patch_ath10k_firmware() {
> +	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%% *}"
> +
>  	# verify md5sum before patching
>  	[ "firmware_md5_orig" != "firmware_md5_current" ] || {
>  		return
> @@ -34,4 +34,12 @@ do_patch_ath10k_firmware() {
>  	rm /tmp/ath10k-firmware.bin
>  }
>  
> -boot_hook_add preinit_main do_patch_ath10k_firmware
> +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
>
Chris Green Dec. 13, 2014, 10:37 a.m. UTC | #2
On Sat, Dec 13, 2014 at 08:25:35AM +0100, John Crispin wrote:
> Hi lynxis,
> 
> ah the stray ath10k fw warning ... thanks, one todo less on my list :)
> 
Is this the:-

    md5sum: can't open '/lib/firmware/ath10k/QCA988X/hw2.0/firmware-3.bin': No such file or directory

Patch
diff mbox

diff --git a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
index c5c60ef..0455ecb 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
+++ b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
@@ -3,13 +3,13 @@ 
 . /lib/functions/system.sh
 . /lib/ar71xx.sh
 
-firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-3.bin"
-firmware_md5_orig="5163aa8de591f80b06c77f22e9777473"
-firmware_md5_current="$(md5sum $firmware_file)"
-firmware_md5_current="${firmware_md5_current%% *}"
-
 
 do_patch_ath10k_firmware() {
+	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%% *}"
+
 	# verify md5sum before patching
 	[ "firmware_md5_orig" != "firmware_md5_current" ] || {
 		return
@@ -34,4 +34,12 @@  do_patch_ath10k_firmware() {
 	rm /tmp/ath10k-firmware.bin
 }
 
-boot_hook_add preinit_main do_patch_ath10k_firmware
+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