OpenWrt – Diff between revs 2 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 2 Rev 3
Line 29... Line 29...
29   29  
30 mtd=$(find_mtd_chardev $part) 30 mtd=$(find_mtd_chardev $part)
31 [ -n "$mtd" ] || \ 31 [ -n "$mtd" ] || \
Line 32... Line 32...
32 ath10kcal_die "no mtd device found for partition $part" 32 ath10kcal_die "no mtd device found for partition $part"
33   33  
34 dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ 34 dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
Line 35... Line 35...
35 ath10kcal_die "failed to extract calibration data from $mtd" 35 ath10kcal_die "failed to extract calibration data from $mtd"
36 } 36 }
Line 47... Line 47...
47 ubidev=$(nand_find_ubi $CI_UBIPART) 47 ubidev=$(nand_find_ubi $CI_UBIPART)
48 ubi=$(nand_find_volume $ubidev $part) 48 ubi=$(nand_find_volume $ubidev $part)
49 [ -n "$ubi" ] || \ 49 [ -n "$ubi" ] || \
50 ath10kcal_die "no UBI volume found for $part" 50 ath10kcal_die "no UBI volume found for $part"
Line 51... Line 51...
51   51  
52 dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ 52 dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
53 ath10kcal_die "failed to extract from $ubi" 53 ath10kcal_die "failed to extract from $ubi"
Line -... Line 54...
-   54 }
-   55  
-   56 ath10kcal_patch_mac() {
-   57 local mac=$1
-   58  
-   59 [ -z "$mac" ] && return
-   60  
-   61 macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
54 } 62 }
55   63  
56 ath10kcal_patch_mac_crc() { 64 ath10kcal_patch_mac_crc() {
57 local mac=$1 65 local mac=$1
58 local mac_offset=6 66 local mac_offset=6
59 local chksum_offset=2 67 local chksum_offset=2
60 local xor_mac 68 local xor_mac
Line 61... Line -...
61 local xor_fw_mac -  
62 local xor_fw_chksum -  
63   69 local xor_fw_mac
64 [ -z "$mac" ] && return 70 local xor_fw_chksum
Line 65... Line 71...
65   71  
66 xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE) -  
67 xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}" 72 xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
68   73 xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
69 macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6 74  
70   75 ath10kcal_patch_mac "$mac" && {
71 xor_mac=${mac//:/} 76 xor_mac=${mac//:/}
72 xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}" 77 xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
73   78  
74 xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE) 79 xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
-   80 xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
75 xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac) 81  
Line 76... Line 82...
76   82 printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
77 printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \ 83 dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
Line 98... Line 104...
98 "ath10k/cal-pci-0000:01:00.0.bin") 104 "ath10k/cal-pci-0000:01:00.0.bin")
99 case "$board" in 105 case "$board" in
100 meraki,mr33) 106 meraki,mr33)
101 ath10kcal_ubi_extract "ART" 36864 2116 107 ath10kcal_ubi_extract "ART" 36864 2116
102 ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 36864 2116 108 ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 36864 2116
103 ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +1) 109 ath10kcal_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +1)
104 ;; 110 ;;
105 esac 111 esac
106 ;; 112 ;;
107 "ath10k/pre-cal-pci-0000:01:00.0.bin") 113 "ath10k/pre-cal-pci-0000:01:00.0.bin")
108 case "$board" in 114 case "$board" in
109 asus,map-ac2200) -  
110 ath10kcal_ubi_extract "Factory" 36864 12064 -  
111 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ -  
112 /lib/firmware/ath10k/QCA9888/hw2.0/board.bin -  
113 ;; -  
114 openmesh,a62) 115 openmesh,a62)
115 ath10kcal_extract "0:ART" 36864 12064 116 ath10kcal_extract "0:ART" 36864 12064
116 ;; 117 ;;
117 esac 118 esac
118 ;; 119 ;;
119 "ath10k/pre-cal-ahb-a000000.wifi.bin") 120 "ath10k/pre-cal-ahb-a000000.wifi.bin")
120 case "$board" in 121 case "$board" in
121 8dev,jalapeno |\ 122 8dev,jalapeno |\
122 alfa-network,ap120c-ac |\ -  
123 glinet,gl-b1300 |\ 123 glinet,gl-b1300 |\
124 linksys,ea6350v3 |\ -  
125 qcom,ap-dk01.1-c1) 124 qcom,ap-dk01.1-c1)
126 ath10kcal_extract "ART" 4096 12064 125 ath10kcal_extract "ART" 4096 12064
127 ;; 126 ;;
128 asus,map-ac2200) -  
129 ath10kcal_ubi_extract "Factory" 4096 12064 -  
130 ;; -  
131 asus,rt-ac58u) 127 asus,rt-ac58u)
132 CI_UBIPART=UBI_DEV 128 CI_UBIPART=UBI_DEV
133 ath10kcal_ubi_extract "Factory" 4096 12064 129 ath10kcal_ubi_extract "Factory" 4096 12064
134 ;; 130 ;;
135 avm,fritzbox-4040) 131 avm,fritzbox-4040)
136 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") 132 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
137 ;; 133 ;;
138 avm,fritzbox-7530) -  
139 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ -  
140 /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") -  
141 ;; -  
142 compex,wpj428 |\ -  
143 engenius,eap1300 |\ -  
144 openmesh,a42 |\ -  
145 openmesh,a62 |\ -  
146 qxwlan,e2600ac-c1 |\ -  
147 qxwlan,e2600ac-c2) -  
148 ath10kcal_extract "0:ART" 4096 12064 -  
149 ;; -  
150 meraki,mr33) 134 meraki,mr33)
151 ath10kcal_ubi_extract "ART" 4096 12064 135 ath10kcal_ubi_extract "ART" 4096 12064
152 ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 4096 12064 136 ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 4096 12064
153 ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +2) 137 ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +2)
154 ;; 138 ;;
155 netgear,ex6100v2 |\ 139 netgear,ex6100v2 |\
156 netgear,ex6150v2) 140 netgear,ex6150v2)
157 ath10kcal_extract "ART" 4096 12064 141 ath10kcal_extract "ART" 4096 12064
158 ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0) 142 ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0)
159 ;; 143 ;;
160 zyxel,nbg6617 |\ 144 compex,wpj428 |\
-   145 openmesh,a42 |\
-   146 openmesh,a62)
-   147 ath10kcal_extract "0:ART" 4096 12064
-   148 ;;
161 zyxel,wre6606) 149 zyxel,wre6606)
162 ath10kcal_extract "ART" 4096 12064 150 ath10kcal_extract "ART" 4096 12064
163 ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2) 151 ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
164 ;; 152 ;;
165 esac 153 esac
166 ;; 154 ;;
167 "ath10k/pre-cal-ahb-a800000.wifi.bin") 155 "ath10k/pre-cal-ahb-a800000.wifi.bin")
168 case "$board" in 156 case "$board" in
169 8dev,jalapeno |\ 157 8dev,jalapeno |\
170 alfa-network,ap120c-ac |\ -  
171 glinet,gl-b1300 |\ 158 glinet,gl-b1300 |\
172 linksys,ea6350v3 |\ -  
173 qcom,ap-dk01.1-c1) 159 qcom,ap-dk01.1-c1)
174 ath10kcal_extract "ART" 20480 12064 160 ath10kcal_extract "ART" 20480 12064
175 ;; 161 ;;
176 asus,map-ac2200) -  
177 ath10kcal_ubi_extract "Factory" 20480 12064 -  
178 ;; -  
179 asus,rt-ac58u) 162 asus,rt-ac58u)
180 CI_UBIPART=UBI_DEV 163 CI_UBIPART=UBI_DEV
181 ath10kcal_ubi_extract "Factory" 20480 12064 164 ath10kcal_ubi_extract "Factory" 20480 12064
182 ;; 165 ;;
183 avm,fritzbox-4040) 166 avm,fritzbox-4040)
184 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") 167 /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
185 ;; 168 ;;
186 avm,fritzbox-7530) -  
187 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ -  
188 /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") -  
189 ;; -  
190 compex,wpj428 |\ -  
191 engenius,eap1300 |\ -  
192 openmesh,a42 |\ -  
193 openmesh,a62 |\ -  
194 qxwlan,e2600ac-c1 |\ -  
195 qxwlan,e2600ac-c2) -  
196 ath10kcal_extract "0:ART" 20480 12064 -  
197 ;; -  
198 meraki,mr33) 169 meraki,mr33)
199 ath10kcal_ubi_extract "ART" 20480 12064 170 ath10kcal_ubi_extract "ART" 20480 12064
200 ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 20480 12064 171 ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 20480 12064
201 ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +3) 172 ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +3)
202 ;; 173 ;;
203 netgear,ex6100v2 |\ 174 netgear,ex6100v2 |\
204 netgear,ex6150v2) 175 netgear,ex6150v2)
205 ath10kcal_extract "ART" 20480 12064 176 ath10kcal_extract "ART" 20480 12064
206 ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 12) 177 ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 12)
207 ;; 178 ;;
208 zyxel,nbg6617 |\ 179 compex,wpj428 |\
-   180 openmesh,a42 |\
-   181 openmesh,a62)
-   182 ath10kcal_extract "0:ART" 20480 12064
-   183 ;;
209 zyxel,wre6606) 184 zyxel,wre6606)
210 ath10kcal_extract "ART" 20480 12064 185 ath10kcal_extract "ART" 20480 12064
211 ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1) 186 ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
212 ;; 187 ;;
213 esac 188 esac