mac80211: ath9k: fix qca956x name also
[openwrt/openwrt.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 mc-mac1200r)
27 local mac
28 mac=$(macaddr_add $(cat /sys/class/net/eth1/address) -1)
29
30 dd if=/dev/mtdblock4 \
31 bs=1 skip=20480 count=6 \
32 of=/tmp/ath10k-board.bin
33 macaddr_2bin $mac >> /tmp/ath10k-board.bin
34 dd if=/dev/mtdblock4 \
35 bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
36 ;;
37 r6100)
38 local mac
39 mac=$(macaddr_add $(cat /sys/class/net/eth1/address) +2)
40
41 dd if=/dev/mtdblock2 \
42 bs=1 skip=20480 count=6 \
43 of=/tmp/ath10k-board.bin
44 macaddr_2bin $mac >> /tmp/ath10k-board.bin
45 dd if=/dev/mtdblock2 \
46 bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
47 ;;
48 qihoo-c301)
49 local mac
50
51 mac=$(mtd_get_mac_ascii devdata wlan5mac)
52
53 if [ -z "$mac" ]; then
54 mac=$(macaddr_add $(cat /sys/class/net/eth0/address) -2)
55 fi
56
57 dd if=/dev/mtdblock10 \
58 bs=1 skip=20480 count=6 \
59 of=/tmp/ath10k-board.bin
60 macaddr_2bin $mac >> /tmp/ath10k-board.bin
61 dd if=/dev/mtdblock10 \
62 bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
63
64 ;;
65 esac
66 [ -f /tmp/ath10k-board.bin ] || {
67 return
68 }
69 cmp -s /tmp/ath10k-board.bin /lib/firmware/ath10k/QCA988X/hw2.0/board.bin || {
70 cp /tmp/ath10k-board.bin /lib/firmware/ath10k/QCA988X/hw2.0/board.bin
71 rm /tmp/ath10k-board.bin
72 }
73 }
74
75 boot_hook_add preinit_main do_load_ath10k_board_bin