a28932f8242fc77167599d56b8bc30f0ad717ab4
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / base-files / lib / preinit / 81_load_ath10k_board_bin
1 #!/bin/sh
2
3 . /lib/functions/system.sh
4 . /lib/ar71xx.sh
5
6 do_load_ath10k_board_bin() {
7 # load board.bin
8 case $(ar71xx_board_name) in
9 nbg6716)
10 dd if=/dev/mtdblock2 \
11 bs=1 skip=20480 count=2116 \
12 of=/tmp/ath10k-board.bin
13 ;;
14 archer-c5 | \
15 archer-c7)
16 local mac
17 mac=$(macaddr_add $(cat /sys/class/net/eth1/address) -2)
18
19 dd if=/dev/mtdblock4 \
20 bs=1 skip=20480 count=6 \
21 of=/tmp/ath10k-board.bin
22 macaddr_2bin $mac >> /tmp/ath10k-board.bin
23 dd if=/dev/mtdblock4 \
24 bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
25
26 ;;
27 esac
28 [ -f /tmp/ath10k-board.bin ] || {
29 return
30 }
31 cmp -s /tmp/ath10k-board.bin /lib/firmware/ath10k/QCA988X/hw2.0/board.bin || {
32 cp /tmp/ath10k-board.bin /lib/firmware/ath10k/QCA988X/hw2.0/board.bin
33 rm /tmp/ath10k-board.bin
34 }
35 }
36
37 boot_hook_add preinit_main do_load_ath10k_board_bin