qualcommax: move ipq807x support to subtarget
authorRobert Marko <robimarko@gmail.com>
Tue, 13 Jun 2023 20:07:06 +0000 (22:07 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 16 Jun 2023 09:11:09 +0000 (11:11 +0200)
Now that qualcommax exists as a target and dependencies have been updated
let move ipq807x support to subtarget of qualcommax.

This is mostly copy/paste with the exception of having to update SSDK and
NSS-DP to use CONFIG_TARGET_SUBTARGET.

This is a preparation for later addition of IPQ60xx and IPQ50xx support.

Signed-off-by: Robert Marko <robimarko@gmail.com>
23 files changed:
package/boot/uboot-envtools/files/qualcommax [deleted file]
package/boot/uboot-envtools/files/qualcommax_ipq807x [new file with mode: 0644]
package/kernel/qca-nss-dp/Makefile
package/kernel/qca-ssdk/Makefile
target/linux/qualcommax/Makefile
target/linux/qualcommax/base-files/etc/board.d/01_leds [deleted file]
target/linux/qualcommax/base-files/etc/board.d/02_network [deleted file]
target/linux/qualcommax/base-files/etc/hotplug.d/firmware/11-ath11k-caldata [deleted file]
target/linux/qualcommax/base-files/etc/init.d/bootcount [deleted file]
target/linux/qualcommax/base-files/lib/upgrade/buffalo.sh [deleted file]
target/linux/qualcommax/base-files/lib/upgrade/mmc.sh [deleted file]
target/linux/qualcommax/base-files/lib/upgrade/platform.sh [deleted file]
target/linux/qualcommax/generic/target.mk [deleted file]
target/linux/qualcommax/image/generic.mk [deleted file]
target/linux/qualcommax/image/ipq807x.mk [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount [new file with mode: 0755]
target/linux/qualcommax/ipq807x/base-files/lib/upgrade/buffalo.sh [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh [new file with mode: 0644]
target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh [new file with mode: 0644]
target/linux/qualcommax/ipq807x/target.mk [new file with mode: 0644]

diff --git a/package/boot/uboot-envtools/files/qualcommax b/package/boot/uboot-envtools/files/qualcommax
deleted file mode 100644 (file)
index 345cdad..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-[ -e /etc/config/ubootenv ] && exit 0
-
-touch /etc/config/ubootenv
-
-. /lib/uboot-envtools.sh
-. /lib/functions.sh
-
-board=$(board_name)
-
-case "$board" in
-dynalink,dl-wrx36|\
-netgear,wax218)
-       idx="$(find_mtd_index 0:appsblenv)"
-       [ -n "$idx" ] && \
-               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
-       ;;
-compex,wpq873|\
-edgecore,eap102|\
-zyxel,nbg7815)
-       idx="$(find_mtd_index 0:appsblenv)"
-       [ -n "$idx" ] && \
-               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
-       ;;
-edimax,cax1800)
-       idx="$(find_mtd_index 0:appsblenv)"
-       [ -n "$idx" ] && \
-               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
-       ;;
-redmi,ax6|\
-xiaomi,ax3600|\
-xiaomi,ax9000)
-       idx="$(find_mtd_index 0:appsblenv)"
-       [ -n "$idx" ] && \
-               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
-       idx2="$(find_mtd_index bdata)"
-       [ -n "$idx2" ] && \
-               ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000"
-       ;;
-prpl,haze)
-       mmcpart="$(find_mmc_part 0:APPSBLENV)"
-       [ -n "$mmcpart" ] && \
-               ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
-       ;;
-qnap,301w)
-       idx="$(find_mtd_index 0:appsblenv)"
-       [ -n "$idx" ] && \
-               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
-       ;;
-esac
-
-config_load ubootenv
-config_foreach ubootenv_add_app_config
-
-exit 0
diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x
new file mode 100644 (file)
index 0000000..345cdad
--- /dev/null
@@ -0,0 +1,54 @@
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+dynalink,dl-wrx36|\
+netgear,wax218)
+       idx="$(find_mtd_index 0:appsblenv)"
+       [ -n "$idx" ] && \
+               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
+       ;;
+compex,wpq873|\
+edgecore,eap102|\
+zyxel,nbg7815)
+       idx="$(find_mtd_index 0:appsblenv)"
+       [ -n "$idx" ] && \
+               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
+       ;;
+edimax,cax1800)
+       idx="$(find_mtd_index 0:appsblenv)"
+       [ -n "$idx" ] && \
+               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
+       ;;
+redmi,ax6|\
+xiaomi,ax3600|\
+xiaomi,ax9000)
+       idx="$(find_mtd_index 0:appsblenv)"
+       [ -n "$idx" ] && \
+               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000"
+       idx2="$(find_mtd_index bdata)"
+       [ -n "$idx2" ] && \
+               ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000"
+       ;;
+prpl,haze)
+       mmcpart="$(find_mmc_part 0:APPSBLENV)"
+       [ -n "$mmcpart" ] && \
+               ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
+       ;;
+qnap,301w)
+       idx="$(find_mtd_index 0:appsblenv)"
+       [ -n "$idx" ] && \
+               ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x20000" "1"
+       ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config
+
+exit 0
index aad49b80552cf8c3ba90f8ee60f75a11e8eb4376..8e9e9c4f09c5cd886ea22356a64b7bc96d165b1d 100644 (file)
@@ -39,7 +39,7 @@ EXTRA_CFLAGS+= \
 
 NSS_DP_HAL_DIR:=$(PKG_BUILD_DIR)/hal
 define Build/Configure
-       $(LN) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_BOARD)/nss_$(CONFIG_TARGET_BOARD).h \
+       $(LN) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_SUBTARGET)/nss_$(CONFIG_TARGET_SUBTARGET).h \
                $(PKG_BUILD_DIR)/exports/nss_dp_arch.h
 endef
 
@@ -48,7 +48,7 @@ define Build/Compile
                CROSS_COMPILE="$(TARGET_CROSS)" \
                ARCH="$(LINUX_KARCH)" \
                M="$(PKG_BUILD_DIR)" \
-               EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_BOARD)" \
+               EXTRA_CFLAGS="$(EXTRA_CFLAGS)" SoC="$(CONFIG_TARGET_SUBTARGET)" \
                $(KERNEL_MAKE_FLAGS) \
                $(PKG_JOBS) \
                modules
index 169252663b75b8195b91af86de5469d2adc3871f..a40aefb2eeed4decaced1f977c43a8b600599483 100644 (file)
@@ -51,7 +51,7 @@ MAKE_FLAGS+= \
        EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \
        $(LNX_CONFIG_OPTS)
 
-ifeq ($(CONFIG_TARGET_BOARD), "ipq807x")
+ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x")
     MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable
 endif
 
index c6b74e05c91bf9b4beac48fa1287361a2b05c052..a9d4c06b77aea1fbcda730057f7b01d2220278c2 100644 (file)
@@ -6,7 +6,7 @@ BOARDNAME:=Qualcomm Atheros 802.11ax WiSoC-s
 FEATURES:=squashfs ramdisk fpu nand rtc emmc
 KERNELNAME:=Image dtbs
 CPU_TYPE:=cortex-a53
-SUBTARGETS:=generic
+SUBTARGETS:=ipq807x
 
 KERNEL_PATCHVER:=6.1
 
@@ -14,8 +14,7 @@ include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
        kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom \
        kmod-leds-gpio kmod-gpio-button-hotplug \
-       kmod-phy-aquantia kmod-qca-nss-dp \
-       ath11k-firmware-ipq8074 kmod-ath11k-ahb \
+       kmod-qca-nss-dp kmod-ath11k-ahb \
        wpad-basic-mbedtls uboot-envtools \
        e2fsprogs kmod-fs-ext4 losetup
 
diff --git a/target/linux/qualcommax/base-files/etc/board.d/01_leds b/target/linux/qualcommax/base-files/etc/board.d/01_leds
deleted file mode 100644 (file)
index a89b4c1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-
-. /lib/functions/uci-defaults.sh
-
-board_config_update
-
-board=$(board_name)
-
-case "$board" in
-edgecore,eap102)
-       ucidef_set_led_netdev "wan" "WAN" "green:wanpoe" "wan"
-       ;;
-netgear,wax218)
-       ucidef_set_led_netdev "lan" "LAN" "blue:lan" "lan"
-       ucidef_set_led_wlan "wlan5g" "WIFI 5GHz" "blue:wlan5g" "phy0radio"
-       ucidef_set_led_wlan "wlan2g" "WIFI 2.4GHz" "blue:wlan2g" "phy1radio"
-       ;;
-redmi,ax6|\
-xiaomi,ax3600)
-       ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan"
-       ;;
-qnap,301w)
-       ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "lan1"
-       ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "lan2"
-       ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "lan3"
-       ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "lan4"
-       ucidef_set_led_netdev "10G_1" "10G_1" "green:10g_1" "10g-1"
-       ucidef_set_led_netdev "10G_2" "10G_2" "green:10g_2" "10g-2"
-       ;;
-esac
-
-board_config_flush
-
-exit 0
diff --git a/target/linux/qualcommax/base-files/etc/board.d/02_network b/target/linux/qualcommax/base-files/etc/board.d/02_network
deleted file mode 100644 (file)
index 8175a99..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2015 The Linux Foundation. All rights reserved.
-# Copyright (c) 2011-2015 OpenWrt.org
-#
-
-. /lib/functions/uci-defaults.sh
-. /lib/functions/system.sh
-
-ipq807x_setup_interfaces()
-{
-       local board="$1"
-
-       case "$board" in
-       buffalo,wxr-5950ax12|\
-       dynalink,dl-wrx36|\
-       xiaomi,ax9000)
-               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
-               ;;
-       edgecore,eap102)
-               ucidef_set_interfaces_lan_wan "lan" "wan"
-               ;;
-       edimax,cax1800)
-               ucidef_set_interfaces_lan_wan "lan"
-               ;;
-       netgear,wax218)
-               ucidef_set_interface_lan "lan" "dhcp"
-               ;;
-       prpl,haze)
-               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
-               ;;
-       qnap,301w)
-               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g-2" "10g-1"
-               ;;
-       compex,wpq873|\
-       redmi,ax6|\
-       xiaomi,ax3600)
-               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
-               ;;
-       zyxel,nbg7815)
-               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g" "wan"
-               ;;
-       *)
-               echo "Unsupported hardware. Network interfaces not initialized"
-               ;;
-       esac
-}
-
-board_config_update
-board=$(board_name)
-ipq807x_setup_interfaces $board
-board_config_flush
-
-exit 0
diff --git a/target/linux/qualcommax/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
deleted file mode 100644 (file)
index f931557..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-[ -e /lib/firmware/$FIRMWARE ] && exit 0
-
-. /lib/functions/caldata.sh
-
-board=$(board_name)
-
-case "$FIRMWARE" in
-"ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin")
-       case "$board" in
-       buffalo,wxr-5950ax12|\
-       compex,wpq873|\
-       edgecore,eap102|\
-       edimax,cax1800|\
-       dynalink,dl-wrx36|\
-       netgear,wax218|\
-       qnap,301w|\
-       redmi,ax6|\
-       xiaomi,ax3600|\
-       xiaomi,ax9000|\
-       zyxel,nbg7815)
-               caldata_extract "0:art" 0x1000 0x20000
-               ;;
-       prpl,haze)
-                caldata_extract_mmc "0:ART" 0x1000 0x20000
-               ;;
-       esac
-       ;;
-"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin"|\
-"ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin")
-       case "$board" in
-       prpl,haze)
-                caldata_extract_mmc "0:ART" 0x26800 0x20000
-               ;;
-       xiaomi,ax9000)
-               caldata_extract "0:art" 0x26800 0x20000
-               ;;
-       esac
-       ;;
-*)
-       exit 1
-       ;;
-esac
diff --git a/target/linux/qualcommax/base-files/etc/init.d/bootcount b/target/linux/qualcommax/base-files/etc/init.d/bootcount
deleted file mode 100755 (executable)
index 6917446..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh /etc/rc.common
-
-START=99
-
-boot() {
-       case $(board_name) in
-       edgecore,eap102)
-               fw_setenv upgrade_available 0
-               # Unset changed flag after sysupgrade complete
-               fw_setenv changed
-       ;;
-       esac
-}
diff --git a/target/linux/qualcommax/base-files/lib/upgrade/buffalo.sh b/target/linux/qualcommax/base-files/lib/upgrade/buffalo.sh
deleted file mode 100644 (file)
index d0ed258..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-. /lib/functions.sh
-
-# Prepare UBI devices for OpenWrt installation
-# - rootfs (mtd22)
-#   - remove "ubi_rootfs" volume (rootfs on stock)
-#   - remove "fw_hash" volume (firmware hash)
-# - user_property (mtd24)
-#   - remove "user_property_ubi" volume (user configuration)
-#   - remove "extra_property" volume (gzipped syslog)
-buffalo_upgrade_prepare() {
-       local ubi_rootdev ubi_propdev
-
-       if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \
-          ! ubi_propdev="$(nand_attach_ubi user_property)"; then
-               echo "failed to attach UBI volume \"rootfs\" or \"user_property\", rebooting..."
-               reboot -f
-       fi
-
-       ubirmvol /dev/$ubi_rootdev -N ubi_rootfs &> /dev/null || true
-       ubirmvol /dev/$ubi_rootdev -N fw_hash &> /dev/null || true
-
-       ubirmvol /dev/$ubi_propdev -N user_property_ubi &> /dev/null || true
-       ubirmvol /dev/$ubi_propdev -N extra_property &> /dev/null || true
-}
-
-# Re-create small dummy ubi_rootfs volume and update
-# fw_hash volume to pass the checking by U-Boot
-# - rootfs (mtd22)
-#   - re-create "ubi_rootfs" volume
-#   - re-create and update "fw_hash" volume
-# - rootfs_recover (mtd23)
-#   - update "fw_hash" volume
-buffalo_upgrade_optvol() {
-       local ubi_rootdev ubi_rcvrdev
-       local hashvol_root hashvol_rcvr
-
-       if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \
-          ! ubi_rcvrdev="$(nand_attach_ubi rootfs_recover)"; then
-               echo "failed to attach UBI volume \"rootfs\" or \"rootfs_recover\", rebooting..."
-               reboot -f
-       fi
-
-       ubimkvol /dev/$ubi_rootdev -N ubi_rootfs -S 1
-       ubimkvol /dev/$ubi_rootdev -N fw_hash -S 1 -t static
-
-       if ! hashvol_root="$(nand_find_volume $ubi_rootdev fw_hash)" || \
-          ! hashvol_rcvr="$(nand_find_volume $ubi_rcvrdev fw_hash)"; then
-               echo "\"fw_hash\" volume in \"rootfs\" or \"rootfs_recover\" not found, rebooting..."
-               reboot -f
-       fi
-
-       echo -n "00000000000000000000000000000000" > /tmp/dummyhash.txt
-       ubiupdatevol /dev/$hashvol_root /tmp/dummyhash.txt
-       ubiupdatevol /dev/$hashvol_rcvr /tmp/dummyhash.txt
-}
diff --git a/target/linux/qualcommax/base-files/lib/upgrade/mmc.sh b/target/linux/qualcommax/base-files/lib/upgrade/mmc.sh
deleted file mode 100644 (file)
index dac9ddd..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Copyright (C) 2016 lede-project.org
-#
-
-# this can be used as a generic mmc upgrade script
-# just add a device entry in platform.sh, 
-# define "kernelname" and "rootfsname" and call mmc_do_upgrade
-# after the kernel and rootfs flash a loopdev (as overlay) is 
-# setup on top of the rootfs partition
-# for the proper function a padded rootfs image is needed, basically 
-# append "pad-to 64k" to the image definition
-# this is based on the ipq806x zyxel.sh mmc upgrade
-
-. /lib/functions.sh
-
-mmc_do_upgrade() {
-       local tar_file="$1"
-       local rootfs=
-       local kernel=
-
-                       [ -z "$kernel" ] && kernel=$(find_mmc_part ${kernelname})
-                       [ -z "$rootfs" ] && rootfs=$(find_mmc_part ${rootfsname})
-
-                       [ -z "$kernel" ] && echo "Upgrade failed: kernel partition not found! Rebooting..." && reboot -f
-                       [ -z "$rootfs" ] && echo "Upgrade failed: rootfs partition not found! Rebooting..." && reboot -f
-
-       mmc_do_flash $tar_file $kernel $rootfs
-
-       return 0
-}
-
-mmc_do_flash() {
-       local tar_file=$1
-       local kernel=$2
-       local rootfs=$3
-       
-       # keep sure its unbound
-       losetup --detach-all || {
-               echo Failed to detach all loop devices. Skip this try.
-               reboot -f
-       }
-
-       # use the first found directory in the tar archive
-       local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
-       board_dir=${board_dir%/}
-
-       echo "flashing kernel to $kernel"
-       tar xf $tar_file ${board_dir}/kernel -O >$kernel
-
-       echo "flashing rootfs to ${rootfs}"
-       tar xf $tar_file ${board_dir}/root -O >"${rootfs}"
-
-       # a padded rootfs is needed for overlay fs creation
-       local offset=$(tar xf $tar_file ${board_dir}/root -O | wc -c)
-       [ $offset -lt 65536 ] && {
-               echo Wrong size for rootfs: $offset
-               sleep 10
-               reboot -f
-       }
-
-       # Mount loop for rootfs_data
-       local loopdev="$(losetup -f)"
-       losetup -o $offset $loopdev $rootfs || {
-               echo "Failed to mount looped rootfs_data."
-               sleep 10
-               reboot -f
-       }
-
-       echo "Format new rootfs_data at position ${offset}."
-       mkfs.ext4 -F -L rootfs_data $loopdev
-       mkdir /tmp/new_root
-       mount -t ext4 $loopdev /tmp/new_root && {
-               echo "Saving config to rootfs_data at position ${offset}."
-               cp -v "$UPGRADE_BACKUP" "/tmp/new_root/$BACKUP_FILE"
-               umount /tmp/new_root
-       }
-
-       # Cleanup
-       losetup -d $loopdev >/dev/null 2>&1
-       sync
-       umount -a
-       reboot -f
-}
diff --git a/target/linux/qualcommax/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/base-files/lib/upgrade/platform.sh
deleted file mode 100644 (file)
index 458eb16..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-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"
-               ;;
-       compex,wpq873|\
-       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
-}
diff --git a/target/linux/qualcommax/generic/target.mk b/target/linux/qualcommax/generic/target.mk
deleted file mode 100644 (file)
index f5cb1fb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-BOARDNAME:=Generic
diff --git a/target/linux/qualcommax/image/generic.mk b/target/linux/qualcommax/image/generic.mk
deleted file mode 100644 (file)
index 6003f2a..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-define Device/FitImage
-       KERNEL_SUFFIX := -uImage.itb
-       KERNEL = kernel-bin | libdeflate-gzip | fit gzip $$(KDIR)/image-$$(DEVICE_DTS).dtb
-       KERNEL_NAME := Image
-endef
-
-define Device/FitImageLzma
-       KERNEL_SUFFIX := -uImage.itb
-       KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(DEVICE_DTS).dtb
-       KERNEL_NAME := Image
-endef
-
-define Device/EmmcImage
-       IMAGES += factory.bin sysupgrade.bin
-       IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k
-       IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata
-endef
-
-define Device/UbiFit
-       KERNEL_IN_UBI := 1
-       IMAGES := factory.ubi sysupgrade.bin
-       IMAGE/factory.ubi := append-ubi
-       IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
-endef
-
-define Device/buffalo_wxr-5950ax12
-       $(call Device/FitImage)
-       DEVICE_VENDOR := Buffalo
-       DEVICE_MODEL := WXR-5950AX12
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@hk01
-       SOC := ipq8074
-       IMAGES := sysupgrade.bin
-       IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
-       DEVICE_PACKAGES := ipq-wifi-buffalo_wxr-5950ax12
-endef
-TARGET_DEVICES += buffalo_wxr-5950ax12
-
-define Device/compex_wpq873
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       DEVICE_VENDOR := Compex
-       DEVICE_MODEL := WPQ873
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@hk09.wpq873
-       SOC := ipq8072
-       IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand
-endef
-TARGET_DEVICES += compex_wpq873
-
-define Device/dynalink_dl-wrx36
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       DEVICE_VENDOR := Dynalink
-       DEVICE_MODEL := DL-WRX36
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@rt5010w-d350-rev0
-       SOC := ipq8072
-       DEVICE_PACKAGES := ipq-wifi-dynalink_dl-wrx36
-endef
-TARGET_DEVICES += dynalink_dl-wrx36
-
-define Device/edgecore_eap102
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       DEVICE_VENDOR := Edgecore
-       DEVICE_MODEL := EAP102
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@ac02
-       SOC := ipq8071
-       DEVICE_PACKAGES := ipq-wifi-edgecore_eap102
-       IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand
-endef
-TARGET_DEVICES += edgecore_eap102
-
-define Device/edimax_cax1800
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       DEVICE_VENDOR := Edimax
-       DEVICE_MODEL := CAX1800
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@ac03
-       SOC := ipq8070
-       DEVICE_PACKAGES := ipq-wifi-edimax_cax1800
-endef
-TARGET_DEVICES += edimax_cax1800
-
-define Device/netgear_wax218
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       ARTIFACTS := web-ui-factory.fit
-       DEVICE_VENDOR := Netgear
-       DEVICE_MODEL := WAX218
-       DEVICE_DTS_CONFIG := config@hk07
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       SOC := ipq8072
-       ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | \
-               ubinize-kernel | qsdk-ipq-factory-nand
-       DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 \
-               ipq-wifi-netgear_wax218
-endef
-TARGET_DEVICES += netgear_wax218
-
-define Device/prpl_haze
-       $(call Device/FitImage)
-       $(call Device/EmmcImage)
-       DEVICE_VENDOR := prpl Foundation
-       DEVICE_MODEL := Haze
-       DEVICE_DTS_CONFIG := config@hk09
-       SOC := ipq8072
-       DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci
-endef
-TARGET_DEVICES += prpl_haze
-
-define Device/qnap_301w
-       $(call Device/FitImage)
-       $(call Device/EmmcImage)
-       DEVICE_VENDOR := QNAP
-       DEVICE_MODEL := 301w
-       DEVICE_DTS_CONFIG := config@hk01
-       KERNEL_SIZE := 16384k
-       SOC := ipq8072
-       DEVICE_PACKAGES += ipq-wifi-qnap_301w
-endef
-TARGET_DEVICES += qnap_301w
-
-define Device/redmi_ax6
-       $(call Device/xiaomi_ax3600)
-       DEVICE_VENDOR := Redmi
-       DEVICE_MODEL := AX6
-       DEVICE_PACKAGES := ipq-wifi-redmi_ax6
-endef
-TARGET_DEVICES += redmi_ax6
-
-define Device/xiaomi_ax3600
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       DEVICE_VENDOR := Xiaomi
-       DEVICE_MODEL := AX3600
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@ac04
-       SOC := ipq8071
-       KERNEL_SIZE := 36608k
-       DEVICE_PACKAGES := ipq-wifi-xiaomi_ax3600 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9887-ct
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-       ARTIFACTS := initramfs-factory.ubi
-       ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel
-endif
-endef
-TARGET_DEVICES += xiaomi_ax3600
-
-define Device/xiaomi_ax9000
-       $(call Device/FitImage)
-       $(call Device/UbiFit)
-       DEVICE_VENDOR := Xiaomi
-       DEVICE_MODEL := AX9000
-       BLOCKSIZE := 128k
-       PAGESIZE := 2048
-       DEVICE_DTS_CONFIG := config@hk14
-       SOC := ipq8072
-       KERNEL_SIZE := 57344k
-       DEVICE_PACKAGES := ipq-wifi-xiaomi_ax9000 kmod-ath11k-pci ath11k-firmware-qcn9074 \
-       kmod-ath10k-ct ath10k-firmware-qca9887-ct
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-       ARTIFACTS := initramfs-factory.ubi
-       ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel
-endif
-endef
-TARGET_DEVICES += xiaomi_ax9000
-
-define Device/zyxel_nbg7815
-       $(call Device/FitImage)
-       $(call Device/EmmcImage)
-       DEVICE_VENDOR := ZYXEL
-       DEVICE_MODEL := NBG7815
-       DEVICE_DTS_CONFIG := config@nbg7815
-       SOC := ipq8074
-       DEVICE_PACKAGES += ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci kmod-hwmon-tmp103 \
-               kmod-bluetooth
-endef
-TARGET_DEVICES += zyxel_nbg7815
diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk
new file mode 100644 (file)
index 0000000..6003f2a
--- /dev/null
@@ -0,0 +1,188 @@
+define Device/FitImage
+       KERNEL_SUFFIX := -uImage.itb
+       KERNEL = kernel-bin | libdeflate-gzip | fit gzip $$(KDIR)/image-$$(DEVICE_DTS).dtb
+       KERNEL_NAME := Image
+endef
+
+define Device/FitImageLzma
+       KERNEL_SUFFIX := -uImage.itb
+       KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(DEVICE_DTS).dtb
+       KERNEL_NAME := Image
+endef
+
+define Device/EmmcImage
+       IMAGES += factory.bin sysupgrade.bin
+       IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k
+       IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata
+endef
+
+define Device/UbiFit
+       KERNEL_IN_UBI := 1
+       IMAGES := factory.ubi sysupgrade.bin
+       IMAGE/factory.ubi := append-ubi
+       IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+
+define Device/buffalo_wxr-5950ax12
+       $(call Device/FitImage)
+       DEVICE_VENDOR := Buffalo
+       DEVICE_MODEL := WXR-5950AX12
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@hk01
+       SOC := ipq8074
+       IMAGES := sysupgrade.bin
+       IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+       DEVICE_PACKAGES := ipq-wifi-buffalo_wxr-5950ax12
+endef
+TARGET_DEVICES += buffalo_wxr-5950ax12
+
+define Device/compex_wpq873
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Compex
+       DEVICE_MODEL := WPQ873
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@hk09.wpq873
+       SOC := ipq8072
+       IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand
+endef
+TARGET_DEVICES += compex_wpq873
+
+define Device/dynalink_dl-wrx36
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Dynalink
+       DEVICE_MODEL := DL-WRX36
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@rt5010w-d350-rev0
+       SOC := ipq8072
+       DEVICE_PACKAGES := ipq-wifi-dynalink_dl-wrx36
+endef
+TARGET_DEVICES += dynalink_dl-wrx36
+
+define Device/edgecore_eap102
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Edgecore
+       DEVICE_MODEL := EAP102
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@ac02
+       SOC := ipq8071
+       DEVICE_PACKAGES := ipq-wifi-edgecore_eap102
+       IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand
+endef
+TARGET_DEVICES += edgecore_eap102
+
+define Device/edimax_cax1800
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Edimax
+       DEVICE_MODEL := CAX1800
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@ac03
+       SOC := ipq8070
+       DEVICE_PACKAGES := ipq-wifi-edimax_cax1800
+endef
+TARGET_DEVICES += edimax_cax1800
+
+define Device/netgear_wax218
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       ARTIFACTS := web-ui-factory.fit
+       DEVICE_VENDOR := Netgear
+       DEVICE_MODEL := WAX218
+       DEVICE_DTS_CONFIG := config@hk07
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       SOC := ipq8072
+       ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | \
+               ubinize-kernel | qsdk-ipq-factory-nand
+       DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 \
+               ipq-wifi-netgear_wax218
+endef
+TARGET_DEVICES += netgear_wax218
+
+define Device/prpl_haze
+       $(call Device/FitImage)
+       $(call Device/EmmcImage)
+       DEVICE_VENDOR := prpl Foundation
+       DEVICE_MODEL := Haze
+       DEVICE_DTS_CONFIG := config@hk09
+       SOC := ipq8072
+       DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci
+endef
+TARGET_DEVICES += prpl_haze
+
+define Device/qnap_301w
+       $(call Device/FitImage)
+       $(call Device/EmmcImage)
+       DEVICE_VENDOR := QNAP
+       DEVICE_MODEL := 301w
+       DEVICE_DTS_CONFIG := config@hk01
+       KERNEL_SIZE := 16384k
+       SOC := ipq8072
+       DEVICE_PACKAGES += ipq-wifi-qnap_301w
+endef
+TARGET_DEVICES += qnap_301w
+
+define Device/redmi_ax6
+       $(call Device/xiaomi_ax3600)
+       DEVICE_VENDOR := Redmi
+       DEVICE_MODEL := AX6
+       DEVICE_PACKAGES := ipq-wifi-redmi_ax6
+endef
+TARGET_DEVICES += redmi_ax6
+
+define Device/xiaomi_ax3600
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Xiaomi
+       DEVICE_MODEL := AX3600
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@ac04
+       SOC := ipq8071
+       KERNEL_SIZE := 36608k
+       DEVICE_PACKAGES := ipq-wifi-xiaomi_ax3600 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9887-ct
+ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+       ARTIFACTS := initramfs-factory.ubi
+       ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel
+endif
+endef
+TARGET_DEVICES += xiaomi_ax3600
+
+define Device/xiaomi_ax9000
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Xiaomi
+       DEVICE_MODEL := AX9000
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       DEVICE_DTS_CONFIG := config@hk14
+       SOC := ipq8072
+       KERNEL_SIZE := 57344k
+       DEVICE_PACKAGES := ipq-wifi-xiaomi_ax9000 kmod-ath11k-pci ath11k-firmware-qcn9074 \
+       kmod-ath10k-ct ath10k-firmware-qca9887-ct
+ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+       ARTIFACTS := initramfs-factory.ubi
+       ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel
+endif
+endef
+TARGET_DEVICES += xiaomi_ax9000
+
+define Device/zyxel_nbg7815
+       $(call Device/FitImage)
+       $(call Device/EmmcImage)
+       DEVICE_VENDOR := ZYXEL
+       DEVICE_MODEL := NBG7815
+       DEVICE_DTS_CONFIG := config@nbg7815
+       SOC := ipq8074
+       DEVICE_PACKAGES += ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci kmod-hwmon-tmp103 \
+               kmod-bluetooth
+endef
+TARGET_DEVICES += zyxel_nbg7815
diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds
new file mode 100644 (file)
index 0000000..a89b4c1
--- /dev/null
@@ -0,0 +1,33 @@
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+board=$(board_name)
+
+case "$board" in
+edgecore,eap102)
+       ucidef_set_led_netdev "wan" "WAN" "green:wanpoe" "wan"
+       ;;
+netgear,wax218)
+       ucidef_set_led_netdev "lan" "LAN" "blue:lan" "lan"
+       ucidef_set_led_wlan "wlan5g" "WIFI 5GHz" "blue:wlan5g" "phy0radio"
+       ucidef_set_led_wlan "wlan2g" "WIFI 2.4GHz" "blue:wlan2g" "phy1radio"
+       ;;
+redmi,ax6|\
+xiaomi,ax3600)
+       ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan"
+       ;;
+qnap,301w)
+       ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "lan1"
+       ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "lan2"
+       ucidef_set_led_netdev "lan3" "LAN3" "green:lan3" "lan3"
+       ucidef_set_led_netdev "lan4" "LAN4" "green:lan4" "lan4"
+       ucidef_set_led_netdev "10G_1" "10G_1" "green:10g_1" "10g-1"
+       ucidef_set_led_netdev "10G_2" "10G_2" "green:10g_2" "10g-2"
+       ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network
new file mode 100644 (file)
index 0000000..8175a99
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Copyright (c) 2015 The Linux Foundation. All rights reserved.
+# Copyright (c) 2011-2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+. /lib/functions/system.sh
+
+ipq807x_setup_interfaces()
+{
+       local board="$1"
+
+       case "$board" in
+       buffalo,wxr-5950ax12|\
+       dynalink,dl-wrx36|\
+       xiaomi,ax9000)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
+               ;;
+       edgecore,eap102)
+               ucidef_set_interfaces_lan_wan "lan" "wan"
+               ;;
+       edimax,cax1800)
+               ucidef_set_interfaces_lan_wan "lan"
+               ;;
+       netgear,wax218)
+               ucidef_set_interface_lan "lan" "dhcp"
+               ;;
+       prpl,haze)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
+               ;;
+       qnap,301w)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g-2" "10g-1"
+               ;;
+       compex,wpq873|\
+       redmi,ax6|\
+       xiaomi,ax3600)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
+               ;;
+       zyxel,nbg7815)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g" "wan"
+               ;;
+       *)
+               echo "Unsupported hardware. Network interfaces not initialized"
+               ;;
+       esac
+}
+
+board_config_update
+board=$(board_name)
+ipq807x_setup_interfaces $board
+board_config_flush
+
+exit 0
diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
new file mode 100644 (file)
index 0000000..f931557
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions/caldata.sh
+
+board=$(board_name)
+
+case "$FIRMWARE" in
+"ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin")
+       case "$board" in
+       buffalo,wxr-5950ax12|\
+       compex,wpq873|\
+       edgecore,eap102|\
+       edimax,cax1800|\
+       dynalink,dl-wrx36|\
+       netgear,wax218|\
+       qnap,301w|\
+       redmi,ax6|\
+       xiaomi,ax3600|\
+       xiaomi,ax9000|\
+       zyxel,nbg7815)
+               caldata_extract "0:art" 0x1000 0x20000
+               ;;
+       prpl,haze)
+                caldata_extract_mmc "0:ART" 0x1000 0x20000
+               ;;
+       esac
+       ;;
+"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin"|\
+"ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin")
+       case "$board" in
+       prpl,haze)
+                caldata_extract_mmc "0:ART" 0x26800 0x20000
+               ;;
+       xiaomi,ax9000)
+               caldata_extract "0:art" 0x26800 0x20000
+               ;;
+       esac
+       ;;
+*)
+       exit 1
+       ;;
+esac
diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/bootcount
new file mode 100755 (executable)
index 0000000..6917446
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+
+boot() {
+       case $(board_name) in
+       edgecore,eap102)
+               fw_setenv upgrade_available 0
+               # Unset changed flag after sysupgrade complete
+               fw_setenv changed
+       ;;
+       esac
+}
diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/buffalo.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/buffalo.sh
new file mode 100644 (file)
index 0000000..d0ed258
--- /dev/null
@@ -0,0 +1,55 @@
+. /lib/functions.sh
+
+# Prepare UBI devices for OpenWrt installation
+# - rootfs (mtd22)
+#   - remove "ubi_rootfs" volume (rootfs on stock)
+#   - remove "fw_hash" volume (firmware hash)
+# - user_property (mtd24)
+#   - remove "user_property_ubi" volume (user configuration)
+#   - remove "extra_property" volume (gzipped syslog)
+buffalo_upgrade_prepare() {
+       local ubi_rootdev ubi_propdev
+
+       if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \
+          ! ubi_propdev="$(nand_attach_ubi user_property)"; then
+               echo "failed to attach UBI volume \"rootfs\" or \"user_property\", rebooting..."
+               reboot -f
+       fi
+
+       ubirmvol /dev/$ubi_rootdev -N ubi_rootfs &> /dev/null || true
+       ubirmvol /dev/$ubi_rootdev -N fw_hash &> /dev/null || true
+
+       ubirmvol /dev/$ubi_propdev -N user_property_ubi &> /dev/null || true
+       ubirmvol /dev/$ubi_propdev -N extra_property &> /dev/null || true
+}
+
+# Re-create small dummy ubi_rootfs volume and update
+# fw_hash volume to pass the checking by U-Boot
+# - rootfs (mtd22)
+#   - re-create "ubi_rootfs" volume
+#   - re-create and update "fw_hash" volume
+# - rootfs_recover (mtd23)
+#   - update "fw_hash" volume
+buffalo_upgrade_optvol() {
+       local ubi_rootdev ubi_rcvrdev
+       local hashvol_root hashvol_rcvr
+
+       if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \
+          ! ubi_rcvrdev="$(nand_attach_ubi rootfs_recover)"; then
+               echo "failed to attach UBI volume \"rootfs\" or \"rootfs_recover\", rebooting..."
+               reboot -f
+       fi
+
+       ubimkvol /dev/$ubi_rootdev -N ubi_rootfs -S 1
+       ubimkvol /dev/$ubi_rootdev -N fw_hash -S 1 -t static
+
+       if ! hashvol_root="$(nand_find_volume $ubi_rootdev fw_hash)" || \
+          ! hashvol_rcvr="$(nand_find_volume $ubi_rcvrdev fw_hash)"; then
+               echo "\"fw_hash\" volume in \"rootfs\" or \"rootfs_recover\" not found, rebooting..."
+               reboot -f
+       fi
+
+       echo -n "00000000000000000000000000000000" > /tmp/dummyhash.txt
+       ubiupdatevol /dev/$hashvol_root /tmp/dummyhash.txt
+       ubiupdatevol /dev/$hashvol_rcvr /tmp/dummyhash.txt
+}
diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/mmc.sh
new file mode 100644 (file)
index 0000000..dac9ddd
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (C) 2016 lede-project.org
+#
+
+# this can be used as a generic mmc upgrade script
+# just add a device entry in platform.sh, 
+# define "kernelname" and "rootfsname" and call mmc_do_upgrade
+# after the kernel and rootfs flash a loopdev (as overlay) is 
+# setup on top of the rootfs partition
+# for the proper function a padded rootfs image is needed, basically 
+# append "pad-to 64k" to the image definition
+# this is based on the ipq806x zyxel.sh mmc upgrade
+
+. /lib/functions.sh
+
+mmc_do_upgrade() {
+       local tar_file="$1"
+       local rootfs=
+       local kernel=
+
+                       [ -z "$kernel" ] && kernel=$(find_mmc_part ${kernelname})
+                       [ -z "$rootfs" ] && rootfs=$(find_mmc_part ${rootfsname})
+
+                       [ -z "$kernel" ] && echo "Upgrade failed: kernel partition not found! Rebooting..." && reboot -f
+                       [ -z "$rootfs" ] && echo "Upgrade failed: rootfs partition not found! Rebooting..." && reboot -f
+
+       mmc_do_flash $tar_file $kernel $rootfs
+
+       return 0
+}
+
+mmc_do_flash() {
+       local tar_file=$1
+       local kernel=$2
+       local rootfs=$3
+       
+       # keep sure its unbound
+       losetup --detach-all || {
+               echo Failed to detach all loop devices. Skip this try.
+               reboot -f
+       }
+
+       # use the first found directory in the tar archive
+       local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+       board_dir=${board_dir%/}
+
+       echo "flashing kernel to $kernel"
+       tar xf $tar_file ${board_dir}/kernel -O >$kernel
+
+       echo "flashing rootfs to ${rootfs}"
+       tar xf $tar_file ${board_dir}/root -O >"${rootfs}"
+
+       # a padded rootfs is needed for overlay fs creation
+       local offset=$(tar xf $tar_file ${board_dir}/root -O | wc -c)
+       [ $offset -lt 65536 ] && {
+               echo Wrong size for rootfs: $offset
+               sleep 10
+               reboot -f
+       }
+
+       # Mount loop for rootfs_data
+       local loopdev="$(losetup -f)"
+       losetup -o $offset $loopdev $rootfs || {
+               echo "Failed to mount looped rootfs_data."
+               sleep 10
+               reboot -f
+       }
+
+       echo "Format new rootfs_data at position ${offset}."
+       mkfs.ext4 -F -L rootfs_data $loopdev
+       mkdir /tmp/new_root
+       mount -t ext4 $loopdev /tmp/new_root && {
+               echo "Saving config to rootfs_data at position ${offset}."
+               cp -v "$UPGRADE_BACKUP" "/tmp/new_root/$BACKUP_FILE"
+               umount /tmp/new_root
+       }
+
+       # Cleanup
+       losetup -d $loopdev >/dev/null 2>&1
+       sync
+       umount -a
+       reboot -f
+}
diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh
new file mode 100644 (file)
index 0000000..458eb16
--- /dev/null
@@ -0,0 +1,117 @@
+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"
+               ;;
+       compex,wpq873|\
+       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
+}
diff --git a/target/linux/qualcommax/ipq807x/target.mk b/target/linux/qualcommax/ipq807x/target.mk
new file mode 100644 (file)
index 0000000..22a9b78
--- /dev/null
@@ -0,0 +1,7 @@
+SUBTARGET:=ipq807x
+BOARDNAME:=Qualcomm Atheros IPQ807x
+DEFAULT_PACKAGES += kmod-phy-aquantia ath11k-firmware-ipq8074
+
+define Target/Description
+       Build firmware images for Qualcomm Atheros IPQ807x based boards.
+endef