OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | #!/bin/sh |
2 | |||
3 | . /lib/functions.sh |
||
4 | . /lib/functions/system.sh |
||
5 | |||
6 | do_patch_ath10k_firmware() { |
||
7 | local firmware_file="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin" |
||
8 | |||
9 | # bail out if firmware does not exist |
||
10 | [ -f "$firmware_file" ] || return |
||
11 | |||
12 | local mac_offset=276 |
||
13 | local mac_length=6 |
||
14 | local default_mac="00:03:07:12:34:56" |
||
15 | local current_mac="$(hexdump -v -n $mac_length -s $mac_offset -e '5/1 "%02x:" 1/1 "%02x"' $firmware_file 2>/dev/null)" |
||
16 | |||
17 | # check if mac address was already patched |
||
18 | [ "$default_mac" = "$current_mac" ] || return |
||
19 | |||
20 | # some boards have bogus mac in otp (= directly in the PCIe card's EEPROM). |
||
21 | # we have to patch the default mac in the firmware because we cannot change |
||
22 | # the otp. |
||
23 | case $(board_name) in |
||
24 | dgl-5500-a1|\ |
||
25 | tew-823dru) |
||
26 | local mac |
||
27 | mac=$(mtd_get_mac_ascii nvram wlan1_mac) |
||
28 | |||
29 | cp $firmware_file /tmp/ath10k-firmware.bin |
||
30 | macaddr_2bin $mac | dd of=/tmp/ath10k-firmware.bin \ |
||
31 | conv=notrunc bs=1 seek=$mac_offset count=$mac_length |
||
32 | ;; |
||
33 | esac |
||
34 | |||
35 | [ -f /tmp/ath10k-firmware.bin ] || return |
||
36 | |||
37 | cp /tmp/ath10k-firmware.bin $firmware_file |
||
38 | rm /tmp/ath10k-firmware.bin |
||
39 | } |
||
40 | |||
41 | check_patch_ath10k_firmware() { |
||
42 | case $(board_name) in |
||
43 | dgl-5500-a1|\ |
||
44 | gl-x1200|\ |
||
45 | tew-823dru) |
||
46 | do_patch_ath10k_firmware |
||
47 | ;; |
||
48 | esac |
||
49 | } |
||
50 | |||
51 | boot_hook_add preinit_main check_patch_ath10k_firmware |