mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 09:32:34 +00:00
**SPECIFICATIONS:**
SOC: Qualcomm IPQ6018 (64-bit quad-core ARM Cortex-A53 @ 1.8Ghz)
Flash: SPI NOR 8MB + NAND 128MB
Memory: 1GB
2.4GHz Frequency Band: 2.4GHz ~ 2.484GHz (802.11 b/g/n/ax)
5GHz Frequency Band: 5.150GHz~5.850GHz (802.11 a/n/ac/ax)
Wireless Speed: 2.4GHz: 574Mbps, 5GHz: 1201Mbps
**BACKUP YOUR STOCK FIRMWARE:**
- Put openwrt-*-initramfs-kernel.bin to your TFTP server and rename it to initramfs.bin
- Enable serial console and enter to u-boot cli and exec these commands:
```
tftpboot <your_tftp_server_ip>:initramfs.bin
bootm
```
- Once boot completed and you get the openwrt shell execute below commands:
```
device=<device_name>
mkdir -p /tmp/fw_backup; cd /tmp/fw_backup
rootfs=$(cat /proc/mtd | grep \"rootfs\" | cut -d: -f1)
rootfs_1=$(cat /proc/mtd | grep \"rootfs_1\" | cut -d: -f1)
dd if=/dev/${rootfs} of=rootfs_${rootfs} bs=1M
dd if=/dev/${rootfs_1} of=rootfs_1_${rootfs_1} bs=1M
cp /sys/firmware/fdt fdt.dtb
md5sum * > md5sum
tar -cvzf /tmp/${device}.tar.gz .
sum=$(md5sum /tmp/${device}.tar.gz | cut -d' ' -f1)
mv /tmp/${device}.tar.gz /tmp/${device}_${sum}.tar.gz
echo "stock fw backup saved to: /tmp/${device}_${sum}.tar.gz"
```
- Upload/save your backup to a safe place.
**STOCK FIRMWARE RECOVERY:**
- Boot initramfs image
- Upload your backed-up stock fw tarball to the device
using scp or download it from the device using wget.
- Enter device ssh cli or tty and exec:
```
cd /tmp && wget <your_web_server_ip>/${stock_fw_backup}.tar.gz`
tar -xpzf ${stock_fw_backup}.tar.gz
rootfs=$(cat /proc/mtd | grep \"rootfs\" | cut -d: -f1)
rootfs_1=$(cat /proc/mtd | grep \"rootfs_1\" | cut -d: -f1)
ubiformat /dev/${rootfs} -y -f /tmp/rootfs_${rootfs}
ubiformat /dev/${rootfs_1} -y -f /tmp/rootfs_1_${rootfs_1}
reboot
```
**INSTALLATION:**
1. initramfs method
- Put openwrt-*-initramfs-kernel.bin to your TFTP server and rename it to initramfs.bin
- Enable serial console and enter to u-boot cli and exec these commands:
```
tftpboot <your_tftp_server_ip>:initramfs.bin
bootm
```
- Once boot completed and you get the openwrt shell execute below commands:
```
cd /tmp && wget <your_web_server_ip>/factory.ubi`
export rootfs=$(cat /proc/mtd | grep rootfs | cut -d: -f1)
export rootfs_1=$(cat /proc/mtd | grep rootfs_1 | cut -d: -f1)
ubiformat /dev/${rootfs} -y -f factory.ubi
ubiformat /dev/${rootfs_1} -y -f factory.ubi
reboot
```
2. u-boot nand-factory.bin image method
- Put openwrt-*-squashfs-nand-factory.bin to your TFTP server and enter u-boot cli and exec these commands:
```
tftpboot <your_tftp_server_ip>:factory.bin
#After downloading is finished:
imxtract 0x44000000 ubi
flash rootfs
flash rootfs_1
reset
```
Signed-off-by: Shubham Vishwakarma <shubhamvis98@fossfrog.in>
139 lines
3.6 KiB
Bash
Executable File
139 lines
3.6 KiB
Bash
Executable File
#!/bin/sh
|
|
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
|
|
|
. /lib/functions.sh
|
|
. /lib/functions/system.sh
|
|
|
|
ath11k_generate_macs() {
|
|
touch /lib/firmware/ath11k-macs
|
|
eth=$(cat /sys/class/net/eth0/address)
|
|
mac1=$(macaddr_add $eth 2)
|
|
mac2=$(macaddr_add $eth 3)
|
|
mac3=$(macaddr_add $eth 4)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_eap101() {
|
|
touch /lib/firmware/ath11k-macs
|
|
eth=$(cat /sys/class/net/eth0/address)
|
|
mac1=$(macaddr_add $eth 4)
|
|
mac2=$(macaddr_add $eth 3)
|
|
mac3=$(macaddr_add $eth 5)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_ion4x() {
|
|
touch /lib/firmware/ath11k-macs
|
|
wifimac0=$(grep WLAN0_BASEMAC= /dev/mtd15 |cut -d '=' -f2)
|
|
wifimac1=$(grep WLAN1_BASEMAC= /dev/mtd15 |cut -d '=' -f2)
|
|
wifimac2=00:00:00:00:00:00
|
|
echo -ne \\x${wifimac0//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${wifimac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
ath11k_generate_macs_wf660a() {
|
|
touch /lib/firmware/ath11k-macs
|
|
mmc_dev=$(find_mtd_chardev "0:APPSBLENV")
|
|
[ -z "$mmc_dev" ] && mmc_dev=$(find_mmc_part "0:APPSBLENV")
|
|
[ -n "$mmc_dev" ] && mac=$(grep BaseMacAddress= $mmc_dev | cut -dx -f2)
|
|
eth=$(macaddr_canonicalize $mac)
|
|
mac1=$(macaddr_add $eth 1)
|
|
mac2=$(macaddr_add $eth 2)
|
|
mac3=$(macaddr_add $eth 3)
|
|
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
|
|
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
|
|
}
|
|
|
|
caldata_die() {
|
|
echo "caldata: " "$*"
|
|
exit 1
|
|
}
|
|
|
|
caldata_extract() {
|
|
local part=$1
|
|
local offset=$(($2))
|
|
local count=$(($3))
|
|
local mtd
|
|
|
|
mtd=$(find_mtd_chardev $part)
|
|
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
|
|
|
|
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
|
caldata_die "failed to extract calibration data from $mtd"
|
|
}
|
|
|
|
board=$(board_name)
|
|
|
|
case "$FIRMWARE" in
|
|
"ath11k/IPQ6018/hw1.0/caldata.bin")
|
|
case "$board" in
|
|
cig,wf188n|\
|
|
cig,wf660a|\
|
|
edgecore,eap101|\
|
|
emplus,wap386v2|\
|
|
hfcl,ion4xi|\
|
|
hfcl,ion4x|\
|
|
hfcl,ion4x_2|\
|
|
hfcl,ion4x_3|\
|
|
hfcl,ion4xe|\
|
|
indio,um-310ax-v1|\
|
|
wallys,dr6018|\
|
|
wallys,dr6018-v4|\
|
|
yuncore,ax840|\
|
|
yuncore,fap650|\
|
|
glinet,ax1800)
|
|
caldata_extract "0:ART" 0x1000 0x20000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/QCN9074/hw1.0/caldata_1.bin)
|
|
case "$board" in
|
|
wallys,dr6018-v4)
|
|
caldata_extract "0:ART" 0x26800 0x20000
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k-macs)
|
|
case "$board" in
|
|
hfcl,ion4xi|\
|
|
hfcl,ion4x|\
|
|
hfcl,ion4x_2|\
|
|
hfcl,ion4x_3|\
|
|
hfcl,ion4xe)
|
|
ath11k_generate_macs_ion4x
|
|
;;
|
|
edgecore,eap101)
|
|
ath11k_generate_macs_eap101
|
|
;;
|
|
cig,wf188n|\
|
|
emplus,wap386v2)
|
|
ath11k_generate_macs
|
|
;;
|
|
cig,wf660a)
|
|
ath11k_generate_macs_wf660a
|
|
;;
|
|
esac
|
|
;;
|
|
ath11k/IPQ6018/hw1.0/board.bin)
|
|
case "$board" in
|
|
cig,wf188n)
|
|
country=`cat /etc/ucentral/country`
|
|
if [ "$country" == "CA" ]; then
|
|
ln -s /lib/firmware/ath11k/IPQ6018/hw1.0/board.bin.CA /lib/firmware/ath11k/IPQ6018/hw1.0/board.bin
|
|
else
|
|
ln -s /lib/firmware/ath11k/IPQ6018/hw1.0/board.bin.US /lib/firmware/ath11k/IPQ6018/hw1.0/board.bin
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
exit 1
|
|
;;
|
|
esac
|