openwrt/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
Petr Štetiar 41af35cf6b
ipq807x: add initial support for prpl Foundation Haze board
Haze is prpl Foundation's reference board (WNC LVRP).

Board info:

 - IPQ8072A SoC
 - 2 GiB RAM
 - 4 GiB eMMC
 - 8MiB SPI NOR (MX25U6435F)

 - 3x 1GigE ports (QCA8075)
 - 1x 10GigE port (AQR113C)
 - 1x SFP cage

 - WiFi 6GHz 160MHz (QCN9074)
 - WiFi 5GHz 80+80MHz (QCN5054)
 - WiFi 2.4G (QCN5024)

 - ARM Standard 20-pin 2.54mm/0.1" JTAG (1V8 !!!)
 - Bluetooth v5.0 + EDR with integrated Class 1 PA (CYW20704)
 - 1x M.2 B-key socket with PCIe 3.0
 - 1x USB 3.0 port
 - UART marked J6 is 4-pin 2.54mm/0.1" connector 3V3(arrow),RX,TX,GND (115200 8N1)
 - Reset and WPS buttons

Flashing instructions:

 1. From U-Boot boot OpenWrt using initramfs image:

    IPQ807x# tftpboot openwrt-ipq807x-generic-prpl_haze-initramfs-uImage.itb && bootm

 2. In OpenWrt running from initramfs execute sysupgrade:

    root@OpenWrt:/# sysupgrade -n /tmp/openwrt-ipq807x-generic-prpl_haze-squashfs-sysupgrade.bin

Work in progress/known issues:

 * SFP feature not implemented/tested
 * M.2 feature not implemented/tested
 * Bluetooth feature not implemented/tested
 * 6GHz wireless should be working, but not tested
 * MAC address assigments for LAN interfaces

Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit 2e910039dd)
2023-06-12 22:10:29 +02:00

117 lines
2.5 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
buffalo,wxr-5950ax12)
CI_KERN_UBIPART="rootfs"
CI_ROOT_UBIPART="user_property"
buffalo_upgrade_prepare
nand_do_flash_file "$1" || nand_do_upgrade_failed
nand_do_restore_config || nand_do_upgrade_failed
buffalo_upgrade_optvol
;;
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|\
netgear,wax218)
nand_do_upgrade "$1"
;;
prpl,haze|\
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
}