mirror of
				https://github.com/hzyitc/openwrt-redmi-ax3000
				synced 2025-10-30 07:50:32 +08:00 
			
		
		
		
	ramips: add support for Plasma Cloud PAX1800-Lite
Plasma Cloud PAX1800-Lite is a dual-band Wi-Fi 6 router, based on MediaTek
MT7621A + MT79x5D platform.
Specifications:
- SOC:      MT7621AT (880 MHz)
- DRAM:     DDR3 448 MiB (Nanya NT5CC256M16DP-DI)
- Flash:    2 MiB SPI NOR (S25FL016K) + 128 MB SPI NAND (W25N02KVZEIR)
- Ethernet: 1x 10/100/1000 Mbps (SOC's built-in switch, with PoE+)
- Wi-Fi:    2x2:2 2.4/5 GHz (MT7905DAN + MT7975DN)
            (MT7905DAN doesn't support background DFS scan/BT)
- LED:      tri-color LED for status (red, blue, green)
- Buttons:  1x (reset)
- Antenna:  4x internal, non-detachable omnidirectional
- UART:     1x 4-pin (2.54 mm pitch, marked as "3V3 G/RX GND W/TX")
- Power:    12 V DC/2 A (DC jack)
MAC addresses:
WAN:     54:9C:27:xx:xx:00 (factory 0x3fff4, device label)
2.4 GHz: 54:9C:27:xx:xx:02 (factory 0x4, device label +2)
5 GHz:   54:9C:27:xx:xx:08 (factory 0xa, device label +8)
Flashing instructions:
======================
Various methods can be used to install the actual image on the flash.
Two easy ones are:
ap51-flash
----------
The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.
initramfs from TFTP
-------------------
The serial console (115200 8N1) must be used to access the u-boot shell
during bootup. It can then be used to first boot up the initramfs image
from a TFTP server (here with the IP 192.168.1.21):
    setenv serverip 192.168.1.21
    setenv ipaddr 192.168.1.1
    tftpboot 0x83001000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr
The actual sysupgrade image can then be transferred (on the LAN port) to the
device via
    scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/
On the device, the sysupgrade must then be started using
    sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin
Signed-off-by: Sven Eckelmann (Plasma Cloud) <se@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20152
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
			
			
This commit is contained in:
		 Sven Eckelmann (Plasma Cloud)
					Sven Eckelmann (Plasma Cloud)
				
			
				
					committed by
					
						 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
			
				
	
			
			
			 Hauke Mehrtens
						Hauke Mehrtens
					
				
			
						parent
						
							6733b9ab7c
						
					
				
				
					commit
					c7c54f3134
				
			| @ -640,6 +640,19 @@ define Build/openmesh-image | ||||
| 		"$(call param_get_default,rootfs,$(1),$@)" "rootfs" | ||||
| endef | ||||
|  | ||||
| define Build/dualboot-datachk-nand-image | ||||
| 	$(TOPDIR)/scripts/nand-fwupgradecfg-gen.sh \ | ||||
| 		"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \ | ||||
| 		"$@-fwupgrade.cfg" \ | ||||
| 		"$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \ | ||||
| 		"$(call param_get_default,rootfs,$(1),$@)" | ||||
| 	$(TOPDIR)/scripts/combined-ext-image.sh \ | ||||
| 		"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \ | ||||
| 		"$@-fwupgrade.cfg" "fwupgrade.cfg" \ | ||||
| 		"$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \ | ||||
| 		"$(call param_get_default,rootfs,$(1),$@)" "rootfs" | ||||
| endef | ||||
|  | ||||
| define Build/pad-extra | ||||
| 	dd if=/dev/zero bs=$(1) count=1 >> $@ | ||||
| endef | ||||
|  | ||||
| @ -32,6 +32,7 @@ allnet,all0256n-4m|\ | ||||
| allnet,all0256n-8m|\ | ||||
| allnet,all5002|\ | ||||
| asiarf,ap7621-004-v3|\ | ||||
| plasmacloud,pax1800-lite|\ | ||||
| yuncore,ax820) | ||||
| 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" | ||||
| 	;; | ||||
|  | ||||
							
								
								
									
										61
									
								
								scripts/nand-fwupgradecfg-gen.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										61
									
								
								scripts/nand-fwupgradecfg-gen.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,61 @@ | ||||
| #!/bin/sh | ||||
| # | ||||
| # Copyright (C) 2011 OpenWrt.org | ||||
| # | ||||
| # This is free software, licensed under the GNU General Public License v2. | ||||
| # See /LICENSE for more information. | ||||
| # | ||||
|  | ||||
| usage() { | ||||
| 	echo "Usage: $0 <TARGET> <out file path> <kernel path> <rootfs path>" | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| [ "$#" -lt 4 ] && usage | ||||
|  | ||||
| CE_TYPE=$1 | ||||
| CFG_OUT=$2 | ||||
| KERNEL_PATH=$3 | ||||
| ROOTFS_PATH=$4 | ||||
|  | ||||
| case $CE_TYPE in | ||||
| PAX1800-Lite) | ||||
| 	EXTRA_SETENV="" | ||||
| 	;; | ||||
| *) | ||||
| 	echo "Error - unsupported ce type: $CE_TYPE" | ||||
| 	exit 1 | ||||
| 	;; | ||||
| esac | ||||
|  | ||||
| # kernel calculation | ||||
| KERNEL_MD5=$(mkhash md5 $KERNEL_PATH) | ||||
| KERNEL_SHA256=$(mkhash sha256 $KERNEL_PATH) | ||||
| KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") | ||||
| KERNEL_CHECK_SIZE=$(printf '0x%x' $KERNEL_SIZE) | ||||
|  | ||||
| # rootfs calculation | ||||
| ROOTFS_MD5=$(mkhash md5 $ROOTFS_PATH) | ||||
| ROOTFS_SHA256=$(mkhash sha256 $ROOTFS_PATH) | ||||
| ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") | ||||
| ROOTFS_CHECK_SIZE=$(printf '0x%x' $ROOTFS_SIZE) | ||||
|  | ||||
| cat << EOF > $CFG_OUT | ||||
| [kernel] | ||||
| filename=kernel | ||||
| md5sum=$KERNEL_MD5 | ||||
| filemd5sum=$KERNEL_MD5 | ||||
| filesha256sum=$KERNEL_SHA256 | ||||
| checksize=$KERNEL_CHECK_SIZE | ||||
| ubi=1 | ||||
| cmd_success=setenv bootseq 1,2; $EXTRA_SETENV; saveenv | ||||
|  | ||||
| [rootfs] | ||||
| filename=rootfs | ||||
| md5sum=$ROOTFS_MD5 | ||||
| filemd5sum=$ROOTFS_MD5 | ||||
| filesha256sum=$ROOTFS_SHA256 | ||||
| checksize=$ROOTFS_CHECK_SIZE | ||||
| ubi=1 | ||||
| cmd_success=setenv bootseq 1,2; $EXTRA_SETENV; saveenv | ||||
| EOF | ||||
							
								
								
									
										2229
									
								
								target/linux/ramips/dts/mt7621_plasmacloud_pax1800-lite.dts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2229
									
								
								target/linux/ramips/dts/mt7621_plasmacloud_pax1800-lite.dts
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -2528,6 +2528,21 @@ define Device/planex_vr500 | ||||
| endef | ||||
| TARGET_DEVICES += planex_vr500 | ||||
|  | ||||
| define Device/plasmacloud_pax1800-lite | ||||
|   $(Device/nand) | ||||
|   IMAGE_SIZE := 60512k | ||||
|   DEVICE_VENDOR := Plasma Cloud | ||||
|   DEVICE_MODEL := PAX1800-Lite | ||||
|   DEVICE_DTS_CONFIG := config@plasmacloud.pax1800-lite | ||||
|   DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 kmod-hwmon-lm75 | ||||
|   KERNEL_IN_UBI := 1 | ||||
|   IMAGES += factory.bin | ||||
|   KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | pad-to $$(BLOCKSIZE) | ||||
|   IMAGE/factory.bin := append-rootfs | pad-to 1k | dualboot-datachk-nand-image ce_type=PAX1800-Lite | ||||
|   IMAGE/sysupgrade.bin := append-rootfs | pad-to 1k | sysupgrade-tar rootfs=$$$$@ | append-metadata | ||||
| endef | ||||
| TARGET_DEVICES += plasmacloud_pax1800-lite | ||||
|  | ||||
| define Device/raisecom_msg1500-x-00 | ||||
|   $(Device/nand) | ||||
|   $(Device/uimage-lzma-loader) | ||||
|  | ||||
| @ -51,6 +51,7 @@ ramips_setup_interfaces() | ||||
| 	netgear,eax12|\ | ||||
| 	netgear,ex6150|\ | ||||
| 	netgear,wax214v2|\ | ||||
| 	plasmacloud,pax1800-lite|\ | ||||
| 	sercomm,na502|\ | ||||
| 	sercomm,na502s|\ | ||||
| 	thunder,timecloud|\ | ||||
|  | ||||
| @ -0,0 +1,67 @@ | ||||
| # The U-Boot loader with the datachk patchset for dualbooting requires image | ||||
| # sizes and checksums to be provided in the U-Boot environment. | ||||
| # The devices come with 2 main partitions - while one is active | ||||
| # sysupgrade will flash the other. The boot order is changed to boot the | ||||
| # newly flashed partition. If the new partition can't be booted due to | ||||
| # upgrade failures the previously used partition is loaded. | ||||
|  | ||||
| platform_do_upgrade_dualboot_datachk() { | ||||
| 	local next_boot_part=1 | ||||
| 	local tar_file="$1" | ||||
| 	local bootseq | ||||
|  | ||||
| 	local setenv_script="/tmp/fw_env_upgrade" | ||||
|  | ||||
| 	if [ "$(grep 'ubi.mtd=firmware1' /proc/cmdline)" ];  then | ||||
| 		next_boot_part=2 | ||||
| 		bootseq="2,1" | ||||
| 	else | ||||
| 		next_boot_part=1 | ||||
| 		bootseq="1,2" | ||||
| 	fi | ||||
|  | ||||
| 	local board_dir="$(tar tf "${tar_file}" | grep -m 1 '^sysupgrade-.*/$')" | ||||
| 	board_dir="${board_dir%/}" | ||||
|  | ||||
| 	local kernel_length="$(tar xf "${tar_file}" "${board_dir}/kernel" -O | wc -c)" | ||||
| 	local rootfs_length="$(tar xf "${tar_file}" "${board_dir}/root" -O | wc -c)" | ||||
|  | ||||
| 	local kernel_md5="$(tar xf "${tar_file}" "${board_dir}/kernel" -O | md5sum)" | ||||
| 	kernel_md5="${kernel_md5%% *}" | ||||
|  | ||||
| 	local rootfs_md5="$(tar xf "${tar_file}" "${board_dir}/root" -O | md5sum)" | ||||
| 	rootfs_md5="${rootfs_md5%% *}" | ||||
|  | ||||
| 	CI_UBIPART="firmware${next_boot_part}" | ||||
| 	CI_KERNPART="kernel" | ||||
| 	CI_ROOTPART="rootfs" | ||||
|  | ||||
| 	nand_upgrade_prepare_ubi "${rootfs_length}" "squashfs" "$kernel_length" "0" | ||||
|  | ||||
| 	local ubidev="$(nand_find_ubi "${CI_UBIPART}")" | ||||
|  | ||||
| 	local kern_ubivol="$(nand_find_volume "${ubidev}" "${CI_KERNPART}")" | ||||
| 	tar xf "${tar_file}" "${board_dir}/kernel" -O | \ | ||||
| 		ubiupdatevol "/dev/${kern_ubivol}" -s "${kernel_length}" - | ||||
|  | ||||
| 	local root_ubivol="$(nand_find_volume "${ubidev}" "${CI_ROOTPART}")" | ||||
| 	tar xf "${tar_file}" "${board_dir}/root" -O | \ | ||||
| 		ubiupdatevol "/dev/${root_ubivol}" -s "${rootfs_length}" - | ||||
|  | ||||
| 	[ -f "${UPGRADE_BACKUP}" ] && nand_restore_config "${UPGRADE_BACKUP}" | ||||
|  | ||||
| 	# write new new uboot-env | ||||
| 	printf "bootseq ${bootseq}\n" > "${setenv_script}" | ||||
|  | ||||
| 	printf "kernel_%i_size 0x%08x\n" "${next_boot_part}" "${kernel_length}" >> "${setenv_script}" | ||||
| 	printf "kernel_%i_checksum %s\n" "${next_boot_part}" "${kernel_md5}" >> "${setenv_script}" | ||||
|  | ||||
| 	printf "rootfs_%i_size 0x%08x\n" "${next_boot_part}" "${rootfs_length}" >> "${setenv_script}" | ||||
| 	printf "rootfs_%i_checksum %s\n" "${next_boot_part}" "${rootfs_md5}" >> "${setenv_script}" | ||||
|  | ||||
| 	mkdir -p /var/lock | ||||
| 	fw_setenv -s "${setenv_script}" || { | ||||
| 		echo "failed to update U-Boot environment" | ||||
| 		return 1 | ||||
| 	} | ||||
| } | ||||
| @ -185,6 +185,9 @@ platform_do_upgrade() { | ||||
| 		iodata_mstc_set_flag "bootnum" "persist" "0x4" "1,2" "1" | ||||
| 		nand_do_upgrade "$1" | ||||
| 		;; | ||||
| 	plasmacloud,pax1800-lite) | ||||
| 		platform_do_upgrade_dualboot_datachk "$1" | ||||
| 		;; | ||||
| 	tplink,er605-v2) | ||||
| 		echo "Upgrading tplink,er605-v2" | ||||
| 		CI_UBIPART="firmware" | ||||
|  | ||||
| @ -164,6 +164,7 @@ CONFIG_MTD_PHYSMAP=y | ||||
| CONFIG_MTD_RAW_NAND=y | ||||
| CONFIG_MTD_ROUTERBOOT_PARTS=y | ||||
| CONFIG_MTD_SERCOMM_PARTS=y | ||||
| CONFIG_MTD_SPI_NAND=y | ||||
| CONFIG_MTD_SPI_NOR=y | ||||
| CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y | ||||
| CONFIG_MTD_SPLIT_FIT_FW=y | ||||
|  | ||||
		Reference in New Issue
	
	Block a user