openwrt/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
André Valentin 5dee596501
ipq807x: Add ZyXEL NBG7815
ZyXEL NBG7815 is a premium 802.11ax "tri"-band router/AP.
Specifications:
* CPU: Qualcomm IPQ8072A Quad core Cortex-A53 2.2GHz
* RAM: 1 GB 2x Nanya NT5CC256M16ER-EK
* Storage:
        * 8MB serial flash Winbond W25Q64DW
        * 4GB eMMC flash Kingston EMMC04G-M627
* Ethernet:
        * 4x1G RJ45 ports (QCA8074A) with 1x status LED per port
        * 1x2.5G RJ45 port (QCA8081) with 1x status LED
        * 1x10G RJ45 port (AQR113C) with 1x status LED
* Switch: Qualcomm Atheros QCA8075
* WLAN:
        * 2.4GHz: Qualcomm QCN5024 4x4@40MHz 802.11b/g/n/ax 1147 Mbps PHY rate
        * 2x 5GHz: Qualcomm QCN5054 4x4 802.11a/b/g/n/ac/ax 2402 PHY rate
* Bluetooth CSR8811 using HSUART, currently unsupported
* USB: 1x USB3.0 Type-A port
* LED-s currently not supported:
        * White
        * Dark Blu
        * Amber
        * Purple
        * Purple and dark blue
        * Red
* Buttons:
        * 1x Soft reset
* Power: 12V DC Jack

Installation instructions:
* Disconnect WAN
* Reset device to factory defaults by pushing reset button 15 sec,
  LEDs should lit orange color.
* After 5-10 minutes, when the LEDs turn constant dark blue,
  put your LAN cable and connect at address 192.168.123.1 by telnet on port 23
* Login with
  NBG7815 login: root
  password: nbg7815@2019
* cd /tmp/ApplicationData
* wget -O openwrt-ipq807x-generic-zyxel_nbg7815-squashfs-sysupgrade.bin http://...
* wget https://github.com/itorK/nbg7815_tools/blob/main/flash_to_openwrt.sh
* run flash_to_openwrt.sh
If you can't use wget, you can transfer the files via nc.
See https://openwrt.org/inbox/toh/zyxel/nbg7815_armor_g5 for installation details.

Bluetooth usage:
* you need at least package bluez-utils, recommended bluez-daemon
* run following commands to enable and start
  hciattach  /dev/ttyMSM1 bcsp
  hciconfig hci0 up

Many thanks to itorK for his work on this device:
https://github.com/itorK/openwrt/tree/nbg7815

Reviewed-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: André Valentin <avalentin@marcant.net>
2023-01-19 13:26:15 +01:00

107 lines
2.2 KiB
Bash

PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fw_printenv fw_setenv head'
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
}
platform_check_image() {
return 0;
}
platform_pre_upgrade() {
case "$(board_name)" in
redmi,ax6|\
xiaomi,ax3600|\
xiaomi,ax9000)
xiaomi_initramfs_prepare
;;
esac
}
platform_do_upgrade() {
case "$(board_name)" in
dynalink,dl-wrx36)
nand_do_upgrade "$1"
;;
edgecore,eap102)
active="$(fw_printenv -n active)"
if [ "$active" -eq "1" ]; then
CI_UBIPART="rootfs2"
else
CI_UBIPART="rootfs1"
fi
# force altbootcmd which handles partition change in u-boot
fw_setenv bootcount 3
fw_setenv upgrade_available 1
nand_do_upgrade "$1"
;;
edimax,cax1800)
nand_do_upgrade "$1"
;;
qnap,301w)
kernelname="0:HLOS"
rootfsname="rootfs"
mmc_do_upgrade "$1"
;;
zyxel,nbg7815)
local config_mtdnum="$(find_mtd_index 0:bootconfig)"
[ -z "$config_mtdnum" ] && reboot
part_num="$(hexdump -e '1/1 "%01x|"' -n 1 -s 168 -C /dev/mtd$config_mtdnum | cut -f 1 -d "|" | head -n1)"
if [ "$part_num" -eq "0" ]; then
kernelname="0:HLOS"
rootfsname="rootfs"
mmc_do_upgrade "$1"
else
kernelname="0:HLOS_1"
rootfsname="rootfs_1"
mmc_do_upgrade "$1"
fi
;;
redmi,ax6|\
xiaomi,ax3600|\
xiaomi,ax9000)
# 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"
;;
*)
default_do_upgrade "$1"
;;
esac
}