3 .
/lib
/functions
/system.sh
7 do_patch_ath10k_firmware
() {
8 local firmware_file
="/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin"
10 # bail out if firmware does not exist
11 [ -f "$firmware_file" ] ||
{
17 local default_mac
="00:03:07:12:34:56"
18 local current_mac
="$(hexdump -v -n $mac_length -s $mac_offset -e '5/1 "%02x
:" 1/1 "%02x
"' $firmware_file 2>/dev/null)"
20 # check if mac address was already patched
21 [ "$default_mac" = "$current_mac" ] ||
{
25 # some boards have bogus mac in otp (= directly in the PCIe card's EEPROM).
26 # we have to patch the default mac in the firmware because we cannot change
28 case $
(ar71xx_board_name
) in
29 dgl-5500-a1 | tew-823dru
)
31 mac
=$
(mtd_get_mac_ascii nvram wlan1_mac
)
33 cp $firmware_file /tmp
/ath10k-firmware.bin
34 macaddr_2bin
$mac |
dd of
=/tmp
/ath10k-firmware.bin \
35 conv
=notrunc bs
=1 seek
=$mac_offset count
=$mac_length
39 [ -f /tmp
/ath10k-firmware.bin
] ||
{
42 cp /tmp
/ath10k-firmware.bin
$firmware_file
43 rm /tmp
/ath10k-firmware.bin
46 check_patch_ath10k_firmware
() {
47 case $
(ar71xx_board_name
) in
48 dgl-5500-a1 | tew-823dru
)
49 do_patch_ath10k_firmware
54 boot_hook_add preinit_main check_patch_ath10k_firmware