kiddin9 3 лет назад
Родитель
Сommit
aae556d2da

+ 6 - 0
.github/workflows/Openwrt-AutoBuild.yml

@@ -80,6 +80,8 @@ jobs:
             echo "MTARGET=arm_cortex-a9_vfpv3-d16" >> $GITHUB_ENV
         elif [[ ${{matrix.target}} == "ipq806x_generic" ]]; then
             echo "MTARGET=arm_cortex-a15_neon-vfpv4" >> $GITHUB_ENV
+        elif [[ ${{matrix.target}} == "bcm27xx_bcm2708" ]]; then
+            echo "MTARGET=arm_arm1176jzf-s_vfp" >> $GITHUB_ENV
         else
           echo "ARCH=linux/arm64" >> $GITHUB_ENV
           if [[ ${{matrix.target}} == "bcm27xx_bcm2711" ]]; then
@@ -126,6 +128,9 @@ jobs:
     - name: Clone source code
       working-directory: /workdir
       run: |
+        if [[ ${{matrix.target}} == "ipq807x" ]];then
+            git clone https://github.com/robimarko/openwrt -b ipq807x-5.15-pr --depth 1
+        else
         REPO_BRANCH="$((curl -gs -H 'Content-Type: application/json' \
            -H "Authorization: Bearer ${{ secrets.REPO_TOKEN }}" \
            -X POST -d '{ "query": "query {repository(owner: \"openwrt\", name: \"openwrt\") {refs(refPrefix: \"refs/tags/\", last: 4, orderBy: {field: TAG_COMMIT_DATE, direction: ASC}) {edges {node {name}}}}}"}' https://api.github.com/graphql) | jq -r '.data.repository.refs.edges[].node.name' | grep v22 | tail -n 1)"
@@ -134,6 +139,7 @@ jobs:
           cd openwrt
           git checkout ${{ env.REPO_BRANCH }}
         fi
+        fi
         ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
         
     - name: Load custom configuration

+ 5 - 0
.github/workflows/repo-dispatcher.yml

@@ -80,6 +80,11 @@ jobs:
           -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
           -H "Accept: application/vnd.github.everest-preview+json" \
           -H "Authorization: token ${{ secrets.REPO_TOKEN }}" \
+          -d '{"event_type": "bcm27xx_bcm2708", "client_payload": {"target": "bcm27xx_bcm2708"}}'
+          curl \
+          -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \
+          -H "Accept: application/vnd.github.everest-preview+json" \
+          -H "Authorization: token ${{ secrets.REPO_TOKEN }}" \
           -d '{"event_type": "armvirt_64", "client_payload": {"target": "armvirt_64"}}'
           curl \
           -X POST https://api.github.com/repos/${{ github.repository }}/dispatches \

+ 1 - 2
devices/armvirt_64/diy/target/linux/armvirt/image/Makefile

@@ -132,8 +132,7 @@ define Image/Build
 	elif [ $(PROFILE_SANITIZED) == "hk1" ]; then \
 		./mk_s905x3_multi.sh; \
 	fi; \
-	gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).img || true; \
-	rm -f $(BIN_DIR)/*.tar.gz
+	gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).img || true
 endef
 
 $(eval $(call BuildImage))

+ 9 - 0
devices/bcm27xx_bcm2708/.config

@@ -0,0 +1,9 @@
+
+CONFIG_TARGET_bcm27xx=y
+CONFIG_TARGET_bcm27xx_bcm2708=y
+CONFIG_TARGET_MULTI_PROFILE=y
+CONFIG_TARGET_DEVICE_bcm27xx_bcm2708_DEVICE_rpi=y
+
+CONFIG_PACKAGE_luci-ssl=n # uhttpd服务
+CONFIG_PACKAGE_luci-ssl-nginx=y # nginx
+

+ 14 - 0
devices/bcm27xx_bcm2708/diy.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += autocore-arm fdisk lsblk luci-app-cpufreq kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152 kmod-usb2 automount/' target/linux/bcm27xx/Makefile
+
+sed -i 's/factory.img.gz //' target/linux/bcm27xx/image/Makefile
+
+SHELL_FOLDER=$(dirname $(readlink -f "$0"))
+bash $SHELL_FOLDER/../common/kernel_5.15.sh
+
+echo '
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+' >> ./target/linux/bcm27xx/bcm2708/config-5.15

+ 6 - 0
devices/common/.config

@@ -33,6 +33,12 @@ CONFIG_PACKAGE_luci-theme-bootstrap=y
 
 # 其他需要安装的软件包:
 
+CONFIG_PACKAGE_rpcd=y
+CONFIG_PACKAGE_rpcd-mod-file=y
+CONFIG_PACKAGE_rpcd-mod-iwinfo=y
+CONFIG_PACKAGE_rpcd-mod-luci=y
+CONFIG_PACKAGE_rpcd-mod-rrdns=y
+
 CONFIG_PACKAGE_dnsmasq=n
 CONFIG_PACKAGE_dnsmasq-full=y
 CONFIG_PACKAGE_dnsmasq_full_dhcp=y

+ 1 - 1
devices/common/diy.sh

@@ -24,7 +24,7 @@ sed -i "s/^.*vermagic$/\techo '1' > \$(LINUX_DIR)\/.vermagic/" include/kernel-de
 ./scripts/feeds install -a
 cd feeds/kiddin9; git pull; cd -
 
-mv -f feeds/kiddin9/{r81*,igb-intel} tmp/
+mv -f feeds/kiddin9/{r81*,igb-intel,rtl8189es} tmp/
 
 sed -i "s/192.168.1/10.0.0/" package/feeds/kiddin9/base-files/files/bin/config_generate
 

+ 0 - 4
devices/common/kernel_5.15.sh

@@ -15,14 +15,11 @@ kernel_v="$(cat include/kernel-5.15 | grep LINUX_KERNEL_HASH-* | cut -f 2 -d - |
 echo "KERNEL=${kernel_v}" >> $GITHUB_ENV || true
 sed -i "s?targets/%S/.*'?targets/%S/$kernel_v'?" include/feeds.mk
 
-rm -rf target/linux/generic/pending-5.15/444-mtd-nand-rawnand-add-support-for-Toshiba-TC58NVG0S3H.patch
-
 sh -c "curl -sfL https://github.com/coolsnowwolf/lede/commit/06fcdca1bb9c6de6ccd0450a042349892b372220.patch | patch -d './' -p1 --forward"
 svn export --force https://github.com/openwrt/packages/trunk/kernel feeds/packages/kernel
 svn export --force  https://github.com/openwrt/packages/trunk/net/xtables-addons feeds/packages/net/xtables-addons
 
 svn co https://github.com/coolsnowwolf/lede/trunk/target/linux/generic/hack-5.15 target/linux/generic/hack-5.15
-rm -rf target/linux/generic/hack-5.15/{220-gc_sections*,781-dsa-register*,780-drivers-net*}
 curl -sfL https://raw.githubusercontent.com/openwrt/openwrt/openwrt-22.03/package/kernel/linux/modules/video.mk -o package/kernel/linux/modules/video.mk
 
 sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/inittab
@@ -30,6 +27,5 @@ sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/
 echo "
 CONFIG_TESTING_KERNEL=y
 CONFIG_PACKAGE_kmod-ipt-coova=n
-CONFIG_PACKAGE_kmod-usb-serial-xr_usb_serial_common=n
 CONFIG_PACKAGE_kmod-pf-ring=n
 " >> devices/common/.config

+ 1 - 0
devices/ipq40xx_generic/.config

@@ -12,6 +12,7 @@ CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_linksys_ea6350v3=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_glinet_gl-ap1300=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_linksys_ea8300=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_linksys_mr8300=y
+CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_mobipromo_cm520-79f=y
 
 CONFIG_PACKAGE_luci-ssl=y # uhttpd服务
 

+ 4 - 7
devices/ipq807x/.config

@@ -5,15 +5,12 @@ CONFIG_TARGET_MULTI_PROFILE=y
 CONFIG_TARGET_DEVICE_ipq807x_generic_DEVICE_redmi_ax6=y
 CONFIG_TARGET_DEVICE_ipq807x_generic_DEVICE_xiaomi_ax3600=y
 CONFIG_TARGET_DEVICE_ipq807x_generic_DEVICE_xiaomi_ax9000=y
+CONFIG_TARGET_DEVICE_ipq807x_generic_DEVICE_qnap_301w=y
+CONFIG_TARGET_DEVICE_ipq807x_generic_DEVICE_zte_mf269=y
 
 CONFIG_PACKAGE_luci-ssl=y # uhttpd服务
 
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE_DRV=n
-CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_SHORTCUT_FE=y
-
-CONFIG_PACKAGE_kmod-qca-mcs=n
-CONFIG_PACKAGE_kmod-qca-nss-drv-qdisc=n
-CONFIG_PACKAGE_kmod-qca-nss-ecm=n
 CONFIG_PACKAGE_kmod-qca-nss-crypto=n
-CONFIG_PACKAGE_kmod-switch-ar8xxx=n
+CONFIG_PACKAGE_kmod-fs-antfs=n
+CONFIG_PACKAGE_kmod-ath11k-pci=n
 

+ 7 - 30
devices/ipq807x/diy.sh

@@ -2,42 +2,19 @@
 shopt -s extglob
 
 SHELL_FOLDER=$(dirname $(readlink -f "$0"))
-bash $SHELL_FOLDER/../common/kernel_5.15.sh
-	
-rm -rf package/boot/uboot-envtools package/firmware/ipq-wifi package/firmware/ath11k* package/qca package/qat target/linux/generic package/kernel/mac80211
-
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/boot/uboot-envtools package/boot/uboot-envtools
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/firmware/ipq-wifi package/firmware/ipq-wifi
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/firmware/ath11k-board package/firmware/ath11k-board
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/firmware/ath11k-firmware package/firmware/ath11k-firmware
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/qca package/qca
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/qat package/qat
-
-svn export --force https://github.com/Boos4721/openwrt/trunk/package/boot/uboot-envtools package/boot/uboot-envtools
-curl -sfL https://raw.githubusercontent.com/Boos4721/openwrt/master/package/kernel/linux/modules/netsupport.mk -o package/kernel/linux/modules/netsupport.mk
-
-function git_sparse_clone() (
-          commitid="$1" rurl="$2" localdir="$3" && shift 3
-          git clone --filter=blob:none --sparse $rurl $localdir
-          cd $localdir
-		  git checkout $commitid
-          git sparse-checkout init --cone
-          git sparse-checkout set $@
-          )
-
-git_sparse_clone 0890af20fadfd30b9e201fc7c279cdcabf2120f1 "https://github.com/Boos4721/openwrt" "boos" target/linux/ipq807x target/linux/generic include package/kernel/mac80211
-cp -rf boos/target/linux/ipq807x target/linux/
-cp -rf boos/target/linux/generic target/linux/
-cp -rf boos/package/kernel/mac80211 package/kernel/
-cp -rf boos/include/kernel-5.15.mk include/kernel-5.15
 
 kernel_v="$(cat include/kernel-5.15 | grep LINUX_KERNEL_HASH-* | cut -f 2 -d - | cut -f 1 -d ' ')"
 echo "KERNEL=${kernel_v}" >> $GITHUB_ENV || true
 sed -i "s?targets/%S/.*'?targets/%S/$kernel_v'?" include/feeds.mk
 
-curl -sfL https://raw.githubusercontent.com/Lstions/openwrt-boos/master/target/linux/ipq807x/patches-5.15/608-5.15-qca-nss-ssdk-delete-fdb-entry-using-netdev -o target/linux/ipq807x/patches-5.15/608-5.15-qca-nss-ssdk-delete-fdb-entry-using-netdev.patch
+svn co https://github.com/coolsnowwolf/lede/trunk/target/linux/generic/hack-5.15 target/linux/generic/hack-5.15
+sh -c "curl -sfL https://github.com/coolsnowwolf/lede/commit/06fcdca1bb9c6de6ccd0450a042349892b372220.patch | patch -d './' -p1 --forward"
+rm -rf package/kernel/mt76
 
-sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += luci-app-turboacc/' target/linux/ipq807x/Makefile
+echo "
+CONFIG_PACKAGE_kmod-ipt-coova=n
+CONFIG_PACKAGE_kmod-pf-ring=n
+" >> devices/common/.config
 
 echo '
 CONFIG_CPU_FREQ_GOV_USERSPACE=y

+ 5 - 0
devices/ipq807x/feeds.conf

@@ -0,0 +1,5 @@
+src-git packages https://git.openwrt.org/feed/packages.git;openwrt-22.03
+src-git luci https://git.openwrt.org/project/luci.git;openwrt-22.03
+src-git routing https://git.openwrt.org/feed/routing.git;openwrt-22.03
+src-git-full nss_packages https://github.com/robimarko/nss-packages.git
+src-git kiddin9 https://github.com/kiddin9/openwrt-packages.git;master

+ 31 - 0
devices/ipq807x/patches/default_packages.patch

@@ -0,0 +1,31 @@
+--- a/target/linux/ipq807x/Makefile
++++ b/target/linux/ipq807x/Makefile
+@@ -12,7 +12,7 @@ KERNEL_PATCHVER:=5.15
+ 
+ include $(INCLUDE_DIR)/target.mk
+ DEFAULT_PACKAGES += \
+-	kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom \
++	autocore-arm luci-app-cpufreq kmod-qca-nss-drv kmod-qca-nss-dp nss-firmware-ipq8074 qca-ssdk-shell \
+ 	kmod-leds-gpio kmod-gpio-button-hotplug \
+ 	ath11k-firmware-ipq8074 kmod-ath11k-ahb \
+ 	wpad-basic-wolfssl uboot-envtools
+
+--- a/target/linux/ipq807x/image/generic.mk
++++ b/target/linux/ipq807x/image/generic.mk
+@@ -61,7 +61,7 @@ define Device/qnap_301w
+ 	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
+-	DEVICE_PACKAGES := ipq-wifi-qnap_301w e2fsprogs kmod-fs-ext4 losetup
++	DEVICE_PACKAGES := ipq-wifi-qnap_301w e2fsprogs kmod-fs-ext4 losetup kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom
+ endef
+ TARGET_DEVICES += qnap_301w
+ 
+@@ -95,6 +95,6 @@ define Device/xiaomi_ax9000
+ 	PAGESIZE := 2048
+ 	DEVICE_DTS_CONFIG := config@hk14
+ 	SOC := ipq8072
+-	DEVICE_PACKAGES := ipq-wifi-xiaomi_ax9000 kmod-ath10k-ct ath10k-firmware-qca9887-ct
++	DEVICE_PACKAGES := ipq-wifi-xiaomi_ax9000 kmod-ath10k-ct ath10k-firmware-qca9887-ct kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom
+ endef
+ TARGET_DEVICES += xiaomi_ax9000

+ 0 - 20
devices/ipq807x/patches/modules.patch

@@ -1,20 +0,0 @@
---- a/package/kernel/linux/modules/other.mk
-+++ b/package/kernel/linux/modules/other.mk
-@@ -1322,3 +1322,17 @@ define KernelPackage/mhi-pci-generic/description
- endef
- 
- $(eval $(call KernelPackage,mhi-pci-generic))
-+
-+define KernelPackage/qcom-qmi-helpers
-+  SUBMENU:=$(OTHER_MENU)
-+  TITLE:=Qualcomm QMI Helpers
-+  KCONFIG:=CONFIG_QCOM_QMI_HELPERS
-+  FILES:=$(LINUX_DIR)/drivers/soc/qcom/qmi_helpers.ko
-+  AUTOLOAD:=$(call AutoProbe,qmi_helpers)
-+endef
-+
-+define KernelPackage/qcom-qmi-helpers/description
-+  Qualcomm QMI Helpers
-+endef
-+
-+$(eval $(call KernelPackage,qcom-qmi-helpers))

+ 3 - 0
devices/mediatek_mt7622/.config

@@ -3,6 +3,9 @@ CONFIG_TARGET_mediatek=y
 CONFIG_TARGET_mediatek_mt7622=y
 CONFIG_TARGET_MULTI_PROFILE=y
 CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_xiaomi_redmi-router-ax6s=y
+CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_linksys_e8450=y
+CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_linksys_e8450-ubi=y
+CONFIG_TARGET_DEVICE_mediatek_mt7622_DEVICE_ruijie_rg-ew3200gx-pro=y
 
 CONFIG_PACKAGE_luci-ssl=y # uhttpd服务
 

+ 1 - 0
devices/ramips_mt7620/.config

@@ -12,6 +12,7 @@ CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_lenovo_newifi-y1s=y
 CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_xiaomi_miwifi-mini=y
 CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_youku_yk-l1=y
 CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_youku_yk-l1c=y
+CONFIG_TARGET_DEVICE_ramips_mt7620_DEVICE_xiaomi_miwifi-r3=y
 
 CONFIG_PACKAGE_luci-ssl=y # uhttpd服务
 

+ 316 - 0
devices/ramips_mt7620/patches/mir3.patch

@@ -0,0 +1,316 @@
+From aa2cc7b9d5124216f0ea377f9ffe28e494da20c6 Mon Sep 17 00:00:00 2001
+From: Chen Minqiang <[email protected]>
+Date: Sat, 18 Nov 2017 21:35:39 +0800
+Subject: [PATCH] ramips: add xiaomi_miwifi-r3 support
+
+Specification:
+ - CPU: 580 MHz
+ - Flash size: 128 MiB NAND
+ - RAM size: 128 MiB DDR2
+ - Wireless No1: SoC-integrated: MT7620A 2x2 MIMO 802.11b/g/n (2.4 GHz)
+ - Wireless No2: On-board chip: MT7612E 2x2 MIMO 802.11a/n/ac (5 GHz)
+ - Switch: MT7620 built-in 10/100 switch w/ vlan support
+ - USB: 2.0 x1
+
+Flash instructions:
+ 1. access ssh via https://wiki.openwrt.org/toh/xiaomi/mir3
+ 2. in ssh:
+      nvram set flag_last_success=1
+      nvram set boot_wait=on
+      nvram set uart_en=1
+      nvram commit
+      mtd write lede-ramips-mt7620-miwifi-r3-squashfs-kernel1.bin kernel1
+      mtd write lede-ramips-mt7620-miwifi-r3-squashfs-rootfs0.bin rootfs0
+      reboot
+
+If you want to revert back to stock fw while on LEDE:
+  insert usb stick (FAT/FAT32) with stock fw renamed to miwifi.bin
+  fw_setenv flag_last_success 0
+  power off the device
+  hold the reset button and power on the device, keep holding the reset button until yellow led starts blinking.
+
+Signed-off-by: Chen Minqiang <[email protected]>
+---
+ package/boot/uboot-envtools/files/ramips      |   1 +
+ .../ramips/dts/mt7620a_xiaomi_miwifi-r3.dts   | 187 ++++++++++++++++++
+ target/linux/ramips/image/mt7620.mk           |  17 ++
+ .../mt7620/base-files/etc/board.d/02_network  |   8 +
+ .../mt7620/base-files/lib/upgrade/platform.sh |   7 +
+ 5 files changed, 220 insertions(+)
+ create mode 100644 target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts
+
+diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
+index 05ca7ffd12c8..6afc4470f7a7 100644
+--- a/package/boot/uboot-envtools/files/ramips
++++ b/package/boot/uboot-envtools/files/ramips
+@@ -79,6 +79,7 @@ xiaomi,mi-router-3g|\
+ xiaomi,mi-router-3-pro|\
+ xiaomi,mi-router-4|\
+ xiaomi,mi-router-ac2100|\
++xiaomi,miwifi-r3|\
+ xiaomi,redmi-router-ac2100)
+ 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
+ 	ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x4000" "0x20000"
+diff --git a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts
+new file mode 100644
+index 000000000000..301b6e3a02e6
+--- /dev/null
++++ b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts
+@@ -0,0 +1,187 @@
++/dts-v1/;
++
++#include "mt7620a.dtsi"
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++
++/ {
++	compatible = "xiaomi,miwifi-r3", "ralink,mt7620a-soc";
++	model = "Xiaomi Mi Router R3";
++
++	aliases {
++		led-status = &led_status_blue;
++	};
++
++	chosen {
++		bootargs = "console=ttyS0,115200";
++	};
++
++	keys {
++		compatible = "gpio-keys";
++
++		reset {
++			label = "reset";
++			gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
++			linux,code = <KEY_RESTART>;
++		};
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		led_status_blue: blue {
++			label = "blue:status";
++			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
++			default-state = "on";
++		};
++
++		yellow {
++			label = "yellow:status";
++			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
++		};
++
++		red {
++			label = "red:status";
++			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
++		};
++	};
++
++	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 = "Bootloader";
++				reg = <0x0 0x40000>;
++				read-only;
++			};
++
++			partition@40000 {
++				label = "Config";
++				reg = <0x40000 0x40000>;
++			};
++
++			partition@80000 {
++				label = "Bdata";
++				reg = <0x80000 0x40000>;
++				read-only;
++			};
++
++			factory: partition@0xc0000 {
++				label = "factory";
++				reg = <0xc0000 0x40000>;
++				read-only;
++			};
++
++			partition@100000 {
++				label = "crash";
++				reg = <0x100000 0x40000>;
++				read-only;
++			};
++
++			partition@140000 {
++				label = "crash_syslog";
++				reg = <0x140000 0x40000>;
++				read-only;
++			};
++
++			partition@180000 {
++				label = "reserved0";
++				reg = <0x180000 0x80000>;
++				read-only;
++			};
++
++			partition@200000 {
++				label = "kernel_stock";
++				reg = <0x200000 0x400000>;
++			};
++
++			partition@600000 {
++				label = "kernel";
++				reg = <0x600000 0x400000>;
++			};
++
++			/* ubi partition is the result of squashing
++			 * next consequent stock partitions:
++			 * - rootfs0 (rootfs partition for stock kernel0),
++			 * - rootfs1 (rootfs partition for stock failsafe kernel1),
++			 * - overlay (used as ubi overlay in stock fw)
++			 * resulting 117,5MiB space for packages.
++			 */
++			partition@a00000 {
++				label = "ubi";
++				reg = <0xa00000 0x7600000>;
++			};
++		};
++	};
++};
++
++&gpio1 {
++	status = "okay";
++};
++
++&ehci {
++	status = "okay";
++};
++
++&ohci {
++	status = "okay";
++};
++
++&ethernet {
++	pinctrl-names = "default";
++	pinctrl-0 = <&ephy_pins>;
++	mtd-mac-address = <&factory 0x28>;
++	nvmem-cells = <&macaddr_factory_28>;
++	nvmem-cell-names = "mac-address";
++	mediatek,portmap = "llllw";
++};
++
++&wmac {
++	ralink,mtd-eeprom = <&factory 0>;
++};
++
++&pcie {
++	status = "okay";
++};
++
++&pcie0 {
++	wifi@0,0 {
++		compatible = "pci14c3,7662";
++		reg = <0x0000 0 0 0 0>;
++		mediatek,mtd-eeprom = <&factory 0x8000>;
++		ieee80211-freq-limit = <5000000 6000000>;
++	};
++};
++
++&pinctrl {
++	state_default: pinctrl0 {
++		gpio {
++			groups = "rgmii1";
++			function = "gpio";
++		};
++
++		pa {
++			groups = "pa";
++			function = "pa";
++		};
++	};
++};
++
++&factory {
++	compatible = "nvmem-cells";
++	#address-cells = <1>;
++	#size-cells = <1>;
++
++	macaddr_factory_28: macaddr@28 {
++		reg = <0x28 0x6>;
++	};
++};
+diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
+index a9dea1db57f9..ebf4cfc4117c 100644
+--- a/target/linux/ramips/image/mt7620.mk
++++ b/target/linux/ramips/image/mt7620.mk
+@@ -1248,6 +1248,23 @@ define Device/xiaomi_miwifi-mini
+ endef
+ TARGET_DEVICES += xiaomi_miwifi-mini
+ 
++define Device/xiaomi_miwifi-r3
++  SOC := mt7620a
++  BLOCKSIZE := 128k
++  PAGESIZE := 2048
++  KERNEL_SIZE := 4096k
++  IMAGE_SIZE := 32768k
++  UBINIZE_OPTS := -E 5
++  IMAGES += kernel1.bin rootfs0.bin
++  IMAGE/kernel1.bin := append-kernel | check-size $$$$(KERNEL_SIZE)
++  IMAGE/rootfs0.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
++  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
++  DEVICE_VENDOR := Xiaomi
++  DEVICE_MODEL := Mi Router R3
++  DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci uboot-envtools
++endef
++TARGET_DEVICES += xiaomi_miwifi-r3
++
+ define Device/youku_yk-l1
+   SOC := mt7620a
+   IMAGE_SIZE := 32448k
+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 f7bc41669f80..e252b6e04611 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
+@@ -240,6 +240,10 @@ ramips_setup_interfaces()
+ 		ucidef_add_switch "switch0" \
+ 			"0:lan" "1:lan" "4:wan" "6@eth0"
+ 		;;
++	xiaomi,miwifi-r3)
++		ucidef_add_switch "switch0" \
++			"1:lan" "4:lan" "0:wan" "6@eth0"
++		;;
+ 	zbtlink,zbt-we1026-5g-16m)
+ 		ucidef_add_switch "switch0" \
+ 			"0:lan" "6t@eth0"
+@@ -384,6 +388,10 @@ ramips_setup_macs()
+ 		wan_mac=$(mtd_get_mac_binary factory 0x2e)
+ 		label_mac=$(mtd_get_mac_binary factory 0x8004)
+ 		;;
++	xiaomi,miwifi-r3)
++		wan_mac=$(mtd_get_mac_binary factory 0x28)
++		lan_mac=$(macaddr_setbit_la "$wan_mac")
++		;;
+ 	zbtlink,zbt-we1026-5g-16m)
+ 		label_mac=$(mtd_get_mac_binary factory 0x4)
+ 		;;
+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 9f71dc918e50..5519312289fa 100755
+--- a/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh
++++ b/target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh
+@@ -30,6 +30,11 @@ platform_do_upgrade() {
+ 		}
+ 		default_do_upgrade "$1"
+ 		;;
++	xiaomi,miwifi-r3)
++		# this make it compatible with breed
++		dd if=/dev/mtd0 bs=64 count=1 2>/dev/null | grep -qi breed && CI_KERNPART_EXT="kernel_stock"
++		nand_do_upgrade "$1"
++		;;
+ 	*)
+ 		default_do_upgrade "$1"
+ 		;;

+ 3 - 0
devices/ramips_mt7621/.config

@@ -7,6 +7,7 @@ CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_mi-router-cr660x=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_mi-router-3g=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_mi-router-3-pro=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_mi-router-4=y
+CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_mi-router-4a-gigabit=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_redmi-router-ac2100=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaomi_mi-router-ac2100=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_xiaoyu_xy-c5=y
@@ -26,6 +27,8 @@ CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_netgear_r7450=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_jcg_y2=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_jcg_q20=y
 CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_gehua_ghl-r-001=y
+CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_raisecom_msg1500-x-00=y
+CONFIG_TARGET_DEVICE_ramips_mt7621_DEVICE_zte_e8820s=y
 
 CONFIG_PACKAGE_luci-ssl=y # uhttpd服务
 

+ 257 - 0
devices/ramips_mt7621/patches/zte_e8820s.patch

@@ -0,0 +1,257 @@
+From a3c941d1267229a71da2a5cde5055698eadc0fd0 Mon Sep 17 00:00:00 2001
+From: coolsnowwolf <[email protected]>
+Date: Sat, 4 Sep 2021 15:23:48 +0800
+Subject: [PATCH] ramips: add ZTE e8820s support
+
+---
+ target/linux/ramips/dts/mt7621_zte_e8820s.dts | 197 ++++++++++++++++++
+ target/linux/ramips/image/mt7621.mk           |  18 ++
+ .../mt7621/base-files/etc/board.d/01_leds     |   6 +
+ 3 files changed, 221 insertions(+)
+ create mode 100644 target/linux/ramips/dts/mt7621_zte_e8820s.dts
+
+diff --git a/target/linux/ramips/dts/mt7621_zte_e8820s.dts b/target/linux/ramips/dts/mt7621_zte_e8820s.dts
+new file mode 100644
+index 000000000000..5a0012441509
+--- /dev/null
++++ b/target/linux/ramips/dts/mt7621_zte_e8820s.dts
+@@ -0,0 +1,197 @@
++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
++
++#include "mt7621.dtsi"
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++
++/ {
++	compatible = "zte,e8820s", "mediatek,mt7621-soc";
++	model = "ZTE E8820S";
++
++	aliases {
++		led-boot = &led_sys;
++		led-failsafe = &led_sys;
++		led-running = &led_power;
++		led-upgrade = &led_power;
++		label-mac-device = &gmac0;
++	};
++
++	chosen {
++		bootargs = "console=ttyS0,115200";
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		led_power: power {
++			label = "white:power";
++			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
++		};
++
++		led_sys: sys {
++			label = "white:sys";
++			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
++		};
++
++		wlan2g {
++			label = "white:wlan2g";
++			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
++		};
++
++		wlan5g {
++			label = "white:wlan5g";
++			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
++		};
++	};
++
++	keys {
++		compatible = "gpio-keys";
++
++		reset {
++			label = "reset";
++			gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
++			linux,code = <KEY_RESTART>;
++		};
++
++		wps {
++			label = "wps";
++			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
++			linux,code = <KEY_WPS_BUTTON>;
++		};
++
++		wifi {
++			label = "wifi";
++			gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
++			linux,code = <KEY_RFKILL>;
++		};
++	};
++
++	ubi-concat {
++		compatible = "mtd-concat";
++		devices = <&ubipart0 &ubipart1>;
++
++		partitions {
++			compatible = "fixed-partitions";
++			#address-cells = <1>;
++			#size-cells = <1>;
++
++			ubi@0 {
++				label = "ubi";
++				reg = <0x0 0x79c0000>;
++			};
++		};
++	};
++};
++
++&nand {
++	status = "okay";
++
++	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>;
++		};
++
++		ubipart0: partition@540000 {
++			label = "ubipart0";
++			reg = <0x540000 0x1c80000>;
++		};
++
++		partition@21c0000 {
++			label = "bdinfo";
++			reg = <0x21c0000 0x80000>;
++			read-only;
++		};
++
++		ubipart1: partition@2240000 {
++			label = "ubipart1";
++			reg = <0x2240000 0x5d40000>;
++		};
++	};
++};
++
++&pcie {
++	status = "okay";
++};
++
++&pcie0 {
++	wifi@0,0 {
++		compatible = "pci14c3,7603";
++		reg = <0x0000 0 0 0 0>;
++		mediatek,mtd-eeprom = <&factory 0x0000>;
++		ieee80211-freq-limit = <2400000 2500000>;
++	};
++};
++
++&pcie1 {
++	wifi@0,0 {
++		compatible = "pci14c3,7662";
++		reg = <0x0000 0 0 0 0>;
++		mediatek,mtd-eeprom = <&factory 0x8000>;
++		ieee80211-freq-limit = <5000000 6000000>;
++	};
++};
++
++&gmac0 {
++	mtd-mac-address = <&factory 0xe006>;
++};
++
++&switch0 {
++	ports {
++		port@0 {
++			status = "okay";
++			label = "lan1";
++		};
++
++		port@1 {
++			status = "okay";
++			label = "lan2";
++		};
++
++		port@2 {
++			status = "okay";
++			label = "lan3";
++		};
++
++		port@3 {
++			status = "okay";
++			label = "lan4";
++		};
++
++		port@4 {
++			status = "okay";
++			label = "wan";
++			mtd-mac-address = <&factory 0xe000>;
++		};
++	};
++};
++
++&state_default {
++	gpio {
++		groups = "jtag", "uart2", "uart3", "wdt";
++		function = "gpio";
++	};
++};
+diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
+index f563ebd28899..6a48655b0054 100644
+--- a/target/linux/ramips/image/mt7621.mk
++++ b/target/linux/ramips/image/mt7621.mk
+@@ -1726,3 +1726,22 @@ define Device/zyxel_wap6805
+   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ endef
+ TARGET_DEVICES += zyxel_wap6805
++
++define Device/zte_e8820s
++  $(Device/dsa-migration)
++  $(Device/uimage-lzma-loader)
++  BLOCKSIZE := 128k
++  PAGESIZE := 2048
++  KERNEL_SIZE := 4096k
++  UBINIZE_OPTS := -E 5
++  IMAGE_SIZE := 32768k
++  IMAGES += factory.bin
++  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
++  IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
++	check-size
++  DEVICE_VENDOR := ZTE
++  DEVICE_MODEL := E8820S
++  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \
++	kmod-usb-ledtrig-usbport
++endef
++TARGET_DEVICES += zte_e8820s
+diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+index ad15b6401eb9..6fe6327dd324 100644
+--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
++++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+@@ -125,6 +125,10 @@ xiaomi,redmi-router-ac2100)
+ youhua,wr1200js)
+ 	ucidef_set_led_netdev "internet" "INTERNET" "green:wan" "wan"
+ 	;;
++zte,e8820s)
++	ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "white:wlan2g" "ra0"
++	ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "white:wlan5g" "rai0"
++	;;	
+ esac
+ 
+ board_config_flush

+ 11 - 0
devices/sunxi_cortexa53/patches/r1s-h5.patch

@@ -0,0 +1,11 @@
+--- a/target/linux/sunxi/image/cortexa53.mk
++++ b/target/linux/sunxi/image/cortexa53.mk
+@@ -43,7 +43,7 @@ TARGET_DEVICES += friendlyarm_nanopi-neo2
+ define Device/friendlyarm_nanopi-r1s-h5
+   DEVICE_VENDOR := FriendlyARM
+   DEVICE_MODEL := Nanopi R1S H5
+-  DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-usb-net-rtl8152
++  DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-usb-net-rtl8152 kmod-rtl8189es
+   SUPPORTED_DEVICES:=nanopi-r1s-h5
+   $(Device/sun50i-h5)
+ endef

+ 1 - 1
devices/x86_64/diy.sh

@@ -6,7 +6,7 @@ bash $SHELL_FOLDER/../common/kernel_5.15.sh
 svn co https://github.com/coolsnowwolf/lede/trunk/target/linux/x86/patches-5.15 target/linux/x86/patches-5.15
 rm -rf target/linux/x86/patches-5.15/.svn
 
-sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += autocore-x86 lm-sensors-detect kmod-alx kmod-r8125 kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-8139cp kmod-8139too kmod-i40e kmod-drm-i915 kmod-mlx4-core kmod-mlx5-core kmod-usb2 kmod-usb3 fdisk lsblk/' target/linux/x86/Makefile
+sed -i 's/DEFAULT_PACKAGES +=/DEFAULT_PACKAGES += autocore-x86 lm-sensors-detect kmod-alx kmod-r8125 kmod-vmxnet3 kmod-igbvf kmod-iavf kmod-bnx2x kmod-pcnet32 kmod-tulip kmod-8139cp kmod-8139too kmod-i40e kmod-drm-i915 kmod-i915-gvt kmod-mlx4-core kmod-mlx5-core kmod-usb2 kmod-usb3 fdisk lsblk/' target/linux/x86/Makefile
 sed -i 's/kmod-igb /kmod-igb-intel /' target/linux/x86/image/64.mk
 
 mv -f tmp/{r81*,igb-intel} feeds/kiddin9/