2018-02-21 19:40:50 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-03-10 09:59:18 +00:00
|
|
|
# xor multiple hex values of the same length
|
|
|
|
xor() {
|
|
|
|
local val
|
|
|
|
local ret="0x$1"
|
|
|
|
local retlen=${#1}
|
|
|
|
|
|
|
|
shift
|
|
|
|
while [ -n "$1" ]; do
|
|
|
|
val="0x$1"
|
|
|
|
ret=$((ret ^ val))
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
printf "%0${retlen}x" "$ret"
|
|
|
|
}
|
|
|
|
|
2018-02-21 19:40:50 +00:00
|
|
|
ath10kcal_die() {
|
|
|
|
echo "ath10cal: " "$*"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
ath10kcal_extract() {
|
|
|
|
local part=$1
|
|
|
|
local offset=$2
|
|
|
|
local count=$3
|
|
|
|
local mtd
|
|
|
|
|
|
|
|
mtd=$(find_mtd_chardev $part)
|
|
|
|
[ -n "$mtd" ] || \
|
|
|
|
ath10kcal_die "no mtd device found for partition $part"
|
|
|
|
|
|
|
|
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
|
|
|
ath10kcal_die "failed to extract calibration data from $mtd"
|
|
|
|
}
|
|
|
|
|
ipq40xx: add support for ASUS RT-AC58U/RT-ACRH13
This patch adds support for ASUS RT-AC58U/RT-ACRH13.
hardware highlights:
SOC: IPQ4018 / QCA Dakota
CPU: Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM: 128 MiB DDR3L-1066 @ 537 MHz (1074?) NT5CC64M16GP-DI
NOR: 2 MiB Macronix MX25L1606E (for boot, QSEE)
NAND: 128 MiB Winbond W25NO1GVZE1G (cal + kernel + root, UBI)
ETH: Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN)
USB: 1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC)
WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT: one Reset and one WPS button
LEDS: Status, WAN, WIFI1/2, USB and LAN (one blue LED for each)
Serial:
WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
The Serial setting is 115200-8-N-1. The board has an unpopulated
1x4 0.1" header. The pinout (VDD, RX, GND, TX) is printed on the
PCB right next to the connector.
U-Boot Note: The ethernet driver isn't always reliable and can sometime
time out... Don't worry, just retry.
Access via the serial console is required. As well as a working
TFTP-server setup and the initramfs image. (If not provided, it
has to be built from the OpenWrt source. Make sure to enable
LZMA as the compression for the INITRAMFS!)
To install the image permanently, you have to do the following
steps in the listed order.
1. Open up the router.
There are four phillips screws hiding behind the four plastic
feets on the underside.
2. Connect the serial cable (See notes above)
3. Connect your router via one of the four LAN-ports (yellow)
to a PC which can set the IP-Address and ssh and scp from.
If possible set your PC's IPv4 Address to 192.168.1.70
(As this is the IP-Address the Router's bootloader expects
for the tftp server)
4. power up the router and enter the u-boot
choose option 1 to upload the initramfs image. And follow
through the ipv4 setup.
Wait for your router's status LED to stop blinking rapidly and
glow just blue. (The LAN LED should also be glowing blue).
3. Connect to the OpenWrt running in RAM
The default IPv4-Address of your router will be 192.168.1.1.
1. Copy over the openwrt-sysupgrade.bin image to your router's
temporary directory
# scp openwrt-sysupgrade.bin root@192.168.1.1:/tmp
2. ssh from your PC into your router as root.
# ssh root@192.168.1.1
The default OpenWrt-Image won't ask for a password. Simply hit the Enter-Key.
Once connected...: run the following commands on your temporary installation
3. delete the "jffs2" ubi partition to make room for your new root partition
# ubirmvol /dev/ubi0 --name=jffs2
4. install OpenWrt on the NAND Flash.
# sysupgrade -v /tmp/openwrt-sysupgrade.bin
- This will will automatically reboot the router -
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2018-03-07 08:13:10 +00:00
|
|
|
ath10kcal_ubi_extract() {
|
|
|
|
local part=$1
|
|
|
|
local offset=$2
|
|
|
|
local count=$3
|
|
|
|
local ubidev
|
|
|
|
local ubi
|
|
|
|
|
|
|
|
. /lib/upgrade/nand.sh
|
|
|
|
|
|
|
|
ubidev=$(nand_find_ubi $CI_UBIPART)
|
|
|
|
ubi=$(nand_find_volume $ubidev $part)
|
|
|
|
[ -n "$ubi" ] || \
|
|
|
|
ath10kcal_die "no UBI volume found for $part"
|
|
|
|
|
|
|
|
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
|
|
|
ath10kcal_die "failed to extract from $ubi"
|
|
|
|
}
|
|
|
|
|
2018-03-10 09:59:18 +00:00
|
|
|
ath10kcal_patch_mac() {
|
|
|
|
local mac=$1
|
|
|
|
|
|
|
|
[ -z "$mac" ] && return
|
|
|
|
|
|
|
|
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6
|
|
|
|
}
|
|
|
|
|
|
|
|
ath10kcal_patch_mac_crc() {
|
|
|
|
local mac=$1
|
|
|
|
local mac_offset=6
|
|
|
|
local chksum_offset=2
|
|
|
|
local xor_mac
|
|
|
|
local xor_fw_mac
|
|
|
|
local xor_fw_chksum
|
|
|
|
|
|
|
|
xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
|
|
xor_fw_mac="${xor_fw_mac:0:4} ${xor_fw_mac:4:4} ${xor_fw_mac:8:4}"
|
|
|
|
|
|
|
|
ath10kcal_patch_mac "$mac" && {
|
|
|
|
xor_mac=${mac//:/}
|
|
|
|
xor_mac="${xor_mac:0:4} ${xor_mac:4:4} ${xor_mac:8:4}"
|
|
|
|
|
|
|
|
xor_fw_chksum=$(hexdump -v -n 2 -s $chksum_offset -e '/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
|
|
xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac)
|
|
|
|
|
|
|
|
printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \
|
|
|
|
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ath10kcal_is_caldata_valid() {
|
|
|
|
local expected="$1"
|
|
|
|
|
|
|
|
magic=$(hexdump -v -n 2 -e '1/1 "%02x"' /lib/firmware/$FIRMWARE)
|
|
|
|
[[ "$magic" == "$expected" ]]
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2018-02-21 19:40:50 +00:00
|
|
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
|
|
|
|
|
|
|
. /lib/functions.sh
|
|
|
|
. /lib/functions/system.sh
|
|
|
|
|
|
|
|
board=$(board_name)
|
|
|
|
|
|
|
|
|
|
|
|
case "$FIRMWARE" in
|
2018-03-10 09:59:18 +00:00
|
|
|
"ath10k/cal-pci-0000:01:00.0.bin")
|
|
|
|
case "$board" in
|
|
|
|
meraki,mr33)
|
|
|
|
ath10kcal_ubi_extract "ART" 36864 2116
|
|
|
|
ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 36864 2116
|
|
|
|
ath10kcal_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +1)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-02-21 19:40:50 +00:00
|
|
|
"ath10k/pre-cal-ahb-a000000.wifi.bin")
|
|
|
|
case "$board" in
|
2018-04-11 09:14:36 +00:00
|
|
|
8dev,jalapeno |\
|
|
|
|
glinet,gl-b1300 |\
|
|
|
|
qcom,ap-dk01.1-c1)
|
|
|
|
ath10kcal_extract "ART" 4096 12064
|
|
|
|
;;
|
ipq40xx: add support for ASUS RT-AC58U/RT-ACRH13
This patch adds support for ASUS RT-AC58U/RT-ACRH13.
hardware highlights:
SOC: IPQ4018 / QCA Dakota
CPU: Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM: 128 MiB DDR3L-1066 @ 537 MHz (1074?) NT5CC64M16GP-DI
NOR: 2 MiB Macronix MX25L1606E (for boot, QSEE)
NAND: 128 MiB Winbond W25NO1GVZE1G (cal + kernel + root, UBI)
ETH: Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN)
USB: 1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC)
WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT: one Reset and one WPS button
LEDS: Status, WAN, WIFI1/2, USB and LAN (one blue LED for each)
Serial:
WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
The Serial setting is 115200-8-N-1. The board has an unpopulated
1x4 0.1" header. The pinout (VDD, RX, GND, TX) is printed on the
PCB right next to the connector.
U-Boot Note: The ethernet driver isn't always reliable and can sometime
time out... Don't worry, just retry.
Access via the serial console is required. As well as a working
TFTP-server setup and the initramfs image. (If not provided, it
has to be built from the OpenWrt source. Make sure to enable
LZMA as the compression for the INITRAMFS!)
To install the image permanently, you have to do the following
steps in the listed order.
1. Open up the router.
There are four phillips screws hiding behind the four plastic
feets on the underside.
2. Connect the serial cable (See notes above)
3. Connect your router via one of the four LAN-ports (yellow)
to a PC which can set the IP-Address and ssh and scp from.
If possible set your PC's IPv4 Address to 192.168.1.70
(As this is the IP-Address the Router's bootloader expects
for the tftp server)
4. power up the router and enter the u-boot
choose option 1 to upload the initramfs image. And follow
through the ipv4 setup.
Wait for your router's status LED to stop blinking rapidly and
glow just blue. (The LAN LED should also be glowing blue).
3. Connect to the OpenWrt running in RAM
The default IPv4-Address of your router will be 192.168.1.1.
1. Copy over the openwrt-sysupgrade.bin image to your router's
temporary directory
# scp openwrt-sysupgrade.bin root@192.168.1.1:/tmp
2. ssh from your PC into your router as root.
# ssh root@192.168.1.1
The default OpenWrt-Image won't ask for a password. Simply hit the Enter-Key.
Once connected...: run the following commands on your temporary installation
3. delete the "jffs2" ubi partition to make room for your new root partition
# ubirmvol /dev/ubi0 --name=jffs2
4. install OpenWrt on the NAND Flash.
# sysupgrade -v /tmp/openwrt-sysupgrade.bin
- This will will automatically reboot the router -
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2018-03-07 08:13:10 +00:00
|
|
|
asus,rt-ac58u)
|
|
|
|
CI_UBIPART=UBI_DEV
|
|
|
|
ath10kcal_ubi_extract "Factory" 4096 12064
|
|
|
|
;;
|
2018-02-21 19:40:50 +00:00
|
|
|
avm,fritzbox-4040)
|
|
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
|
|
|
;;
|
2018-03-10 09:59:18 +00:00
|
|
|
meraki,mr33)
|
|
|
|
ath10kcal_ubi_extract "ART" 4096 12064
|
|
|
|
ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 4096 12064
|
|
|
|
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +2)
|
|
|
|
;;
|
ipq40xx: add support for Netgear EX6100v2/EX6150v2
Specifications:
SOC: Qualcomm IPQ4018 (DAKOTA) ARM Quad-Core
RAM: 256 MB Winbond W632GU6KB12J
FLASH: 16 MiB Macronix MX25L12805D
ETH: Qualcomm QCA8072
WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11b/g/n/ac 2x2
WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11n/ac
1x1 (EX6100)
2x2 (EX6150)
INPUT: Power, WPS, reset button
AP / Range-extender toggle
LED: Power, Router, Extender (dual), WPS, Left-/Right-arrow
SERIAL: Header next to QCA8072 chip.
VCC, TX, RX, GND (Square hole is VCC)
WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!
The Serial setting is 115200-8-N-1.
Tested and working:
- Ethernet
- 2.4 GHz WiFi (Correct MAC-address)
- 5 GHz WiFi (Correct MAC-address)
- Factory installation from WebIF
- Factory installation from tftp
- OpenWRT sysupgrade (Preserving and non-preserving)
- LEDs
- Buttons
Not Working:
- AP/Extender toggle-switch
Untested:
- Support on EX6100v2. They share the same GPL-Code and vendor-images.
The 6100v2 seems to lack one 5GHz stream and differs in the 5GHz
board-blob. I only own a EX6150v2, therefore i am only able to verify
functionality on this device.
Install via Web-Interface:
Upload the factory image to the device to the Netgear Web-Interface.
The device might asks you to confirm the update a second time due to
detecting the OpenWRT firmware as older. The device will automatically
reboot after the image is written to flash.
Install via TFTP:
Connect to the devices serial. Hit Enter-Key in bootloader to stop
autobooting. Command "fw_recovery" will start a tftp server, waiting for
a DNI image to be pushed.
Assign your computer the IP-address 192.168.1.10/24. Push image with
tftp -4 -v -m binary 192.168.1.1 -c put <OPENWRT_FACTORY>
Device will erase factory-partition first, then writes the pushed image
to flash and reboots.
Parts of this commit are based on Thomas Hebb's work on the
openwrt-devel mailinglist.
See https://lists.openwrt.org/pipermail/openwrt-devel/2018-January/043418.html
Signed-off-by: David Bauer <mail@david-bauer.net>
2018-03-28 22:32:38 +00:00
|
|
|
netgear,ex6100v2 |\
|
|
|
|
netgear,ex6150v2)
|
|
|
|
ath10kcal_extract "ART" 4096 12064
|
|
|
|
ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0)
|
|
|
|
;;
|
2018-03-02 10:56:53 +00:00
|
|
|
compex,wpj428 |\
|
2018-02-21 19:40:50 +00:00
|
|
|
openmesh,a42)
|
|
|
|
ath10kcal_extract "0:ART" 4096 12064
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
"ath10k/pre-cal-ahb-a800000.wifi.bin")
|
|
|
|
case "$board" in
|
2018-04-11 09:14:36 +00:00
|
|
|
8dev,jalapeno |\
|
|
|
|
glinet,gl-b1300 |\
|
|
|
|
qcom,ap-dk01.1-c1)
|
|
|
|
ath10kcal_extract "ART" 20480 12064
|
|
|
|
;;
|
ipq40xx: add support for ASUS RT-AC58U/RT-ACRH13
This patch adds support for ASUS RT-AC58U/RT-ACRH13.
hardware highlights:
SOC: IPQ4018 / QCA Dakota
CPU: Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM: 128 MiB DDR3L-1066 @ 537 MHz (1074?) NT5CC64M16GP-DI
NOR: 2 MiB Macronix MX25L1606E (for boot, QSEE)
NAND: 128 MiB Winbond W25NO1GVZE1G (cal + kernel + root, UBI)
ETH: Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN)
USB: 1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC)
WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT: one Reset and one WPS button
LEDS: Status, WAN, WIFI1/2, USB and LAN (one blue LED for each)
Serial:
WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
The Serial setting is 115200-8-N-1. The board has an unpopulated
1x4 0.1" header. The pinout (VDD, RX, GND, TX) is printed on the
PCB right next to the connector.
U-Boot Note: The ethernet driver isn't always reliable and can sometime
time out... Don't worry, just retry.
Access via the serial console is required. As well as a working
TFTP-server setup and the initramfs image. (If not provided, it
has to be built from the OpenWrt source. Make sure to enable
LZMA as the compression for the INITRAMFS!)
To install the image permanently, you have to do the following
steps in the listed order.
1. Open up the router.
There are four phillips screws hiding behind the four plastic
feets on the underside.
2. Connect the serial cable (See notes above)
3. Connect your router via one of the four LAN-ports (yellow)
to a PC which can set the IP-Address and ssh and scp from.
If possible set your PC's IPv4 Address to 192.168.1.70
(As this is the IP-Address the Router's bootloader expects
for the tftp server)
4. power up the router and enter the u-boot
choose option 1 to upload the initramfs image. And follow
through the ipv4 setup.
Wait for your router's status LED to stop blinking rapidly and
glow just blue. (The LAN LED should also be glowing blue).
3. Connect to the OpenWrt running in RAM
The default IPv4-Address of your router will be 192.168.1.1.
1. Copy over the openwrt-sysupgrade.bin image to your router's
temporary directory
# scp openwrt-sysupgrade.bin root@192.168.1.1:/tmp
2. ssh from your PC into your router as root.
# ssh root@192.168.1.1
The default OpenWrt-Image won't ask for a password. Simply hit the Enter-Key.
Once connected...: run the following commands on your temporary installation
3. delete the "jffs2" ubi partition to make room for your new root partition
# ubirmvol /dev/ubi0 --name=jffs2
4. install OpenWrt on the NAND Flash.
# sysupgrade -v /tmp/openwrt-sysupgrade.bin
- This will will automatically reboot the router -
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2018-03-07 08:13:10 +00:00
|
|
|
asus,rt-ac58u)
|
|
|
|
CI_UBIPART=UBI_DEV
|
|
|
|
ath10kcal_ubi_extract "Factory" 20480 12064
|
|
|
|
;;
|
2018-02-21 19:40:50 +00:00
|
|
|
avm,fritzbox-4040)
|
|
|
|
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
|
|
|
|
;;
|
2018-03-10 09:59:18 +00:00
|
|
|
meraki,mr33)
|
|
|
|
ath10kcal_ubi_extract "ART" 20480 12064
|
|
|
|
ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 20480 12064
|
|
|
|
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102) +3)
|
|
|
|
;;
|
ipq40xx: add support for Netgear EX6100v2/EX6150v2
Specifications:
SOC: Qualcomm IPQ4018 (DAKOTA) ARM Quad-Core
RAM: 256 MB Winbond W632GU6KB12J
FLASH: 16 MiB Macronix MX25L12805D
ETH: Qualcomm QCA8072
WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11b/g/n/ac 2x2
WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11n/ac
1x1 (EX6100)
2x2 (EX6150)
INPUT: Power, WPS, reset button
AP / Range-extender toggle
LED: Power, Router, Extender (dual), WPS, Left-/Right-arrow
SERIAL: Header next to QCA8072 chip.
VCC, TX, RX, GND (Square hole is VCC)
WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!
The Serial setting is 115200-8-N-1.
Tested and working:
- Ethernet
- 2.4 GHz WiFi (Correct MAC-address)
- 5 GHz WiFi (Correct MAC-address)
- Factory installation from WebIF
- Factory installation from tftp
- OpenWRT sysupgrade (Preserving and non-preserving)
- LEDs
- Buttons
Not Working:
- AP/Extender toggle-switch
Untested:
- Support on EX6100v2. They share the same GPL-Code and vendor-images.
The 6100v2 seems to lack one 5GHz stream and differs in the 5GHz
board-blob. I only own a EX6150v2, therefore i am only able to verify
functionality on this device.
Install via Web-Interface:
Upload the factory image to the device to the Netgear Web-Interface.
The device might asks you to confirm the update a second time due to
detecting the OpenWRT firmware as older. The device will automatically
reboot after the image is written to flash.
Install via TFTP:
Connect to the devices serial. Hit Enter-Key in bootloader to stop
autobooting. Command "fw_recovery" will start a tftp server, waiting for
a DNI image to be pushed.
Assign your computer the IP-address 192.168.1.10/24. Push image with
tftp -4 -v -m binary 192.168.1.1 -c put <OPENWRT_FACTORY>
Device will erase factory-partition first, then writes the pushed image
to flash and reboots.
Parts of this commit are based on Thomas Hebb's work on the
openwrt-devel mailinglist.
See https://lists.openwrt.org/pipermail/openwrt-devel/2018-January/043418.html
Signed-off-by: David Bauer <mail@david-bauer.net>
2018-03-28 22:32:38 +00:00
|
|
|
netgear,ex6100v2 |\
|
|
|
|
netgear,ex6150v2)
|
|
|
|
ath10kcal_extract "ART" 20480 12064
|
|
|
|
ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 12)
|
|
|
|
;;
|
2018-03-02 10:56:53 +00:00
|
|
|
compex,wpj428 |\
|
2018-02-21 19:40:50 +00:00
|
|
|
openmesh,a42)
|
|
|
|
ath10kcal_extract "0:ART" 20480 12064
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|