Specifications: SOC: Qualcomm IPQ5018 (64-bit dual-core ARM Cortex-A53 @ 1.0Ghz) Memory: 512MB DDR3L Standard: 802.11ax/ac/b/g/n Flash: SPI NOR 8MB (Winbond W25Q64DW) + NAND 128MB (Winbond W25N01GWZEIG) 2.4G Frequency: 2.4GHz - 2.484GHz 2.4G Wi-Fi standard: 802.11b/g/n/ax 5.8G Frequency: 4.9~5.9G 5.8G Wi-Fi Standard: 802.11 a/n/ac/ax Interface: Optional 1(Without 8081): 1 * 10/100 /1000Mbps RJ45 WAN Port and PoE port; 1* Gigabit Console port; Optional 2(With 8081): 1 * 10/100/1000/2500Mbps RJ45 WAN port and PoE port, 1*10/100/1000Mbps LAN port Buttons: 1 * Reset button, press 10 seconds to revert to default setting Antenna: Build in 4*4dBi dual band MIMO Antenna Data Rate: 3000Mbps (2.4G 600Mbps, 5.8G 2400Mbps) End Users: 128+ 2.4G RF Power: ≤ 23dBm 5.8G RF Power: ≤ 23dBm DC: 12V----2A PoE: 48V (IEEE 802.3at) LED Light: Sys, WAN, LAN Power Consumption: ≤ 20W BACKUP YOUR STOCK FIRMWARE: - Put openwrt-*-initramfs-uImage.itb 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=ax830 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-uImage.itb 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 factory.ubi image method - Put factory.ubi to your TFTP server and enter u-boot cli and exec these commands: ``` tftpboot <your_tftp_server_ip>:factory.ubi #After downloading is finished: flash rootfs flash rootfs_1 reset ``` Signed-off-by: Shubham Vishwakarma <shubhamvis98@fossfrog.in> Link: https://github.com/openwrt/openwrt/pull/18968 Signed-off-by: Robert Marko <robimarko@gmail.com>
159 lines
3.4 KiB
Bash
159 lines
3.4 KiB
Bash
PART_NAME=firmware
|
|
REQUIRE_IMAGE_METADATA=1
|
|
|
|
RAMFS_COPY_BIN='dumpimage fw_printenv fw_setenv head seq'
|
|
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
|
|
|
|
xiaomi_initramfs_prepare() {
|
|
# Wipe UBI if running initramfs
|
|
[ "$(rootfs_type)" = "tmpfs" ] || return 0
|
|
|
|
local rootfs_mtdnum="$( find_mtd_index rootfs )"
|
|
if [ ! "$rootfs_mtdnum" ]; then
|
|
echo "unable to find mtd partition rootfs"
|
|
return 1
|
|
fi
|
|
|
|
local kern_mtdnum="$( find_mtd_index ubi_kernel )"
|
|
if [ ! "$kern_mtdnum" ]; then
|
|
echo "unable to find mtd partition ubi_kernel"
|
|
return 1
|
|
fi
|
|
|
|
ubidetach -m "$rootfs_mtdnum"
|
|
ubiformat /dev/mtd$rootfs_mtdnum -y
|
|
|
|
ubidetach -m "$kern_mtdnum"
|
|
ubiformat /dev/mtd$kern_mtdnum -y
|
|
}
|
|
|
|
remove_oem_ubi_volume() {
|
|
local oem_volume_name="$1"
|
|
local oem_ubivol
|
|
local mtdnum
|
|
local ubidev
|
|
|
|
mtdnum=$(find_mtd_index "$CI_UBIPART")
|
|
if [ ! "$mtdnum" ]; then
|
|
return
|
|
fi
|
|
|
|
ubidev=$(nand_find_ubi "$CI_UBIPART")
|
|
if [ ! "$ubidev" ]; then
|
|
ubiattach --mtdn="$mtdnum"
|
|
ubidev=$(nand_find_ubi "$CI_UBIPART")
|
|
fi
|
|
|
|
if [ "$ubidev" ]; then
|
|
oem_ubivol=$(nand_find_volume "$ubidev" "$oem_volume_name")
|
|
[ "$oem_ubivol" ] && ubirmvol "/dev/$ubidev" --name="$oem_volume_name"
|
|
fi
|
|
}
|
|
|
|
linksys_mx_pre_upgrade() {
|
|
local setenv_script="/tmp/fw_env_upgrade"
|
|
|
|
CI_UBIPART="rootfs"
|
|
boot_part="$(fw_printenv -n boot_part)"
|
|
if [ -n "$UPGRADE_OPT_USE_CURR_PART" ]; then
|
|
if [ "$boot_part" -eq "2" ]; then
|
|
CI_KERNPART="alt_kernel"
|
|
CI_UBIPART="alt_rootfs"
|
|
fi
|
|
else
|
|
if [ "$boot_part" -eq "1" ]; then
|
|
echo "boot_part 2" >> $setenv_script
|
|
CI_KERNPART="alt_kernel"
|
|
CI_UBIPART="alt_rootfs"
|
|
else
|
|
echo "boot_part 1" >> $setenv_script
|
|
fi
|
|
fi
|
|
|
|
boot_part_ready="$(fw_printenv -n boot_part_ready)"
|
|
if [ "$boot_part_ready" -ne "3" ]; then
|
|
echo "boot_part_ready 3" >> $setenv_script
|
|
fi
|
|
|
|
auto_recovery="$(fw_printenv -n auto_recovery)"
|
|
if [ "$auto_recovery" != "yes" ]; then
|
|
echo "auto_recovery yes" >> $setenv_script
|
|
fi
|
|
|
|
if [ -f "$setenv_script" ]; then
|
|
fw_setenv -s $setenv_script || {
|
|
echo "failed to update U-Boot environment"
|
|
return 1
|
|
}
|
|
fi
|
|
}
|
|
|
|
platform_check_image() {
|
|
return 0;
|
|
}
|
|
|
|
platform_pre_upgrade() {
|
|
case "$(board_name)" in
|
|
xiaomi,ax6000)
|
|
xiaomi_initramfs_prepare
|
|
;;
|
|
esac
|
|
}
|
|
|
|
platform_do_upgrade() {
|
|
case "$(board_name)" in
|
|
elecom,wrc-x3000gs2|\
|
|
iodata,wn-dax3000gr)
|
|
local delay
|
|
|
|
delay=$(fw_printenv bootdelay)
|
|
[ -z "$delay" ] || [ "$delay" -eq "0" ] && \
|
|
fw_setenv bootdelay 3
|
|
|
|
elecom_upgrade_prepare
|
|
|
|
remove_oem_ubi_volume bt_fw
|
|
remove_oem_ubi_volume ubi_rootfs
|
|
remove_oem_ubi_volume wifi_fw
|
|
nand_do_upgrade "$1"
|
|
;;
|
|
glinet,gl-b3000)
|
|
glinet_do_upgrade "$1"
|
|
;;
|
|
linksys,mr5500|\
|
|
linksys,mx2000|\
|
|
linksys,mx5500|\
|
|
linksys,spnmx56)
|
|
linksys_mx_pre_upgrade "$1"
|
|
remove_oem_ubi_volume squashfs
|
|
nand_do_upgrade "$1"
|
|
;;
|
|
xiaomi,ax6000)
|
|
# Make sure that UART is enabled
|
|
fw_setenv boot_wait on
|
|
fw_setenv uart_en 1
|
|
|
|
# Enforce single partition.
|
|
fw_setenv flag_boot_rootfs 0
|
|
fw_setenv flag_last_success 0
|
|
fw_setenv flag_boot_success 1
|
|
fw_setenv flag_try_sys1_failed 8
|
|
fw_setenv flag_try_sys2_failed 8
|
|
|
|
# Kernel and rootfs are placed in 2 different UBI
|
|
CI_KERN_UBIPART="ubi_kernel"
|
|
CI_ROOT_UBIPART="rootfs"
|
|
nand_do_upgrade "$1"
|
|
;;
|
|
yuncore,ax830)
|
|
CI_UBIPART="rootfs"
|
|
remove_oem_ubi_volume ubi_rootfs
|
|
remove_oem_ubi_volume bt_fw
|
|
remove_oem_ubi_volume wifi_fw
|
|
nand_do_upgrade "$1"
|
|
;;
|
|
*)
|
|
default_do_upgrade "$1"
|
|
;;
|
|
esac
|
|
}
|