kiddin9 1 жил өмнө
parent
commit
7899f5c16c

+ 2 - 3
devices/bcm53xx/diy.sh

@@ -4,10 +4,9 @@ shopt -s extglob
 
 SHELL_FOLDER=$(dirname $(readlink -f "$0"))
 
-sh -c curl -sfL https://patch-diff.githubusercontent.com/raw/openwrt/openwrt/pull/11542.patch | git apply -p1
-
 sed -i "s/^TARGET_DEVICES /# TARGET_DEVICES /" target/linux/bcm53xx/image/Makefile
 sed -i "s/# TARGET_DEVICES += phicomm_k3/TARGET_DEVICES += phicomm_k3/" target/linux/bcm53xx/image/Makefile
 sed -i "s/# TARGET_DEVICES += asus_rt-ac88u/TARGET_DEVICES += asus_rt-ac88u/" target/linux/bcm53xx/image/Makefile
 sed -i "s/# TARGET_DEVICES += dlink_dir-885l/TARGET_DEVICES += dlink_dir-885l/" target/linux/bcm53xx/image/Makefile
-sed -i "s/DEVICE_PACKAGES := \$(BRCMFMAC_4366C0) \$(USB3_PACKAGES)/DEVICE_PACKAGES := \$(BRCMFMAC_4366C0) \$(USB3_PACKAGES) k3screenctrl/" target/linux/bcm53xx/image/Makefile
+sed -i "s/DEVICE_PACKAGES := \$(BRCMFMAC_4366C0) \$(USB3_PACKAGES)/DEVICE_PACKAGES := \$(BRCMFMAC_4366C0) \$(USB3_PACKAGES) -brcmfmac-firmware-4366c0-pcie k3wifi luci-app-k3screenctrl/" target/linux/bcm53xx/image/Makefile
+

+ 2 - 0
devices/common/diy.sh

@@ -18,7 +18,9 @@ sed -i '/$(curdir)\/compile:/c\$(curdir)/compile: package/opkg/host/compile' pac
 sed -i "s/DEFAULT_PACKAGES:=/DEFAULT_PACKAGES:=luci-app-advancedplus luci-app-firewall luci-app-opkg luci-app-upnp luci-app-autoreboot \
 luci-app-wizard luci-base luci-compat luci-lib-ipkg luci-lib-fs \
 coremark wget-ssl curl autocore htop nano zram-swap kmod-lib-zstd kmod-tcp-bbr bash openssh-sftp-server block-mount resolveip ds-lite swconfig luci-app-fan luci-app-fileassistant /" include/target.mk
+
 sed -i "s/procd-ujail//" include/target.mk
+sed -i "s/procd-seccomp//" include/target.mk
 
 sed -i "s/^.*vermagic$/\techo '1' > \$(LINUX_DIR)\/.vermagic/" include/kernel-defaults.mk
 

+ 7 - 16
devices/common/patches/ebpf.patch.main

@@ -4,7 +4,7 @@
  
  config KERNEL_DEBUG_INFO_BTF
  	bool "Enable additional BTF type information"
-+	default y if (TARGET_armsr || TARGET_bcm27xx || TARGET_ipq806x_chromium || TARGET_mediatek_filogic || TARGET_mvebu_cortexa53 || TARGET_mvebu_cortexa72 || TARGET_rockchip || TARGET_sunxi || TARGET_x86_64)
++ 	default y if (TARGET_armsr || TARGET_bcm27xx || TARGET_ipq806x_chromium || TARGET_mediatek_filogic || TARGET_mvebu_cortexa53 || TARGET_mvebu_cortexa72 || TARGET_rockchip || TARGET_sunxi || TARGET_x86_64)
  	depends on !HOST_OS_MACOS
  	depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
  	select DWARVES
@@ -12,7 +12,7 @@
  config KERNEL_MODULE_ALLOW_BTF_MISMATCH
  	bool "Allow loading modules with non-matching BTF type info"
  	depends on KERNEL_DEBUG_INFO_BTF_MODULES
-+	default y
++ 	default y
  	help
  	  For modules whose split BTF does not match vmlinux, load without
  	  BTF rather than refusing to load. The default behavior with
@@ -25,24 +25,15 @@
  	depends on KERNEL_DEBUG_INFO
  	help
  	  If you say Y here gcc is instructed to generate less debugging
-@@ -540,17 +542,28 @@ config KERNEL_KPROBE_EVENTS
+@@ -540,6 +542,7 @@ config KERNEL_KPROBE_EVENTS
  config KERNEL_BPF_EVENTS
  	bool "Compile the kernel with BPF event support"
  	select KERNEL_KPROBES
-+	default y if KERNEL_DEBUG_INFO_BTF
++ 	default y if KERNEL_DEBUG_INFO_BTF
  	help
  	  Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
  	  This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
- 	  for sending data from BPF programs to user-space for post-processing
- 	  or logging.
- 
-+config KERNEL_PROBE_EVENTS_BTF_ARGS
-+	bool
-+	depends on KERNEL_KPROBE_EVENTS && KERNEL_DEBUG_INFO_BTF
-+	default n
-+
- config KERNEL_BPF_KPROBE_OVERRIDE
- 	bool
+@@ -555,6 +558,11 @@ config KERNEL_BPF_KPROBE_OVERRIDE
  	depends on KERNEL_KPROBES
  	default n
  
@@ -54,11 +45,11 @@
  config KERNEL_AIO
  	bool "Compile the kernel with asynchronous IO support"
  	default y if !SMALL_FLASH
-@@ -1189,6 +1202,7 @@ config KERNEL_NET_L3_MASTER_DEV
+@@ -1193,6 +1201,7 @@ config KERNEL_NET_L3_MASTER_DEV
  
  config KERNEL_XDP_SOCKETS
  	bool "XDP sockets support"
-+	default y if KERNEL_DEBUG_INFO_BTF
++ 	default y if KERNEL_DEBUG_INFO_BTF
  	help
  	  XDP sockets allows a channel between XDP programs and
  	  userspace applications.

+ 1 - 1
devices/ipq50xx_arm/diy.sh

@@ -4,7 +4,7 @@ shopt -s extglob
 
 SHELL_FOLDER=$(dirname $(readlink -f "$0"))
 
-rm -rf package/kernel/qca- package/boot/uboot-envtools package/firmware/ipq-wifi package/firmware/ath11k-firmware package/kernel/mac80211
+rm -rf package/kernel/qca-* package/boot/uboot-envtools package/firmware/ipq-wifi package/firmware/ath11k-firmware package/kernel/mac80211
 
 git_clone_path ipq50xx-mainline-kernel-5.15-openwrt-23.05 https://github.com/hzyitc/openwrt-redmi-ax3000 target/linux/ipq50xx package/firmware/ipq-wifi package/firmware/ath11k-firmware package/kernel/mac80211 package/boot/uboot-envtools package/kernel/qca-nss-dp package/kernel/qca-ssdk
 

+ 258 - 0
devices/mediatek_filogic/patches/rax3000m.revert.patch

@@ -0,0 +1,258 @@
+From 39c824f846ceca5281ee5f3ddbf92627076bdb5e Mon Sep 17 00:00:00 2001
+From: Tianling Shen <[email protected]>
+Date: Tue, 2 Apr 2024 20:26:45 +0800
+Subject: [PATCH] mediatek: switch to fitblk for cmcc rax3000m
+
+Use the new fitblk driver.
+
+Tested-by: Yangyu Chen <[email protected]>
+Signed-off-by: Tianling Shen <[email protected]>
+---
+ .../uboot-envtools/files/mediatek_filogic     | 11 +--------
+ .../patches/437-add-cmcc_rax3000m.patch       |  2 +-
+ .../dts/mt7981b-cmcc-rax3000m-emmc.dtso       | 19 +++++++++++----
+ .../dts/mt7981b-cmcc-rax3000m-nand.dtso       | 22 ++++++++++++++----
+ .../mediatek/dts/mt7981b-cmcc-rax3000m.dts    |  3 ++-
+ .../base-files/lib/upgrade/platform.sh        | 23 +++----------------
+ 6 files changed, 40 insertions(+), 40 deletions(-)
+
+diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
+index 4d1016d412e26..67d37931c29b9 100644
+--- a/package/boot/uboot-envtools/files/mediatek_filogic
++++ b/package/boot/uboot-envtools/files/mediatek_filogic
+@@ -40,6 +40,7 @@ bananapi,bpi-r3|\
+ bananapi,bpi-r3-mini|\
+ bananapi,bpi-r4|\
+ bananapi,bpi-r4-poe|\
++cmcc,rax3000m|\
+ jdcloud,re-cp-03)
+ 	. /lib/upgrade/fit.sh
+ 	export_fitblk_bootdev
+@@ -56,16 +57,6 @@ jdcloud,re-cp-03)
+ 		;;
+ 	esac
+ 	;;
+-cmcc,rax3000m)
+-	case "$(cmdline_get_var root)" in
+-	/dev/mmc*)
+-		ubootenv_add_mmc_default
+-		;;
+-	*)
+-		ubootenv_add_ubi_default
+-		;;
+-	esac
+-	;;
+ comfast,cf-e393ax)
+ 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x80000"
+ 	;;
+diff --git a/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch b/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch
+index 972581fce7234..f056cbf3778a5 100644
+--- a/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch
++++ b/package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch
+@@ -485,7 +485,7 @@
+ +serverip=192.168.1.254
+ +loadaddr=0x46000000
+ +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
+-+bootargs=root=/dev/mmcblk0p65
+++bootargs=root=/dev/fit0 rootwait
+ +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
+ +bootconf=config-1#mt7981b-cmcc-rax3000m-emmc
+ +bootdelay=0
+diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
+index bfccc923a4961..e6b140bfadcce 100644
+--- a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
++++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
+@@ -7,6 +7,13 @@
+ 	compatible = "cmcc,rax3000m", "mediatek,mt7981";
+ 
+ 	fragment@0 {
++		target = <&chosen>;
++		__overlay__ {
++			rootdisk = <&emmc_rootdisk>;
++		};
++	};
++
++	fragment@1 {
+ 		target = <&gmac0>;
+ 		__overlay__ {
+ 			nvmem-cells = <&macaddr_factory_2a 0>;
+@@ -14,7 +21,7 @@
+ 		};
+ 	};
+ 
+-	fragment@1 {
++	fragment@2 {
+ 		target = <&gmac1>;
+ 		__overlay__ {
+ 			nvmem-cells = <&macaddr_factory_24 0>;
+@@ -22,7 +29,7 @@
+ 		};
+ 	};
+ 
+-	fragment@2 {
++	fragment@3 {
+ 		target = <&mmc0>;
+ 		__overlay__ {
+ 			bus-width = <8>;
+@@ -69,13 +76,17 @@
+ 								};
+ 							};
+ 						};
++
++						emmc_rootdisk: block-partition-production {
++							partname = "production";
++						};
+ 					};
+ 				};
+ 			};
+ 		};
+ 	};
+ 
+-	fragment@3 {
++	fragment@4 {
+ 		target = <&pio>;
+ 		__overlay__ {
+ 			mmc0_pins_default: mmc0-pins {
+@@ -94,7 +105,7 @@
+ 		};
+ 	};
+ 
+-	fragment@4 {
++	fragment@5 {
+ 		target = <&wifi>;
+ 		__overlay__ {
+ 			nvmem-cells = <&eeprom_factory_0>;
+diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
+index 3f401b53d342f..fded878332e24 100644
+--- a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
++++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
+@@ -7,6 +7,13 @@
+ 	compatible = "cmcc,rax3000m", "mediatek,mt7981";
+ 
+ 	fragment@0 {
++		target = <&chosen>;
++		__overlay__ {
++			rootdisk = <&ubi_rootdisk>;
++		};
++	};
++
++	fragment@1 {
+ 		target = <&gmac0>;
+ 		__overlay__ {
+ 			nvmem-cells = <&macaddr_factory_2a 0>;
+@@ -14,7 +21,7 @@
+ 		};
+ 	};
+ 
+-	fragment@1 {
++	fragment@2 {
+ 		target = <&gmac1>;
+ 		__overlay__ {
+ 			nvmem-cells = <&macaddr_factory_24 0>;
+@@ -22,7 +29,7 @@
+ 		};
+ 	};
+ 
+-	fragment@2 {
++	fragment@3 {
+ 		target = <&pio>;
+ 		__overlay__ {
+ 			spi0_flash_pins: spi0-pins {
+@@ -46,7 +53,7 @@
+ 		};
+ 	};
+ 
+-	fragment@3 {
++	fragment@4 {
+ 		target = <&spi0>;
+ 		__overlay__ {
+ 			pinctrl-names = "default";
+@@ -114,15 +121,22 @@
+ 					};
+ 
+ 					partition@580000 {
++						compatible = "linux,ubi";
+ 						label = "ubi";
+ 						reg = <0x580000 0x7200000>;
++
++						volumes {
++							ubi_rootdisk: ubi-volume-fit {
++								volname = "fit";
++							};
++						};
+ 					};
+ 				};
+ 			};
+ 		};
+ 	};
+ 
+-	fragment@4 {
++	fragment@5 {
+ 		target = <&wifi>;
+ 		__overlay__ {
+ 			nvmem-cells = <&eeprom_factory_0>;
+diff --git a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts
+index c8db5b58f5432..977a61333363c 100644
+--- a/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts
++++ b/target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts
+@@ -22,7 +22,8 @@
+ 		serial0 = &uart0;
+ 	};
+ 
+-	chosen {
++	chosen: chosen {
++		bootargs-override = "root=/dev/fit0 rootwait";
+ 		stdout-path = "serial0:115200n8";
+ 	};
+ 
+diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+index e059048d12952..3b1b2f7fa69ac 100755
+--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
++++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+@@ -86,6 +86,7 @@ platform_do_upgrade() {
+ 	bananapi,bpi-r3-mini|\
+ 	bananapi,bpi-r4|\
+ 	bananapi,bpi-r4-poe|\
++	cmcc,rax3000m|\
+ 	jdcloud,re-cp-03|\
+ 	mediatek,mt7988a-rfb|\
+ 	nokia,ea0326gmp|\
+@@ -96,18 +97,6 @@ platform_do_upgrade() {
+ 	xiaomi,redmi-router-ax6000-ubootmod)
+ 		fit_do_upgrade "$1"
+ 		;;
+-	cmcc,rax3000m)
+-		case "$(cmdline_get_var root)" in
+-		/dev/mmc*)
+-			CI_KERNPART="production"
+-			emmc_do_upgrade "$1"
+-			;;
+-		*)
+-			CI_KERNPART="fit"
+-			nand_do_upgrade "$1"
+-			;;
+-		esac
+-		;;
+ 	cudy,re3000-v1|\
+ 	cudy,wr3000-v1|\
+ 	yuncore,ax835)
+@@ -207,17 +196,11 @@ platform_check_image() {
+ 
+ platform_copy_config() {
+ 	case "$(board_name)" in
+-	cmcc,rax3000m)
+-		case "$(cmdline_get_var root)" in
+-		/dev/mmc*)
+-			emmc_copy_config
+-			;;
+-		esac
+-		;;
+ 	bananapi,bpi-r3|\
+ 	bananapi,bpi-r3-mini|\
+ 	bananapi,bpi-r4|\
+-	bananapi,bpi-r4-poe)
++	bananapi,bpi-r4-poe|\
++	cmcc,rax3000m)
+ 		if [ "$CI_METHOD" = "emmc" ]; then
+ 			emmc_copy_config
+ 		fi

+ 1 - 1
devices/qualcommax_ipq60xx/diy.sh

@@ -6,7 +6,7 @@ SHELL_FOLDER=$(dirname $(readlink -f "$0"))
 
 bash $SHELL_FOLDER/../common/kernel_6.1.sh
 
-rm -rf target/linux/qualcommax package/kernel/qca- package/boot/uboot-envtools package/firmware/ipq-wifi
+rm -rf target/linux/qualcommax package/kernel/qca-* devices/common/patches/qca-ssdk.patch package/boot/uboot-envtools package/firmware/ipq-wifi
 git_clone_path master https://github.com/coolsnowwolf/lede target/linux/qualcommax package/firmware/ipq-wifi package/boot/uboot-envtools package/qca
 
 sed -i "s/wpad-openssl/wpad-basic-mbedtls/" target/linux/qualcommax/Makefile

+ 0 - 396
devices/ramips_mt7620/patches/hiwifi_r33.patch

@@ -1,396 +0,0 @@
-From 72f3df2ae3d841447cba8188d48b90d91325b284 Mon Sep 17 00:00:00 2001
-From: zfdx123 <[email protected]>
-Date: Thu, 26 Jan 2023 12:49:13 +0800
-Subject: [PATCH] ramips: MT7620 add Support HiWiFi R33(C312B B52)
-
----
- .../generic/files/drivers/net/phy/rtl8367b.c  |   9 +
- .../linux/ramips/dts/mt7620a_hiwifi_r33.dts   | 235 ++++++++++++++++++
- target/linux/ramips/image/mt7620.mk           |  22 ++
- .../mt7620/base-files/etc/board.d/01_leds     |   3 +
- .../mt7620/base-files/etc/board.d/02_network  |  13 +
- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |  33 +++
- .../mt7620/base-files/lib/upgrade/platform.sh |   3 +
- 7 files changed, 318 insertions(+)
- create mode 100644 target/linux/ramips/dts/mt7620a_hiwifi_r33.dts
-
-diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c
-index 3599791a517b..6297e07628ba 100644
---- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c
-+++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c
-@@ -263,6 +263,8 @@ struct rtl8367b_initval {
- 	u16 val;
- };
- 
-+u32 rtl_device_id;
-+
- #define RTL8367B_MIB_RXB_ID		0	/* IfInOctets */
- #define RTL8367B_MIB_TXB_ID		28	/* IfOutOctets */
- 
-@@ -612,6 +614,10 @@ static int rtl8367b_write_initvals(struct rtl8366_smi *smi,
- 	int err;
- 	int i;
- 
-+	if (rtl_device_id == 0x0020) {
-+		return 0;
-+	}
-+
- 	for (i = 0; i < count; i++)
- 		REG_WR(smi, initvals[i].reg, initvals[i].val);
- 
-@@ -1540,7 +1546,10 @@ static int rtl8367b_detect(struct rtl8366_smi *smi)
- 		return ret;
- 	}
- 
-+	rtl_device_id = chip_ver;
-+
- 	switch (chip_ver) {
-+	case 0x0020:
- 	case 0x1000:
- 		chip_name = "8367RB";
- 		break;
-diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_r33.dts b/target/linux/ramips/dts/mt7620a_hiwifi_r33.dts
-new file mode 100644
-index 000000000000..6761b1b68a06
---- /dev/null
-+++ b/target/linux/ramips/dts/mt7620a_hiwifi_r33.dts
-@@ -0,0 +1,234 @@
-+#include "mt7620a.dtsi"
-+
-+#include <dt-bindings/gpio/gpio.h>
-+#include <dt-bindings/input/input.h>
-+
-+/ {
-+	compatible = "hiwifi,r33", "ralink,mt7620a-soc";
-+	model = "HiWiFi R33";
-+
-+	chosen {
-+		bootargs = "console=ttyS0,115200";
-+	};
-+
-+	aliases {
-+		led-boot = &led_system;
-+		led-failsafe = &led_system;
-+		led-running = &led_system;
-+		led-upgrade = &led_system;
-+	};
-+
-+	nand {
-+		status = "okay";
-+		#address-cells = <1>;
-+		#size-cells = <1>;
-+		compatible = "mtk,mt7620-nand";
-+
-+		partitions {
-+			compatible = "fixed-partitions";
-+			#address-cells = <1>;
-+			#size-cells = <1>;
-+
-+			partition@0 {
-+				label = "u-boot";
-+				reg = <0x0 0x80000>;
-+				read-only;
-+			};
-+
-+			partition@80000 {
-+				label = "debug";
-+				reg = <0x80000 0x80000>;
-+				read-only;
-+			};
-+
-+			factory: partition@100000 {
-+				label = "factory";
-+				reg = <0x100000 0x40000>;
-+				read-only;
-+			};
-+
-+			partition@140000 {
-+				label = "kernel";
-+				reg = <0x140000 0x400000>;
-+			};
-+
-+			ubiconcat0: partition@540000 {
-+				label = "ubiconcat0";
-+				reg = <0x540000 0x1c80000>;
-+			};
-+
-+			bdinfo: partition@21c0000 {
-+				label = "bdinfo";
-+				reg = <0x21c0000 0x80000>;
-+				read-only;
-+			};
-+
-+			ubiconcat1: partition@2240000 {
-+				label = "ubiconcat1";
-+				reg = <0x2240000 0x5dc0000>;
-+			};
-+		};
-+	};
-+
-+	ubi-concat {
-+		compatible = "mtd-concat";
-+		devices = <&ubiconcat0 &ubiconcat1>;
-+
-+		partitions {
-+			compatible = "fixed-partitions";
-+			#address-cells = <1>;
-+			#size-cells = <1>;
-+
-+			partition@0 {
-+				label = "ubi";
-+				reg = <0x0 0x7a40000>;
-+			};
-+		};
-+	};
-+
-+	leds {
-+		compatible = "gpio-leds";
-+
-+		wlan5g {
-+			label = "blue:wlan5g";
-+			gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
-+			linux,default-trigger = "phy0tpt";
-+		};
-+
-+		led_system: system {
-+			label = "blue:system";
-+			gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
-+		};
-+
-+		turbo {
-+			label = "blue:turbo";
-+			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
-+			linux,default-trigger = "none";
-+		};
-+
-+		wlan2g {
-+			label = "blue:wlan2g";
-+			gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
-+			linux,default-trigger = "phy1tpt";
-+		};
-+
-+		internet {
-+			label = "blue:internet";
-+			gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
-+		};
-+	};
-+
-+	keys {
-+		compatible = "gpio-keys";
-+
-+		reset {
-+			label = "reset";
-+			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-+			linux,code = <KEY_RESTART>;
-+		};
-+	};
-+
-+	gpio_export {
-+		compatible = "gpio-export";
-+		#size-cells = <0>;
-+
-+		usbpower {
-+			gpio-export,name = "usbpower";
-+			gpio-export,output = <0>;
-+			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
-+		};
-+	};
-+
-+	rtl8367rb {
-+		compatible = "realtek,rtl8367b", "rtl8367b";
-+		cpu_port = <6>;
-+		realtek,extif1 = <1 0 1 1 1 1 1 1 2>;
-+		mii-bus = <&mdio0>;
-+	};
-+};
-+
-+&gpio3 {
-+	status = "okay";
-+};
-+
-+&ehci {
-+	status = "okay";
-+};
-+
-+&ohci {
-+	status = "okay";
-+};
-+
-+&pcie {
-+	status = "okay";
-+};
-+
-+&gsw {
-+	mediatek,port4-gmac;
-+	mediatek,ephy-base = /bits/ 8 <12>;
-+};
-+
-+&ethernet {
-+	pinctrl-names = "default";
-+	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-+
-+	nvmem-cells = <&macaddr_bdinfo_18a>;
-+	nvmem-cell-names = "mac-address-ascii";
-+
-+	port@5 {
-+		status = "okay";
-+		mediatek,fixed-link = <1000 1 1 1>;
-+		phy-handle = <&phy5>;
-+		phy-mode = "rgmii";
-+	};
-+
-+	mdio0: mdio-bus {
-+		status = "okay";
-+
-+		phy5: ethernet-phy@5 {
-+			reg = <5>;
-+			phy-mode = "rgmii";
-+		};
-+	};
-+};
-+
-+&wmac {
-+	pinctrl-names = "default", "pa_gpio";
-+	pinctrl-0 = <&pa_pins>;
-+	pinctrl-1 = <&pa_gpio_pins>;
-+	ralink,mtd-eeprom = <&factory 0x0>;
-+
-+	nvmem-cells = <&macaddr_bdinfo_18a>;
-+	nvmem-cell-names = "mac-address-ascii";
-+	mac-address-increment = <1>;
-+};
-+
-+&pcie0 {
-+	wifi@0,0 {
-+		compatible = "pci14c3,7662";
-+		reg = <0x0000 0 0 0 0>;
-+		mediatek,mtd-eeprom = <&factory 0x8000>;
-+		ieee80211-freq-limit = <5000000 6000000>;
-+
-+		nvmem-cells = <&macaddr_bdinfo_18a>;
-+		nvmem-cell-names = "mac-address-ascii";
-+		mac-address-increment = <2>;
-+	};
-+};
-+
-+&state_default {
-+	gpio {
-+		groups = "uartf", "wled";
-+		function = "gpio";
-+	};
-+};
-+
-+&bdinfo {
-+        compatible = "nvmem-cells";
-+        #address-cells = <1>;
-+        #size-cells = <1>;
-+
-+        macaddr_bdinfo_18a: macaddr@18a {
-+                reg = <0x18a 0x11>;
-+        };
-+};
-diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
-index 631e5043f411..c68b9a69c60d 100644
---- a/target/linux/ramips/image/mt7620.mk
-+++ b/target/linux/ramips/image/mt7620.mk
-@@ -1338,3 +1338,25 @@ define Device/zyxel_keenetic-viva
-   SUPPORTED_DEVICES += kng_rc
- endef
- TARGET_DEVICES += zyxel_keenetic-viva
-+
-+
-+define Device/hiwifi_r33
-+  SOC := mt7620a
-+  DEVICE_VENDOR := HiWiFi
-+  DEVICE_MODEL := R33
-+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport \
-+	kmod-switch-rtl8366-smi kmod-switch-rtl8367b kmod-mt76x2
-+  BLOCKSIZE := 128k
-+  PAGESIZE := 2048
-+  KERNEL_SIZE := 4096k
-+  UBINIZE_OPTS := -E 5
-+  IMAGE_SIZE := 32768k
-+  IMAGES += kernel.bin rootfs.bin factory.bin
-+  IMAGE/kernel.bin := append-kernel | check-size $$$$(KERNEL_SIZE)
-+  IMAGE/rootfs.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
-+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
-+  IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
-+	check-size
-+  SUPPORTED_DEVICES += r33
-+endef
-+TARGET_DEVICES += hiwifi_r33
-\ No newline at end of file
-diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
-index 53487d752688..1240b0efdae4 100644
---- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
-+++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
-@@ -112,6 +112,9 @@ hiwifi,hc5761)
- hiwifi,hc5861)
- 	ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x20"
- 	;;
-+hiwifi,r33)
-+	ucidef_set_led_switch "internet" "internet" "blue:internet" "switch1" "0x01"
-+	;;
- hnet,c108)
- 	ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0"
- 	ucidef_set_led_netdev "modem" "modem" "green:modem" "wwan0"
-diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
-index 00ffb1b5420c..5f4e7268e8a9 100644
---- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
-+++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network
-@@ -156,6 +156,13 @@ ramips_setup_interfaces()
- 		ucidef_add_switch "switch0" \
- 			"0:lan" "1:lan" "5:wan" "6@eth0"
- 		;;
-+	hiwifi,r33)
-+		ucidef_add_switch "switch0" \
-+			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
-+		ucidef_add_switch_attr "switch0" "enable" "false"
-+		ucidef_add_switch "switch1" \
-+			"1:lan" "2:lan" "0:wan" "6@eth0"
-+		;;
- 	iodata,wn-ac1167gr|\
- 	iodata,wn-ac733gr3|\
- 	iptime,a1004ns)
-@@ -336,6 +343,12 @@ ramips_setup_macs()
- 		[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
- 		wan_mac=$(macaddr_add "$lan_mac" 1)
- 		;;
-+	hiwifi,r33)
-+		lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
-+		label_mac=$lan_mac
-+		[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
-+		wan_mac=$(macaddr_add "$lan_mac" 1)
-+		;;
- 	iodata,wn-ac1167gr|\
- 	iodata,wn-ac733gr3)
- 		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
-
---- a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
-+++ b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
-@@ -23,4 +23,11 @@ case "$board" in
- 		[ "$PHYNBR" = "0" ] && [ -n "$label_mac" ] && \
- 		macaddr_unsetbit "$label_mac" 6 > /sys${DEVPATH}/macaddress
- 		;;
-+	hiwifi,r33)
-+		label_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ")
-+		[ "$PHYNBR" = "1" ] && [ -n "$label_mac" ] && \
-+		echo -n "$label_mac" > /sys${DEVPATH}/macaddress
-+		[ "$PHYNBR" = "0" ] && [ -n "$label_mac" ] && \
-+		macaddr_unsetbit "$label_mac" 6 > /sys${DEVPATH}/macaddress
-+		;;
- esac
-diff --git a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh
-index 40272d4a744d..e4f83fd8ccb5 100755
---- a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh
-+++ b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh
-@@ -35,6 +35,9 @@ platform_do_upgrade() {
- 		dd if=/dev/mtd0 bs=64 count=1 2>/dev/null | grep -qi breed && CI_KERNPART_EXT="kernel_stock"
- 		nand_do_upgrade "$1"
- 		;;
-+	hiwifi,r33)
-+		nand_do_upgrade "$1"
-+		;;
- 	*)
- 		default_do_upgrade "$1"
- 		;;

+ 3 - 0
devices/rockchip_armv8/diy.sh

@@ -13,9 +13,12 @@ git_clone_path master https://github.com/immortalwrt/immortalwrt package/boot ta
 git_clone_path master https://github.com/immortalwrt/immortalwrt mv target/linux/generic
 
 git_clone_path master https://github.com/coolsnowwolf/lede target/linux/generic/hack-6.6
+rm -rf target/linux/generic/hack-6.6/767-net-phy-realtek*
 
 wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/generic/pending-6.6/613-netfilter_optional_tcp_window_check.patch -P target/linux/generic/pending-6.6/
 
+wget -N https://github.com/istoreos/istoreos/raw/istoreos-22.03/target/linux/rockchip/patches-5.10/304-r2s-pwm-fan.patch -P target/linux/rockchip/patches-6.6/
+
 wget -N https://github.com/immortalwrt/immortalwrt/raw/master/include/kernel-6.6 -P include/
 
 rm -rf target/linux/generic/hack-6.6/{410-block-fit-partition-parser.patch,724-net-phy-aquantia*,720-net-phy-add-aqr-phys.patch} package/network/utils/xdp-tools

+ 55 - 0
devices/rockchip_armv8/diy/target/linux/rockchip/patches-6.6/304-r4s-pwm-fan.patch

@@ -0,0 +1,55 @@
+From 930d10b5a37004c428ad1c9747a1424e85567e3f Mon Sep 17 00:00:00 2001
+From: jjm2473 <[email protected]>
+Date: Wed, 15 Mar 2023 16:18:26 +0800
+Subject: [PATCH] rockchip: add pwm-fan for R4S(E)
+
+---
+ .../boot/dts/rockchip/rk3399-nanopi-r4s.dts   | 36 +++++++++++++++++++
+ .../boot/dts/rockchip/rk3399-nanopi-r4se.dts  | 36 +++++++++++++++++++
+ 2 files changed, 72 insertions(+)
+
+--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
+@@ -69,6 +69,42 @@
+ 		regulator-always-on;
+ 		regulator-boot-on;
+ 	};
++
++        fan: pwm-fan {
++                compatible = "pwm-fan";
++                cooling-levels = <0 18 102 170 255>;
++                #cooling-cells = <2>;
++                fan-supply = <&vdd_5v>;
++                pwms = <&pwm1 0 50000 0>;
++        };
++};
++
++&cpu_thermal {
++        trips {
++                cpu_warm: cpu_warm {
++                        temperature = <55000>;
++                        hysteresis = <2000>;
++                        type = "active";
++                };
++
++                cpu_hot: cpu_hot {
++                        temperature = <65000>;
++                        hysteresis = <2000>;
++                        type = "active";
++                };
++        };
++
++        cooling-maps {
++                map2 {
++                        trip = <&cpu_warm>;
++                        cooling-device = <&fan THERMAL_NO_LIMIT 1>;
++                };
++
++                map3 {
++                        trip = <&cpu_hot>;
++                        cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
++                };
++        };
+ };
+ 
+ &emmc_phy {

+ 1 - 1
devices/rockchip_armv8/patches/22-H3399PC.patch

@@ -47,9 +47,9 @@ index 096692f4214..54df60aa350 100644
 +  rongpin-king3399-rk3399 \
 +  rocktech-mpc1903-rk3399 \
 +  sharevdi-h3399pc-rk3399 \
+   rock-pi-s-rk3308 \
    nanopi-r2c-rk3328 \
    nanopi-r2c-plus-rk3328 \
-   nanopi-r2s-rk3328 \
 diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
 index 7eb99ade652..92ede0f46e6 100644
 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network

+ 1 - 1
devices/x86_64/diy.sh

@@ -12,7 +12,7 @@ wget -N https://raw.githubusercontent.com/coolsnowwolf/lede/master/target/linux/
 
 sed -i 's/kmod-r8169/kmod-r8168/' target/linux/x86/image/64.mk
 
-sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-usb-hid kmod-mmc kmod-sdhci usbutils pciutils lm-sensors-detect kmod-alx kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8101 kmod-r8125 kmod-8139cp kmod-8139too kmod-i40e kmod-drm-i915 kmod-drm-amdgpu kmod-mlx4-core kmod-mlx5-core fdisk lsblk kmod-phy-broadcom/' target/linux/x86/Makefile
+sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += kmod-usb-hid kmod-mmc kmod-sdhci usbutils pciutils lm-sensors-detect kmod-alx kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-r8101 kmod-r8125 kmod-8139cp kmod-8139too kmod-i40e kmod-drm-i915 kmod-drm-amdgpu kmod-mlx4-core kmod-mlx5-core fdisk lsblk kmod-phy-broadcom kmod-ixgbevf/' target/linux/x86/Makefile
 
 mv -f tmp/r81* feeds/kiddin9/