From f2e1532a7c9c1f6c0d41b9b7eb89fce4d1917a0f Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Sat, 9 Nov 2024 15:36:01 +0800 Subject: [PATCH] qualcommax: add support for JDCloud AX3000 --- target/linux/qualcommax/image/ipq50xx.mk | 34 +++++++++++++------ .../ipq50xx/base-files/etc/board.d/02_network | 26 +++++++------- .../etc/hotplug.d/firmware/11-ath11k-caldata | 26 +++++++++----- .../base-files/lib/upgrade/platform.sh | 14 ++++++++ 4 files changed, 69 insertions(+), 31 deletions(-) diff --git a/target/linux/qualcommax/image/ipq50xx.mk b/target/linux/qualcommax/image/ipq50xx.mk index 2af8e55c6..9f490fb9a 100644 --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -1,17 +1,34 @@ +define Device/EmmcImage + IMAGES := factory.bin sysupgrade.bin + IMAGE/factory.bin := append-kernel | pad-to 12288k | append-rootfs | append-metadata + IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata +endef + define Device/glinet_gl-b3000 $(call Device/FitImage) $(call Device/UbiFit) - SOC := ipq5000 + SOC := ipq5018 DEVICE_VENDOR := GL.iNET DEVICE_MODEL := GL-B3000 BLOCKSIZE := 128k PAGESIZE := 2048 DEVICE_DTS_CONFIG := config@mp03.5-c1 - UBINIZE_OPTS := -E 5 DEVICE_PACKAGES := ath11k-firmware-qcn6122 ipq-wifi-gl-b3000 endef TARGET_DEVICES += glinet_gl-b3000 +define Device/jdcloud_re-cs-03 + $(call Device/FitImage) + $(call Device/EmmcImage) + SOC := ipq5018 + BLOCKSIZE := 64k + KERNEL_SIZE := 6144k + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := AX3000 + DEVICE_DTS_CONFIG := config@mp03.5-c2 +endef +TARGET_DEVICES += jdcloud_re-cs-03 + define Device/linksys_mx2000 $(call Device/FitImageLzma) DEVICE_VENDOR := Linksys @@ -22,11 +39,10 @@ define Device/linksys_mx2000 IMAGE_SIZE := 83968k DEVICE_DTS_CONFIG := config@mp03.5-c1 SOC := ipq5018 - UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF + UBINIZE_OPTS := -E 5 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=MX2000 - DEVICE_PACKAGES := ath11k-firmware-qcn6122 \ - ipq-wifi-linksys_mx2000 + DEVICE_PACKAGES := ath11k-firmware-qcn6122 ipq-wifi-linksys_mx2000 endef TARGET_DEVICES += linksys_mx2000 @@ -40,11 +56,9 @@ define Device/linksys_mx5500 IMAGE_SIZE := 83968k DEVICE_DTS_CONFIG := config@mp03.1 SOC := ipq5018 - UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF + UBINIZE_OPTS := -E 5 IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=MX5500 - DEVICE_PACKAGES := kmod-ath11k-pci \ - ath11k-firmware-qcn9074 \ - ipq-wifi-linksys_mx5500 + DEVICE_PACKAGES := kmod-ath11k-pci ath11k-firmware-qcn9074 ipq-wifi-linksys_mx5500 endef -TARGET_DEVICES += linksys_mx5500 \ No newline at end of file +TARGET_DEVICES += linksys_mx5500 diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network index 3fa76e36e..75f93cc84 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network @@ -7,13 +7,14 @@ ipq50xx_setup_interfaces() { local board="$1" case $board in - glinet,gl-b3000) - ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" - ;; - linksys,mx2000|\ - linksys,mx5500) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; + glinet,gl-b3000) + ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" + ;; + jdcloud,re-cs-03|\ + linksys,mx2000|\ + linksys,mx5500) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; esac } @@ -25,12 +26,11 @@ ipq50xx_setup_macs() local label_mac="" case "$board" in - linksys,mx2000|\ - linksys,mx5500) - label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - lan_mac=$label_mac - wan_mac=$label_mac - ucidef_set_network_device_mac eth1 $label_mac + linksys,mx2000|\ + linksys,mx5500) + wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac="$wan_mac" ;; esac diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index 1369788e3..aff880013 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -9,6 +9,15 @@ board=$(board_name) case "$FIRMWARE" in "ath11k/IPQ5018/hw1.0/cal-ahb-c000000.wifi.bin") case "$board" in + glinet,gl-b3000) + caldata_extract "0:ART" 0x1000 0x20000 + addr=$(mtd_get_mac_binary "0:ART" 0x6) + ath11k_patch_mac $(macaddr_add $addr 3) 0 + ath11k_set_macflag + ;; + jdcloud,re-cs-03) + caldata_extract_mmc "0:ART" 0x1000 0x20000 + ;; linksys,mx2000|\ linksys,mx5500) caldata_extract "0:ART" 0x1000 0x20000 @@ -17,13 +26,19 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; - glinet,gl-b3000) - caldata_extract "0:ART" 0x1000 0x20000 - ;; esac ;; "ath11k/qcn6122/hw1.0/cal-ahb-soc@0:wifi1@c000000.bin") case "$board" in + glinet,gl-b3000) + caldata_extract "0:ART" 0x26800 0x20000 + addr=$(mtd_get_mac_binary "0:ART" 0x6) + ath11k_patch_mac $(macaddr_add $addr 4) 0 + ath11k_set_macflag + ;; + jdcloud,re-cs-03) + caldata_extract_mmc "0:ART" 0x26800 0x20000 + ;; linksys,mx2000) caldata_extract "0:ART" 0x26800 0x20000 label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) @@ -31,9 +46,6 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; - glinet,gl-b3000) - caldata_extract "0:ART" 0x26800 0x20000 - ;; esac ;; "ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin") @@ -45,8 +57,6 @@ case "$FIRMWARE" in ath11k_remove_regdomain ath11k_set_macflag ;; - glinet,gl-b3000) - caldata_extract "0:ART" 0x26800 0x20000 esac ;; *) diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh index 1702201f1..cb5ae74e7 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -13,6 +13,11 @@ platform_do_upgrade() { glinet,gl-b3000) nand_do_upgrade "$1" ;; + jdcloud,re-cs-03) + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" + ;; linksys,mx2000|\ linksys,mx5500) boot_part="$(fw_printenv -n boot_part)" @@ -33,3 +38,12 @@ platform_do_upgrade() { ;; esac } + +platform_copy_config() { + case "$(board_name)" in + jdcloud,re-cs-03) + emmc_copy_config + ;; + esac + return 0; +}