kiddin9 vor 2 Jahren
Ursprung
Commit
d3cc24ef39

+ 3 - 3
.github/workflows/Openwrt-AutoBuild.yml

@@ -197,10 +197,10 @@ jobs:
     - name: Apply patches
       run: |
         cd openwrt
-        find "devices/common/patches" -type f ! -name 'china_mirrors.patch' -name '*.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "cat '%'  | patch -d './' --no-backup-if-mismatch --merge -p1 -E --forward"
+        find "devices/common/patches" -type f ! -name 'china_mirrors.patch' -name '*.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "cat '%'  | patch -d './' -B --merge -p1 -E --forward"
         #git apply devices/common/patches/*.patch
         if [ -n "$(ls -A "devices/${{matrix.target}}/patches" 2>/dev/null)" ]; then
-          find "devices/${{matrix.target}}/patches" -maxdepth 1 -type f -name '*.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "cat '%'  | patch -d './' --no-backup-if-mismatch --merge -p1 -E --forward"
+          find "devices/${{matrix.target}}/patches" -maxdepth 1 -type f -name '*.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "cat '%'  | patch -d './' -B --merge -p1 -E --forward"
           #git apply devices/${{matrix.target}}/patches/*.patch
         fi
         
@@ -261,7 +261,7 @@ jobs:
         cd openwrt; kernel_v="$(make --file=info.mk kernel_version)"; cd -
         cp -rf openwrt/bin/targets/*/*/*{combined,sysupgrade}* ./firmware/${{matrix.target}}/ || true
         cd openwrt/bin/targets/*/*/
-        mv -f profiles.json profiles.json.b
+        mv -f profiles.json profiles.json.b || true
         cp $GITHUB_WORKSPACE/openwrt/.config ${{matrix.target}}.config || true
         cp $GITHUB_WORKSPACE/openwrt/build_dir/target-*/linux-*/linux-*/.config ${{matrix.target}}_kernel.config || true
         mv -f packages $kernel_v

+ 10 - 0
devices/armvirt_pcat/.config

@@ -0,0 +1,10 @@
+CONFIG_TARGET_armvirt_pcat=y
+CONFIG_TARGET_armvirt_pcat_64=y
+CONFIG_TARGET_armvirt_pcat_64_Default=y
+CONFIG_TARGET_ROOTFS_SQUASHFS=y
+CONFIG_TARGET_IMAGES_GZIP=y
+
+CONFIG_PACKAGE_luci-ssl=n # uhttpd服务
+CONFIG_PACKAGE_luci-ssl-nginx=y # nginx
+
+

+ 16 - 0
devices/armvirt_pcat/diy.sh

@@ -0,0 +1,16 @@
+
+
+SHELL_FOLDER=$(dirname $(readlink -f "$0"))
+bash $SHELL_FOLDER/../common/kernel_5.15.sh
+
+mv -f target/linux/armvirt target/linux/armvirt_pcat
+
+#svn co https://github.com/photonicat/rockchip_rk3568_openwrt_packages/trunk/utils/pcat-manager feeds/packages/utils/pcat-manager
+#ln -sf $SHELL_FOLDER/../../feeds/packages/utils/pcat-manager package/feeds/packages/pcat-manager
+
+
+svn co https://github.com/photonicat/rockchip_rk3568_openwrt/trunk/files files
+
+mv -f $SHELL_FOLDER/network files/etc/config/
+
+

+ 64 - 0
devices/armvirt_pcat/network

@@ -0,0 +1,64 @@
+
+config interface 'loopback'
+	option ifname 'lo'
+	option proto 'static'
+	option ipaddr '127.0.0.1'
+	option netmask '255.0.0.0'
+
+config globals 'globals'
+	option ula_prefix 'fd1e:7270:ea04::/48'
+
+config interface 'lan'
+	option proto 'static'
+	option netmask '255.255.248.0'
+	option ip6assign '60'
+	option ipaddr '10.0.0.1'
+	option device 'br-lan'
+
+config interface 'wan'
+	option ifname 'eth0'
+	option proto 'dhcp'
+	option metric '1'
+
+config interface 'wan6'
+	option ifname 'eth0'
+	option proto 'dhcpv6'
+	option metric '2'
+
+config interface 'VPN'
+	option ifname 'ipsec0'
+	option proto 'static'
+	option ipaddr '10.10.10.1'
+	option netmask '255.255.255.0'
+
+config interface 'vpn0'
+	option ifname 'tun0'
+	option proto 'none'
+
+config interface 'wwan_5g'
+	option proto 'dhcp'
+	option ifname 'usb0'
+	option metric '10'
+	option auto '0'
+
+config interface 'wwan_5g_v6'
+	option proto 'dhcpv6'
+	option ifname 'usb0'
+	option metric '11'
+	option auto '0'
+
+config interface 'wwan_lte'
+	option proto 'dhcp'
+	option ifname 'wwan0'
+	option metric '12'
+
+config interface 'wwan_lte_v6'
+	option proto 'dhcpv6'
+	option ifname 'wwan0'
+	option metric '13'
+
+config device
+	option name 'br-lan'
+	option type 'bridge'
+	list ports 'eth1'
+

+ 21 - 0
devices/armvirt_pcat/patches/fix.patch

@@ -0,0 +1,21 @@
+--- a/target/linux/armvirt_pcat/Makefile
++++ b/target/linux/armvirt_pcat/Makefile
+@@ -4,15 +4,15 @@
+ 
+ include $(TOPDIR)/rules.mk
+ 
+-BOARD:=armvirt
++BOARD:=armvirt_pcat
+ BOARDNAME:=QEMU ARM Virtual Machine
+ FEATURES:=fpu pci rtc usb
+-FEATURES+=cpiogz ext4 ramdisk squashfs targz
++FEATURES+=cpiogz ext4 ramdisk squashfs targz boot-part rootfs-part
+ 
+ KERNEL_PATCHVER:=5.15
+ 
+ include $(INCLUDE_DIR)/target.mk
+ 
+-DEFAULT_PACKAGES += mkf2fs e2fsprogs
++DEFAULT_PACKAGES += mkf2fs e2fsprogs blkid pcat-manager -luci-app-gpsysupgrade
+ 
+ $(eval $(call BuildTarget))

+ 0 - 1
devices/common/.config

@@ -4,7 +4,6 @@ CONFIG_GRUB_CONSOLE=n
 CONFIG_TARGET_ROOTFS_EXT4FS=n
 
 CONFIG_TARGET_ROOTFS_CPIOGZ=n
-CONFIG_TARGET_ROOTFS_TARGZ=n
 CONFIG_LUCI_CSSTIDY=n
 CONFIG_GRUB_CONSOLE=n
 CONFIG_SIGNED_PACKAGES=n

+ 0 - 2
devices/common/diy.sh

@@ -51,8 +51,6 @@ sed -i 's/max_requests 3/max_requests 20/g' package/network/services/uhttpd/file
 #rm -rf ./feeds/packages/lang/{golang,node}
 sed -i "s/tty\(0\|1\)::askfirst/tty\1::respawn/g" target/linux/*/base-files/etc/inittab
 
-sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true
-
 sed -i '$a  \
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y \
 CONFIG_CPU_FREQ_GOV_USERSPACE=y \

+ 106 - 0
devices/common/patches/fix.patch

@@ -0,0 +1,106 @@
+--- a/include/image.mk
++++ b/include/image.mk
+@@ -300,6 +300,44 @@ ifdef CONFIG_TARGET_ROOTFS_TARGZ
+   endef
+ endif
+ 
++define Device/Build/targz
++  $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
++	  $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json, \
++	  $(BIN_DIR)/$$(ROOTFSTZ))
++
++  $(call Device/Export,$(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json,$(1))
++
++  $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json: $(BIN_DIR)/$$(ROOTFSTZ)
++	@mkdir -p $$(shell dirname $$@)
++	DEVICE_ID="$(1)" \
++	SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
++	FILE_NAME="$$(notdir $$^)" \
++	FILE_DIR="$(BIN_DIR)" \
++	FILE_TYPE="rootfs" \
++	FILE_FILESYSTEM="rootfs" \
++	DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \
++	DEVICE_VENDOR="$$(DEVICE_VENDOR)" \
++	DEVICE_MODEL="$$(DEVICE_MODEL)" \
++	DEVICE_VARIANT="$$(DEVICE_VARIANT)" \
++	DEVICE_ALT0_VENDOR="$$(DEVICE_ALT0_VENDOR)" \
++	DEVICE_ALT0_MODEL="$$(DEVICE_ALT0_MODEL)" \
++	DEVICE_ALT0_VARIANT="$$(DEVICE_ALT0_VARIANT)" \
++	DEVICE_ALT1_VENDOR="$$(DEVICE_ALT1_VENDOR)" \
++	DEVICE_ALT1_MODEL="$$(DEVICE_ALT1_MODEL)" \
++	DEVICE_ALT1_VARIANT="$$(DEVICE_ALT1_VARIANT)" \
++	DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \
++	DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \
++	DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \
++	DEVICE_TITLE="$$(DEVICE_TITLE)" \
++	DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \
++	TARGET="$(BOARD)" \
++	SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
++	VERSION_NUMBER="$(VERSION_NUMBER)" \
++	VERSION_CODE="$(VERSION_CODE)" \
++	SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
++	$(TOPDIR)/scripts/json_add_image_info.py $$@
++endef
++
+ ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
+   define Image/Build/cpiogz
+ 	( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
+@@ -367,6 +405,7 @@ define Device/Init
+   DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
+   DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
+   IMAGE_SIZE :=
++  ROOTFSTZ = $$(DEVICE_IMG_PREFIX)-rootfs.tar.gz
+   KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
+   KERNEL_SUFFIX := -kernel.bin
+   KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
+@@ -567,7 +606,7 @@ define Device/Build/kernel
+ endef
+ 
+ define Device/Build/image
+-  GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
++  GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(findstring img,$(2)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
+   $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
+ 	  $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
+ 	  $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
+@@ -677,6 +716,8 @@ define Device/Build
+   $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
+   $(call Device/Build/kernel,$(1))
+ 
++  $(if $(CONFIG_TARGET_ROOTFS_TARGZ),$(call Device/Build/targz,$(PROFILE_SANITIZED)))
++
+   $$(eval $$(foreach compile,$$(COMPILE), \
+     $$(call Device/Build/compile,$$(compile),$(1))))
+ 
+
+--- a/scripts/json_overview_image_info.py
++++ b/scripts/json_overview_image_info.py
+@@ -47,7 +47,7 @@ def get_initial_output(image_info):
+ 
+ 
+ if output:
+-    default_packages, output["arch_packages"] = run(
++    default_packages, output["arch_packages"], output["kernel_version"], output["initramfs"] = run(
+         [
+             "make",
+             "--no-print-directory",
+@@ -55,6 +55,8 @@ def get_initial_output(image_info):
+             "target/linux/",
+             "val.DEFAULT_PACKAGES",
+             "val.ARCH_PACKAGES",
++            "val.LINUX_VERSION",
++            "val.KERNEL_INITRAMFS",
+         ],
+         stdout=PIPE,
+         stderr=PIPE,
+
+
+--- a/rules.mk
++++ b/rules.mk
+@@ -59,6 +59,7 @@ _SINGLE=export MAKEFLAGS=$(space);
+ CFLAGS:=
+ ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
+ ARCH_PACKAGES:=$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES))
++KERNEL_INITRAMFS:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_INITRAMFS))
+ BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
+ SUBTARGET:=$(call qstrip,$(CONFIG_TARGET_SUBTARGET))
+ TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))

+ 2 - 108
devices/common/patches/imagebuilder.patch

@@ -39,7 +39,7 @@
  	echo
  	rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
  	mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(DL_DIR)
-+	if [[ "$(USER_PROFILE)" =~ (DEVICE_phicomm_k2p|DEVICE_asus_rt-n56u-b1|DEVICE_thunder_timecloud|DEVICE_youku_yk-l2|DEVICE_youhua_wr1200js|DEVICE_oraybox_x3a|DEVICE_netgear_wndr3700-v5|DEVICE_xiaomi_mi-router-4a-gigabit|DEVICE_xiaomi_mi-router-3g-v2|DEVICE_jcg_y2|DEVICE_glinet_gl-mt300a|DEVICE_glinet_gl-mt750|DEVICE_hiwifi_hc5661|DEVICE_hiwifi_hc5761|DEVICE_hiwifi_hc5861|DEVICE_lenovo_newifi-y1|DEVICE_lenovo_newifi-y1s|DEVICE_xiaomi_miwifi-mini|DEVICE_youku_yk-l1c|DEVICE_jdcloud_luban|DEVICE_zte_e8820v2) || "$(TARGETID)" == "ramips/mt76x8" ]]; then \
++	if [[ "$(USER_PROFILE)" =~ (DEVICE_phicomm_k2p|DEVICE_asus_rt-n56u-b1|DEVICE_thunder_timecloud|DEVICE_youku_yk-l2|DEVICE_youhua_wr1200js|DEVICE_oraybox_x3a|DEVICE_netgear_wndr3700-v5|DEVICE_xiaomi_mi-router-4a-gigabit|DEVICE_xiaomi_mi-router-4a-gigabit-v2|DEVICE_xiaomi_mi-router-3g-v2|DEVICE_jcg_y2|DEVICE_glinet_gl-mt300a|DEVICE_glinet_gl-mt750|DEVICE_hiwifi_hc5661|DEVICE_hiwifi_hc5761|DEVICE_hiwifi_hc5861|DEVICE_lenovo_newifi-y1|DEVICE_lenovo_newifi-y1s|DEVICE_xiaomi_miwifi-mini|DEVICE_youku_yk-l1c|DEVICE_jdcloud_luban|DEVICE_zte_e8820v2) || "$(TARGETID)" == "ramips/mt76x8" ]]; then \
 +		echo "src/gz openwrt_smflash https://op.supes.top/packages/mipsel_24kc/small_flash" >>$(TOPDIR)/repositories.conf; \
 +	else \
 +		sed -i "/smflash/d" $(TOPDIR)/repositories.conf; \
@@ -87,110 +87,4 @@
 +	nice -n 19 $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
  		$(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)")
  
- $(BIN_DIR)/profiles.json: FORCE
-
---- a/include/image.mk
-+++ b/include/image.mk
-@@ -300,6 +300,44 @@ ifdef CONFIG_TARGET_ROOTFS_TARGZ
-   endef
- endif
- 
-+define Device/Build/targz
-+  $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
-+	  $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json, \
-+	  $(BIN_DIR)/$$(ROOTFSTZ))
-+
-+  $(call Device/Export,$(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json,$(1))
-+
-+  $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json: $(BIN_DIR)/$$(ROOTFSTZ)
-+	@mkdir -p $$(shell dirname $$@)
-+	DEVICE_ID="$(1)" \
-+	SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
-+	FILE_NAME="$$(notdir $$^)" \
-+	FILE_DIR="$(BIN_DIR)" \
-+	FILE_TYPE="rootfs" \
-+	FILE_FILESYSTEM="rootfs" \
-+	DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \
-+	DEVICE_VENDOR="$$(DEVICE_VENDOR)" \
-+	DEVICE_MODEL="$$(DEVICE_MODEL)" \
-+	DEVICE_VARIANT="$$(DEVICE_VARIANT)" \
-+	DEVICE_ALT0_VENDOR="$$(DEVICE_ALT0_VENDOR)" \
-+	DEVICE_ALT0_MODEL="$$(DEVICE_ALT0_MODEL)" \
-+	DEVICE_ALT0_VARIANT="$$(DEVICE_ALT0_VARIANT)" \
-+	DEVICE_ALT1_VENDOR="$$(DEVICE_ALT1_VENDOR)" \
-+	DEVICE_ALT1_MODEL="$$(DEVICE_ALT1_MODEL)" \
-+	DEVICE_ALT1_VARIANT="$$(DEVICE_ALT1_VARIANT)" \
-+	DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \
-+	DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \
-+	DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \
-+	DEVICE_TITLE="$$(DEVICE_TITLE)" \
-+	DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \
-+	TARGET="$(BOARD)" \
-+	SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
-+	VERSION_NUMBER="$(VERSION_NUMBER)" \
-+	VERSION_CODE="$(VERSION_CODE)" \
-+	SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
-+	$(TOPDIR)/scripts/json_add_image_info.py $$@
-+endef
-+
- ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
-   define Image/Build/cpiogz
- 	( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
-@@ -367,6 +405,7 @@ define Device/Init
-   DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
-   DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
-   IMAGE_SIZE :=
-+  ROOTFSTZ = $$(DEVICE_IMG_PREFIX)-rootfs.tar.gz
-   KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
-   KERNEL_SUFFIX := -kernel.bin
-   KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
-@@ -567,7 +606,7 @@ define Device/Build/kernel
- endef
- 
- define Device/Build/image
--  GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
-+  GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(findstring img,$(2)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
-   $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
- 	  $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
- 	  $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
-@@ -677,6 +716,8 @@ define Device/Build
-   $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
-   $(call Device/Build/kernel,$(1))
- 
-+  $(if $(CONFIG_TARGET_ROOTFS_TARGZ),$(call Device/Build/targz,$(PROFILE_SANITIZED)))
-+
-   $$(eval $$(foreach compile,$$(COMPILE), \
-     $$(call Device/Build/compile,$$(compile),$(1))))
- 
-
---- a/scripts/json_overview_image_info.py
-+++ b/scripts/json_overview_image_info.py
-@@ -47,7 +47,7 @@ def get_initial_output(image_info):
- 
- 
- if output:
--    default_packages, output["arch_packages"] = run(
-+    default_packages, output["arch_packages"], output["kernel_version"], output["initramfs"] = run(
-         [
-             "make",
-             "--no-print-directory",
-@@ -55,6 +55,8 @@ def get_initial_output(image_info):
-             "target/linux/",
-             "val.DEFAULT_PACKAGES",
-             "val.ARCH_PACKAGES",
-+            "val.LINUX_VERSION",
-+            "val.KERNEL_INITRAMFS",
-         ],
-         stdout=PIPE,
-         stderr=PIPE,
-
---- a/rules.mk
-+++ b/rules.mk
-@@ -59,6 +59,7 @@ _SINGLE=export MAKEFLAGS=$(space);
- CFLAGS:=
- ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
- ARCH_PACKAGES:=$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES))
-+KERNEL_INITRAMFS:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_INITRAMFS))
- BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
- SUBTARGET:=$(call qstrip,$(CONFIG_TARGET_SUBTARGET))
- TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
+ $(BIN_DIR)/profiles.json: FORCE

+ 3 - 3
devices/ipq40xx_generic/.config

@@ -10,10 +10,10 @@ CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_zte_mf286d=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_glinet_gl-b1300=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_glinet_gl-a1300=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_glinet_gl-s1300-emmc=y
-#CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_linksys_ea6350v3=y
+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_linksys_ea8300=y
+CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_linksys_mr8300=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_mobipromo_cm520-79f=y
 CONFIG_TARGET_DEVICE_ipq40xx_generic_DEVICE_zte_mf289f=y
 

+ 0 - 51
devices/ipq60xx_generic/.config

@@ -6,59 +6,8 @@ CONFIG_TARGET_ALL_PROFILES=y
 
 CONFIG_PACKAGE_dockerd=n
 
-CONFIG_GCC_USE_VERSION_7=y
-CONFIG_PACKAGE_kmod-dm-raid=n
-CONFIG_PACKAGE_kmod-dm=n
-CONFIG_PACKAGE_kmod-fs-xfs=n
-CONFIG_PACKAGE_kmod-fs-btrfs=n
-CONFIG_PACKAGE_kmod-qca-nss-drv-bridge-mgr=n
-CONFIG_PACKAGE_kmod-qca-nss-drv-vlan-mgr=n
-CONFIG_PACKAGE_kmod-drm-ttm=n
-CONFIG_PACKAGE_kmod-drm-kms-helper=n
-CONFIG_PACKAGE_kmod-gigaset=n
-CONFIG_PACKAGE_kmod-isdn4linux=n
-CONFIG_PACKAGE_kmod-video-pwc=n
-CONFIG_PACKAGE_kmod-mmc-spi=n
-CONFIG_PACKAGE_kmod-scsi-cdrom=n
-CONFIG_PACKAGE_kmod-scsi-generic=n
-CONFIG_PACKAGE_kmod-scsi-tape=n
-CONFIG_PACKAGE_kmod-sound-core=n
-CONFIG_PACKAGE_kmod-iio-hmc5843=n
-CONFIG_PACKAGE_kmod-ledtrig-netdev=n
-CONFIG_PACKAGE_kmod-tg3=n
-CONFIG_PACKAGE_kmod-be2net=n
-CONFIG_PACKAGE_kmod-bmp085-spi=n
-CONFIG_PACKAGE_kmod-mac80211-hwsim=n
-CONFIG_PACKAGE_kmod-ath3k=n
-CONFIG_PACKAGE_kmod-ath5k=n
-CONFIG_PACKAGE_kmod-ath6kl-sdio=n
-CONFIG_PACKAGE_kmod-ath6kl-usb=n
-CONFIG_PACKAGE_kmod-ath9k=n
-CONFIG_PACKAGE_kmod-ath10k=n
-CONFIG_PACKAGE_kmod-ath10k-ct=n
-CONFIG_PACKAGE_kmod-ath10k-ct-smallbuffers=n
-CONFIG_PACKAGE_kmod-crypto-qcrypto=n
-CONFIG_PACKAGE_kmod-gl-mifi-mcu=n
-CONFIG_PACKAGE_kmod-mdio-netlink=n
-CONFIG_PACKAGE_kmod-nf-nathelper-extra=n
-CONFIG_PACKAGE_kmod-nf-ipvs-sip=n
-CONFIG_PACKAGE_kmod-nf-nathelper-extra=n
-CONFIG_PACKAGE_kmod-nft-fullcone=n
-CONFIG_PACKAGE_kmod-shortcut-fe=n
-CONFIG_PACKAGE_kmod-shortcut-fe-cm=n
-CONFIG_PACKAGE_kmod-usb-serial-xr_usb_serial_common=n
-CONFIG_PACKAGE_kmod-ovpn-dco=n
-CONFIG_PACKAGE_spidev-test=n
-CONFIG_PACKAGE_kmod-lib80211=n
-CONFIG_PACKAGE_kmod-carl9170=n
-CONFIG_PACKAGE_kmod-batman-adv=n
-CONFIG_PACKAGE_kmod-rtl8812au-ct=n
-CONFIG_PACKAGE_kmod-rtl8821cu=n
-CONFIG_PACKAGE_kmod-rtl88x2bu=n
 
 
-CONFIG_SECCOMP=n
-
 CONFIG_PACKAGE_luci-ssl=y # uhttpd服务
 
 

+ 9 - 28
devices/ipq60xx_generic/diy.sh

@@ -1,36 +1,17 @@
 #!/bin/bash
 shopt -s extglob
 
-rm -rf package/boot/uboot-envtools package/kernel package/firmware/ath11k* package/qca target/linux/generic target/linux/ipq60xx package/network/config/netifd feeds/kiddin9/fullconenat toolchain
-svn export --force https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/package/boot/uboot-envtools package/boot/uboot-envtools
-svn export --force https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/package/firmware/ath11k-firmware package/firmware/ath11k-firmware
-svn export --force https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/package/qca package/qca
+rm -rf package/system/opkg && mv -f feeds/kiddin9/opkg package/system/
+rm -rf package/feeds/kiddin9/{firewall,rtl*,nft-fullcone,fullconenat} package/kernel/mt76 toolchain/musl
+
+rm -rf target/imagebuilder
+svn co https://github.com/openwrt/openwrt/branches/openwrt-22.03/target/imagebuilder target/imagebuilder
+
+rm -rf toolchain/musl
+svn co https://github.com/openwrt/openwrt/branches/openwrt-22.03/toolchain/musl toolchain/musl
 
-svn co https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/target/linux/generic target/linux/generic
-svn co https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/target/linux/ipq60xx target/linux/ipq60xx
-wget -P dl/ https://github.com/coolsnowwolf/openwrt-gl-ax1800/raw/master/dl/linux-4.4.60.tar.xz
-svn co https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/package/kernel package/kernel
 svn co https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/package/network/services/fullconenat feeds/kiddin9/fullconenat
-svn co https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/package/network/config/netifd package/network/config/netifd
-svn co https://github.com/coolsnowwolf/openwrt-gl-ax1800/trunk/toolchain toolchain
-rm -rf target/linux/generic/files
-rm -rf package/network/config/netifd/patches
 
-curl -sfL https://raw.githubusercontent.com/coolsnowwolf/openwrt-gl-ax1800/master/include/netfilter.mk -o include/netfilter.mk
-curl -sfL https://raw.githubusercontent.com/coolsnowwolf/openwrt-gl-ax1800/master/include/quilt.mk -o include/quilt.mk
+rm -rf devices/common/patches/{targets.patch,kernel-defaults.patch,fix.patch,iptables.patch,disable_flock.patch}
 
-rm -f devices/common/patches/usb.patch
-rm -rf feeds/packages/net/openvswitch feeds/kiddin9/shortcut-fe feeds/packages/net/xtables-addons package/kernel/mt76
 
-echo '
-CONFIG_PNP_DEBUG_MESSAGES=y
-CONFIG_PINCTRL_BAYTRAIL=n
-CONFIG_PINCTRL_CHERRYVIEW=n
-CONFIG_PINCTRL_BROXTON=n
-CONFIG_PINCTRL_SUNRISEPOINT=n
-CONFIG_PINCTRL_QDF2XXX=n
-CONFIG_GPIO_AMDPT=n
-CONFIG_PCC=n
-CONFIG_PMIC_OPREGION=n
-CCONFIG_RYPTO_CRC32_ARM64=n
-' >> ./target/linux/ipq60xx/config-4.4

+ 0 - 2
devices/ipq60xx_generic/diy/include/kernel-4.4

@@ -1,2 +0,0 @@
-LINUX_VERSION-4.4 = .60
-LINUX_KERNEL_HASH-4.4.60 = 10f619f7f9ab9f2776d0e34d37138b1ca14e9a026b91790dbdb1eb6c8d15edc6

BIN
devices/ipq60xx_generic/diy/package/firmware/ath11k-firmware/files/board-2.bin.IPQ6018


+ 4 - 0
devices/ipq60xx_generic/feeds.conf

@@ -0,0 +1,4 @@
+src-git packages https://github.com/kiddin9/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 kiddin9 https://github.com/kiddin9/openwrt-packages.git;master

+ 110 - 124
devices/ipq60xx_generic/patches/fix.patch

@@ -1,112 +1,3 @@
---- a/rules.mk
-+++ b/rules.mk
-@@ -136,8 +136,12 @@ else
-   TOOLCHAIN_DIR_NAME:=toolchain-$(GNU_TARGET_NAME)
- endif
- 
--ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),)
--  iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2)
-+ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_GCC_VERSION_4_8),$(CONFIG_TARGET_uml)),)
-+  ifeq ($(CONFIG_GCC_USE_EMBEDDED_PATH_REMAP),y)
-+    iremap = -fmacro-prefix-map=$(1)=$(2)
-+  else
-+    iremap = -iremap$(1):$(2)
-+  endif
- endif
- 
- PACKAGE_DIR:=$(BIN_DIR)/packages
-
---- a/include/image.mk
-+++ b/include/image.mk
-@@ -152,21 +152,6 @@ ifdef CONFIG_TARGET_IMAGES_GZIP
-   endef
- endif
- 
--
--# Disable noisy checks by default as in upstream
--DTC_FLAGS += \
--  -Wno-unit_address_vs_reg \
--  -Wno-simple_bus_reg \
--  -Wno-unit_address_format \
--  -Wno-pci_bridge \
--  -Wno-pci_device_bus_num \
--  -Wno-pci_device_reg \
--  -Wno-avoid_unnecessary_addr_size \
--  -Wno-alias_paths \
--  -Wno-graph_child_address \
--  -Wno-graph_port \
--  -Wno-unique_unit_address
--
- define Image/pad-to
- 	dd if=$(1) of=$(1).new bs=$(2) conv=sync
- 	mv $(1).new $(1)
-
---- a/package/network/utils/iptables/Makefile
-+++ b/package/network/utils/iptables/Makefile
-@@ -784,7 +784,6 @@ $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m)))
- $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
- $(eval $(call BuildPlugin,iptables-mod-rpfilter,$(IPT_RPFILTER-m)))
- $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
--$(eval $(call BuildPlugin,iptables-mod-socket,$(IPT_SOCKET-m)))
- $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
- $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
- $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
-
---- a/feeds/kiddin9/firewall/Makefile
-+++ b/feeds/kiddin9/firewall/Makefile
-@@ -28,7 +28,7 @@ define Package/firewall
-   SECTION:=net
-   CATEGORY:=Base system
-   TITLE:=OpenWrt C Firewall
--  DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables +kmod-ipt-core +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat +kmod-ipt-nat6 +iptables-mod-fullconenat +ip6tables-mod-fullconenat +iptables +ip6tables +kmod-ipt-offload +miniupnpd-iptables
-+  DEPENDS:=+libubox +libubus +libuci +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables +kmod-ipt-core +kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +kmod-ipt-nat +kmod-ipt-nat6 +iptables-mod-fullconenat +iptables +ip6tables +kmod-ipt-offload +miniupnpd-iptables
-   PROVIDES:=uci-firewall
- endef
-
---- a/feeds/kiddin9/automount/Makefile
-+++ b/feeds/kiddin9/automount/Makefile
-@@ -28,7 +28,6 @@ define Package/automount
-     +kmod-usb-storage-extras \
-     +!TARGET_ramips:kmod-usb-storage-uas \
-     +kmod-fs-ext4 \
--    +!LINUX_5_4:kmod-fs-exfat \
-     +LINUX_5_4:kmod-fs-exfat0 \
-     +kmod-fs-vfat
-     +!LINUX_5_15:ntfs-3g
-
---- a/include/target.mk
-+++ b/include/target.mk
-@@ -147,10 +147,17 @@ ifneq ($(TARGET_BUILD)$(if $(DUMP),,1),)
- endif
- 
- GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic
-+ifeq ($(CONFIG_TARGET_ipq60xx),y)
-+GENERIC_BACKPORT_DIR :=
-+GENERIC_PATCH_DIR :=
-+GENERIC_HACK_DIR :=
-+GENERIC_FILES_DIR :=
-+else
- GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
- GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
- GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
- GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(KERNEL_PATCHVER)),"$(dir)")
-+endif
- 
- __config_name_list = $(1)/config-$(KERNEL_PATCHVER) $(1)/config-default
- __config_list = $(firstword $(wildcard $(call __config_name_list,$(1))))
-
---- a/package/kernel/mac80211/ath.mk
-+++ b/package/kernel/mac80211/ath.mk
-@@ -282,7 +282,7 @@ define KernelPackage/ath11k
-   TITLE:=Atheros 802.11ax wireless cards support
-   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath11k
-   DEPENDS+= @TARGET_ipq60xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT \
--	+@DRIVER_11AX_SUPPORT +@DRIVER_11W_SUPPORT +kmod-qca-nss-drv
-+	+@DRIVER_11AX_SUPPORT +@DRIVER_11W_SUPPORT +kmod-qca-nss-drv +kmod-hwmon-core
-   FILES:= \
- 	$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath11k/ath11k.ko
- endef
-
 --- a/target/linux/ipq60xx/Makefile
 +++ b/target/linux/ipq60xx/Makefile
 @@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/target.mk
@@ -119,26 +10,121 @@
  	kmod-qca-nss-drv-pppoe kmod-qca-nss-ecm uboot-envtools
  
 
---- a/package/network/config/netifd/Makefile
-+++ b/package/network/config/netifd/Makefile
-@@ -5,7 +5,7 @@ PKG_RELEASE:=1
- 
- PKG_SOURCE_PROTO:=git
- PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
--PKG_SOURCE_DATE:=2021-06-04
-+PKG_SOURCE_DATE:=2023-06-04
- PKG_SOURCE_VERSION:=50381d0a2998f6c0fc4823f0c2aa4206063d549e
- PKG_MIRROR_HASH:=2718df3d3538c93ac77accf55716fb341741df3d231aac59e04dd1f80f558889
- PKG_MAINTAINER:=Felix Fietkau <[email protected]>
-
 --- a/target/linux/ipq60xx/image/Makefile
 +++ b/target/linux/ipq60xx/image/Makefile
-@@ -103,7 +103,7 @@ define Device/qihoo_v6
+@@ -104,7 +104,7 @@ define Device/qihoo_v6
  	PAGESIZE := 2048
  	DEVICE_DTS := qcom-ipq6018-qihoo-v6
  	DEVICE_DTS_CONFIG := config@cp03-c1
 -	DEVICE_TITLE := Qihoo V6
 +	DEVICE_TITLE := Qihoo 360 V6
- 	DEVICE_PACKAGES := kmod-usb3 kmod-usb-phy-msm
+ 	DEVICE_PACKAGES := ath11k-wifi-qihoo-v6 kmod-usb3 kmod-usb-phy-msm
+ endef
+ TARGET_DEVICES += qihoo_v6
+
+--- a/include/image.mk
++++ b/include/image.mk
+@@ -300,6 +300,44 @@ ifdef CONFIG_TARGET_ROOTFS_TARGZ
+   endef
+ endif
+ 
++define Device/Build/targz
++  $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
++	  $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json, \
++	  $(BIN_DIR)/$$(ROOTFSTZ))
++
++  $(call Device/Export,$(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json,$(1))
++
++  $(BUILD_DIR)/json_info_files/$$(ROOTFSTZ).json: $(BIN_DIR)/$$(ROOTFSTZ)
++	@mkdir -p $$(shell dirname $$@)
++	DEVICE_ID="$(1)" \
++	SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
++	FILE_NAME="$$(notdir $$^)" \
++	FILE_DIR="$(BIN_DIR)" \
++	FILE_TYPE="rootfs" \
++	FILE_FILESYSTEM="rootfs" \
++	DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \
++	DEVICE_VENDOR="$$(DEVICE_VENDOR)" \
++	DEVICE_MODEL="$$(DEVICE_MODEL)" \
++	DEVICE_VARIANT="$$(DEVICE_VARIANT)" \
++	DEVICE_ALT0_VENDOR="$$(DEVICE_ALT0_VENDOR)" \
++	DEVICE_ALT0_MODEL="$$(DEVICE_ALT0_MODEL)" \
++	DEVICE_ALT0_VARIANT="$$(DEVICE_ALT0_VARIANT)" \
++	DEVICE_ALT1_VENDOR="$$(DEVICE_ALT1_VENDOR)" \
++	DEVICE_ALT1_MODEL="$$(DEVICE_ALT1_MODEL)" \
++	DEVICE_ALT1_VARIANT="$$(DEVICE_ALT1_VARIANT)" \
++	DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \
++	DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \
++	DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \
++	DEVICE_TITLE="$$(DEVICE_TITLE)" \
++	DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \
++	TARGET="$(BOARD)" \
++	SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
++	VERSION_NUMBER="$(VERSION_NUMBER)" \
++	VERSION_CODE="$(VERSION_CODE)" \
++	SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
++	$(TOPDIR)/scripts/json_add_image_info.py $$@
++endef
++
+ ifdef CONFIG_TARGET_ROOTFS_CPIOGZ
+   define Image/Build/cpiogz
+ 	( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz )
+@@ -367,6 +405,7 @@ define Device/Init
+   DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
+   DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
+   IMAGE_SIZE :=
++  ROOTFSTZ = $$(DEVICE_IMG_PREFIX)-rootfs.tar.gz
+   KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
+   KERNEL_SUFFIX := -kernel.bin
+   KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
+@@ -567,7 +606,7 @@ define Device/Build/kernel
  endef
- TARGET_DEVICES += qihoo_v6
+ 
+ define Device/Build/image
+-  GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
++  GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(findstring img,$(2)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
+   $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
+ 	  $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
+ 	  $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
+@@ -677,6 +716,8 @@ define Device/Build
+   $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
+   $(call Device/Build/kernel,$(1))
+ 
++  $(if $(CONFIG_TARGET_ROOTFS_TARGZ),$(call Device/Build/targz,$(PROFILE_SANITIZED)))
++
+   $$(eval $$(foreach compile,$$(COMPILE), \
+     $$(call Device/Build/compile,$$(compile),$(1))))
+ 
+
+--- a/scripts/json_overview_image_info.py
++++ b/scripts/json_overview_image_info.py
+@@ -47,7 +47,7 @@ def get_initial_output(image_info):
+ 
+ 
+ if output:
+-    default_packages, output["arch_packages"] = run(
++    default_packages, output["arch_packages"], output["kernel_version"], output["initramfs"] = run(
+         [
+             "make",
+             "--no-print-directory",
+@@ -55,6 +55,8 @@ def get_initial_output(image_info):
+             "target/linux/",
+             "val.DEFAULT_PACKAGES",
+             "val.ARCH_PACKAGES",
++            "val.LINUX_VERSION",
++            "val.KERNEL_INITRAMFS",
+         ],
+         stdout=PIPE,
+         stderr=PIPE,
+
+
+--- a/rules.mk
++++ b/rules.mk
+@@ -59,6 +59,7 @@ _SINGLE=export MAKEFLAGS=$(space);
+ CFLAGS:=
+ ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
+ ARCH_PACKAGES:=$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES))
++KERNEL_INITRAMFS:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_INITRAMFS))
+ BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
+ SUBTARGET:=$(call qstrip,$(CONFIG_TARGET_SUBTARGET))
+ TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))

+ 9 - 0
devices/ipq60xx_generic/patches/kernel-defaults.patch

@@ -0,0 +1,9 @@
+--- a/include/kernel-defaults.mk
++++ b/include/kernel-defaults.mk
+@@ -114,6 +114,7 @@ endef
+ 
+ define Kernel/CompileModules/Default
+ 	rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
++	+$(KERNEL_MAKE) olddefconfig
+ 	+$(KERNEL_MAKE) modules
+ endef

+ 34 - 0
devices/ipq60xx_generic/patches/targets.patch

@@ -0,0 +1,34 @@
+--- a/include/target.mk
++++ b/include/target.mk
+@@ -17,7 +17,7 @@ DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fs
+ # For nas targets
+ DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
+ # For router targets
+-DEFAULT_PACKAGES.router:=dnsmasq-full iptables ip6tables ppp ppp-mod-pppoe firewall odhcpd-ipv6only odhcp6c luci luci-lib-ipkg
++DEFAULT_PACKAGES.router:=dnsmasq-full iptables ip6tables ppp ppp-mod-pppoe firewall odhcpd-ipv6only odhcp6c luci luci-lib-ipkg kmod-ipt-offload kmod-ipt-nat kmod-ipt-nat6
+ DEFAULT_PACKAGES.bootloader:=
+ 
+ ifneq ($(DUMP),)
+@@ -55,6 +55,22 @@ ifneq ($(filter 4.9,$(KERNEL_PATCHVER)),)
+   DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router))
+ endif
+ 
++ifneq ($(CONFIG_SMALL_FLASH),)
++  DEFAULT_PACKAGES+=-coremark -htop -bash -openssh-sftp-server
++endif
++
++ifeq ($(ARCH),arm)
++  DEFAULT_PACKAGES+=autocore-arm luci-app-cpufreq
++endif
++
++ifeq ($(ARCH),aarch64)
++  DEFAULT_PACKAGES+=autocore-arm luci-app-cpufreq
++endif
++
++ifneq ($(CONFIG_USB_SUPPORT),)
++  DEFAULT_PACKAGES+=automount
++endif
++
+ # Add device specific packages (here below to allow device type set from subtarget)
+ DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
+ 

+ 2 - 0
devices/ipq60xx_generic/settings.ini

@@ -0,0 +1,2 @@
+REPO_URL="https://github.com/coolsnowwolf/openwrt-gl-ax1800"
+REPO_BRANCH="master"

+ 1 - 1
devices/ramips_mt7620/diy.sh

@@ -2,5 +2,5 @@
 
 shopt -s extglob
 
-
+sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true
 

+ 1 - 0
devices/ramips_mt7621/.config

@@ -8,6 +8,7 @@ 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_mi-router-4a-gigabit-v2=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

+ 1 - 1
devices/ramips_mt7621/diy.sh

@@ -4,4 +4,4 @@ shopt -s extglob
 
 sed -i "s/DEVICE_MODEL := HC5962$/DEVICE_MODEL := HC5962 \/ B70/" target/linux/ramips/image/mt7621.mk
 
-
+sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true

+ 0 - 9
devices/ramips_mt7621/patches/cr660x.patch → devices/ramips_mt7621/patches/01-cr660x.patch

@@ -108,15 +108,6 @@ index bdaeac2cb16e..72fbd3930a80 100644
    IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
    IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
  	check-size
-@@ -1906,7 +1914,7 @@ define Device/xiaomi_mi-router-4a-gigabit
-   DEVICE_VENDOR := Xiaomi
-   DEVICE_MODEL := Mi Router 4A
-   DEVICE_VARIANT := Gigabit Edition
--  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2
-+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 wpad-mini -wpad-basic-wolfssl -coremark -htop -bash -openssh-sftp-server
- endef
- TARGET_DEVICES += xiaomi_mi-router-4a-gigabit
- 
 @@ -1927,30 +1935,14 @@ define Device/xiaomi_mi-router-cr660x
    KERNEL_SIZE := 4096k
    UBINIZE_OPTS := -E 5

+ 503 - 0
devices/ramips_mt7621/patches/02-4a-v2.patch

@@ -0,0 +1,503 @@
+From 5dd566ff99d17b2c7e459001b4750bc911ee0d4c Mon Sep 17 00:00:00 2001
+From: Dmitry Sokolov <[email protected]>
+Date: Mon, 16 Jan 2023 02:52:27 +0500
+Subject: [PATCH] ramips: mt7621: add support for Xiaomi Mi Router 4A Gigabit
+ v2
+
+Device is the same as Xiaomi Mi Router 4A Gigabit, except of:
+- 5G WiFi is MT7663
+- addresses of leds, wifi and eth ports are slightly changed
+
+Specs:
+  SoC:  MT7621
+  CPU:  2 x 880 MHz
+  ROM:  16 MB
+  RAM:  128 MB
+  WLAN: MT7603, MT7663
+
+MAC addresses:
+  WAN     ****  factory 0xe006 (label)
+  LAN     *:f7  factory 0xe000
+  2.4 GHz *:f8  factory 0x0000+0x4 (mtd-eeprom+0x4)
+  5 GHz   *:f9  factory 0x8000+0x4 (mtd-eeprom+0x4)
+
+Installation:
+
+Factory firmware is based on a custom OpenWrt 17.x.
+Installation is the same as for Xiaomi Mi Router 4A Gigabit.
+
+Probably the easiest way to install is to use the script from
+this repository: https://github.com/acecilia/OpenWRTInvasion/pull/155
+
+In a more advanced case, you can do everything yourself:
+- gain access to the device through one of the exploits described
+  in the link above
+- upload sysupgrade image to /tmp
+- overwrite stock firmware:
+  # mtd -e OS1 -r write /tmp/sysupgrade.bin OS1
+
+Recovery:
+
+Recovery procedure is the same as for Xiaomi Mi Router 4A Gigabit.
+Possible options can be found here:
+https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition
+
+One of the ways is to use another router with OpenWrt:
+- connect both routers by their LAN ports
+- download stock firmware from [1]
+- place it inside /tmp/test.bin on the main router
+- configure PXE/TFTP on the main router
+- power off 4Av2, hold Reset button, power on
+- as soon as image download via TFTP starts, Reset can be released
+- blinking blue wan LED will indicate the end of the flashing process,
+  now router can be rebooted
+[1] http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/r4av2/miwifi_r4av2_firmware_release_2.30.28.bin
+
+Signed-off-by: Dmitry Sokolov <[email protected]>
+---
+ .../dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi | 138 +-----------------
+ .../mt7621_xiaomi_mi-router-4a-common.dtsi    | 138 ++++++++++++++++++
+ .../mt7621_xiaomi_mi-router-4a-gigabit-v2.dts |  80 ++++++++++
+ target/linux/ramips/image/mt7621.mk           |  11 ++
+ .../mt7621/base-files/etc/board.d/01_leds     |   3 +
+ .../mt7621/base-files/etc/board.d/02_network  |   3 +-
+ 6 files changed, 241 insertions(+), 132 deletions(-)
+ create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
+ create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts
+
+diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi
+index a0ee79ae23ce4..d05872337be26 100644
+--- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi
++++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi
+@@ -1,23 +1,12 @@
+ // 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>
++#include "mt7621_xiaomi_mi-router-4a-common.dtsi"
+ 
+ / {
+ 	aliases {
+-		led-boot = &led_status_yellow;
+-		led-failsafe = &led_status_yellow;
+-		led-running = &led_status_blue;
+-		led-upgrade = &led_status_yellow;
+ 		label-mac-device = &wan;
+ 	};
+ 
+-	chosen {
+-		bootargs = "console=ttyS0,115200n8";
+-	};
+-
+ 	leds {
+ 		compatible = "gpio-leds";
+ 
+@@ -31,108 +20,16 @@
+ 			gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+ 		};
+ 	};
+-
+-	keys {
+-		compatible = "gpio-keys";
+-
+-		reset {
+-			label = "reset";
+-			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+-			linux,code = <KEY_RESTART>;
+-		};
+-	};
+ };
+ 
+-&spi0 {
+-	status = "okay";
+-
+-	flash@0 {
+-		compatible = "jedec,spi-nor";
+-		reg = <0>;
+-		spi-max-frequency = <50000000>;
+-		m25p,fast-read;
+-
+-		partitions {
+-			compatible = "fixed-partitions";
+-			#address-cells = <1>;
+-			#size-cells = <1>;
+-
+-			partition@0 {
+-				label = "u-boot";
+-				reg = <0x0 0x30000>;
+-				read-only;
+-			};
+-
+-			partition@30000 {
+-				label = "u-boot-env";
+-				reg = <0x30000 0x10000>;
+-				read-only;
+-			};
+-
+-			partition@40000 {
+-				label = "Bdata";
+-				reg = <0x40000 0x10000>;
+-				read-only;
+-			};
+-
+-			factory: partition@50000 {
+-				label = "factory";
+-				reg = <0x50000 0x10000>;
+-				read-only;
+-			};
+-
+-			partition@60000 {
+-				label = "crash";
+-				reg = <0x60000 0x10000>;
+-				read-only;
+-			};
+-
+-			partition@70000 {
+-				label = "cfg_bak";
+-				reg = <0x70000 0x10000>;
+-				read-only;
+-			};
+-
+-			partition@80000 {
+-				label = "overlay";
+-				reg = <0x80000 0x100000>;
+-				read-only;
+-			};
+-
+-			firmware: partition@180000 {
+-				compatible = "denx,uimage";
+-				label = "firmware";
+-				reg = <0x180000 0xe80000>;
+-			};
+-		};
+-	};
++&wifi0 {
++	mediatek,mtd-eeprom = <&factory 0x8000>;
++	ieee80211-freq-limit = <5000000 6000000>;
+ };
+ 
+-&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>;
+-	};
+-};
+-
+-&pcie1 {
+-	wifi@0,0 {
+-		compatible = "pci14c3,7603";
+-		reg = <0x0000 0 0 0 0>;
+-		mediatek,mtd-eeprom = <&factory 0x0000>;
+-		ieee80211-freq-limit = <2400000 2500000>;
+-	};
+-};
+-
+-&gmac0 {
+-	nvmem-cells = <&macaddr_factory_e000>;
+-	nvmem-cell-names = "mac-address";
++&wifi1 {
++	mediatek,mtd-eeprom = <&factory 0x0000>;
++	ieee80211-freq-limit = <2400000 2500000>;
+ };
+ 
+ &switch0 {
+@@ -163,24 +60,3 @@
+ 		};
+ 	};
+ };
+-
+-&state_default {
+-	gpio {
+-		groups = "jtag", "uart2", "uart3", "wdt";
+-		function = "gpio";
+-	};
+-};
+-
+-&factory {
+-	compatible = "nvmem-cells";
+-	#address-cells = <1>;
+-	#size-cells = <1>;
+-
+-	macaddr_factory_e000: macaddr@e000 {
+-		reg = <0xe000 0x6>;
+-	};
+-
+-	macaddr_factory_e006: macaddr@e006 {
+-		reg = <0xe006 0x6>;
+-	};
+-};
+diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
+new file mode 100644
+index 0000000000000..efc32733e9bc1
+--- /dev/null
++++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
+@@ -0,0 +1,138 @@
++// 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>
++
++/ {
++	aliases {
++		led-boot = &led_status_yellow;
++		led-failsafe = &led_status_yellow;
++		led-running = &led_status_blue;
++		led-upgrade = &led_status_yellow;
++	};
++
++	chosen {
++		bootargs = "console=ttyS0,115200n8";
++	};
++
++	keys {
++		compatible = "gpio-keys";
++
++		reset {
++			label = "reset";
++			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
++			linux,code = <KEY_RESTART>;
++		};
++	};
++};
++
++&spi0 {
++	status = "okay";
++
++	flash@0 {
++		compatible = "jedec,spi-nor";
++		reg = <0>;
++		spi-max-frequency = <50000000>;
++		m25p,fast-read;
++
++		partitions: partitions {
++			compatible = "fixed-partitions";
++			#address-cells = <1>;
++			#size-cells = <1>;
++
++			partition@0 {
++				label = "u-boot";
++				reg = <0x0 0x30000>;
++				read-only;
++			};
++
++			partition@30000 {
++				label = "u-boot-env";
++				reg = <0x30000 0x10000>;
++				read-only;
++			};
++
++			partition@40000 {
++				label = "Bdata";
++				reg = <0x40000 0x10000>;
++				read-only;
++			};
++
++			factory: partition@50000 {
++				label = "factory";
++				reg = <0x50000 0x10000>;
++				read-only;
++			};
++
++			partition@60000 {
++				label = "crash";
++				reg = <0x60000 0x10000>;
++				read-only;
++			};
++
++			partition@70000 {
++				label = "cfg_bak";
++				reg = <0x70000 0x10000>;
++				read-only;
++			};
++
++			partition@80000 {
++				label = "overlay";
++				reg = <0x80000 0x100000>;
++				read-only;
++			};
++
++			firmware: partition@180000 {
++				compatible = "denx,uimage";
++				label = "firmware";
++				reg = <0x180000 0xe80000>;
++			};
++		};
++	};
++};
++
++&pcie {
++	status = "okay";
++};
++
++&pcie0 {
++	wifi0: wifi@0,0 {
++		compatible = "mediatek,mt76";
++		reg = <0x0000 0 0 0 0>;
++	};
++};
++
++&pcie1 {
++	wifi1: wifi@0,0 {
++		compatible = "mediatek,mt76";
++		reg = <0x0000 0 0 0 0>;
++	};
++};
++
++&gmac0 {
++	nvmem-cells = <&macaddr_factory_e000>;
++	nvmem-cell-names = "mac-address";
++};
++
++&state_default {
++	gpio {
++		groups = "jtag", "uart2", "uart3", "wdt";
++		function = "gpio";
++	};
++};
++
++&factory {
++	compatible = "nvmem-cells";
++	#address-cells = <1>;
++	#size-cells = <1>;
++
++	macaddr_factory_e000: macaddr@e000 {
++		reg = <0xe000 0x6>;
++	};
++
++	macaddr_factory_e006: macaddr@e006 {
++		reg = <0xe006 0x6>;
++	};
++};
+diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts
+new file mode 100644
+index 0000000000000..67ff6ea11e161
+--- /dev/null
++++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts
+@@ -0,0 +1,67 @@
++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
++
++#include "mt7621_xiaomi_mi-router-4a-common.dtsi"
++
++/ {
++	compatible = "xiaomi,mi-router-4a-gigabit-v2", "mediatek,mt7621-soc";
++	model = "Xiaomi Mi Router 4A Gigabit Edition v2";
++
++	aliases {
++		label-mac-device = &wan;
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		led_status_blue: status_blue {
++			label = "blue:status";
++			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
++		};
++
++		led_status_yellow: status_yellow {
++			label = "yellow:status";
++			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
++		};
++
++		wan_blue {
++			label = "blue:wan";
++			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
++		};
++
++		wan_yellow {
++			label = "yellow:wan";
++			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
++		};
++	};
++};
++
++&wifi0 {
++	mediatek,mtd-eeprom = <&factory 0x0000>;
++	ieee80211-freq-limit = <2400000 2500000>;
++};
++
++&wifi1 {
++	mediatek,mtd-eeprom = <&factory 0x8000>;
++	ieee80211-freq-limit = <5000000 6000000>;
++};
++
++&switch0 {
++	ports {
++		port@1 {
++			status = "okay";
++			label = "lan1";
++		};
++
++		port@2 {
++			status = "okay";
++			label = "lan2";
++		};
++
++		wan: port@3 {
++			status = "okay";
++			label = "wan";
++			nvmem-cells = <&macaddr_factory_e006>;
++			nvmem-cell-names = "mac-address";
++		};
++	};
++};
+diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
+index 9d01399c5cc3c..6871243a5f6c6 100644
+--- a/target/linux/ramips/image/mt7621.mk
++++ b/target/linux/ramips/image/mt7621.mk
+@@ -2427,6 +2427,17 @@ define Device/xiaomi_mi-router-4a-gigabit
+ endef
+ TARGET_DEVICES += xiaomi_mi-router-4a-gigabit
+ 
++define Device/xiaomi_mi-router-4a-gigabit-v2
++  $(Device/dsa-migration)
++  $(Device/uimage-lzma-loader)
++  IMAGE_SIZE := 16064k
++  DEVICE_VENDOR := Xiaomi
++  DEVICE_MODEL := Mi Router 4A
++  DEVICE_VARIANT := Gigabit Edition v2
++  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap wpad-mini -wpad-basic-wolfssl -coremark -htop -bash -openssh-sftp-server
++endef
++TARGET_DEVICES += xiaomi_mi-router-4a-gigabit-v2
++
+ define Device/xiaomi_mi-router-ac2100
+   $(Device/xiaomi_nand_separate)
+   DEVICE_MODEL := Mi Router AC2100
+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 91f3fe6e93c13..597d7302ac88e 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
+@@ -179,6 +179,9 @@ tplink,re650-v2)
+ tplink,tl-wpa8631p-v3)
+ 	ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan"
+ 	;;
++xiaomi,mi-router-4a-gigabit-v2)
++	ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link"
++	;;
+ xiaomi,mi-router-ac2100)
+ 	ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan"
+ 	;;
+diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+index ddbbf9891d63a..67f58b10b2715 100644
+--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
++++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+@@ -72,7 +72,8 @@ ramips_setup_interfaces()
+ 	xiaomi,mi-router-3g|\
+ 	xiaomi,mi-router-3g-v2|\
+ 	xiaomi,mi-router-4|\
+-	xiaomi,mi-router-4a-gigabit)
++	xiaomi,mi-router-4a-gigabit|\
++	xiaomi,mi-router-4a-gigabit-v2)
+ 		ucidef_set_interfaces_lan_wan "lan1 lan2" "wan"
+ 		;;
+ 	bolt,arion)

+ 19 - 5
devices/ramips_mt7621/patches/4a-breed-fix.patch → devices/ramips_mt7621/patches/03-4a-breed-fix.patch

@@ -1,6 +1,6 @@
---- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi
-+++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi
-@@ -69,40 +69,16 @@
+--- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
++++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
+@@ -54,40 +54,16 @@
  				read-only;
  			};
  
@@ -48,7 +48,7 @@
 
 --- a/target/linux/ramips/image/mt7621.mk
 +++ b/target/linux/ramips/image/mt7621.mk
-@@ -1926,7 +1926,7 @@ TARGET_DEVICES += xiaomi_mi-router-3g
+@@ -1963,7 +1963,7 @@ TARGET_DEVICES += xiaomi_mi-router-3g
  define Device/xiaomi_mi-router-3g-v2
    $(Device/dsa-migration)
    $(Device/uimage-lzma-loader)
@@ -56,4 +56,18 @@
 +  IMAGE_SIZE := 16064k
    DEVICE_VENDOR := Xiaomi
    DEVICE_MODEL := Mi Router 3G
-   DEVICE_VARIANT := v2
+   DEVICE_VARIANT := v2
+@@ -2003,11 +2003,11 @@ TARGET_DEVICES += xiaomi_mi-router-4
+ define Device/xiaomi_mi-router-4a-gigabit
+   $(Device/dsa-migration)
+   $(Device/uimage-lzma-loader)
+-  IMAGE_SIZE := 14848k
++  IMAGE_SIZE := 16064k
+   DEVICE_VENDOR := Xiaomi
+   DEVICE_MODEL := Mi Router 4A
+   DEVICE_VARIANT := Gigabit Edition
+-  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2
++  DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 wpad-mini -wpad-basic-wolfssl -coremark -htop -bash -openssh-sftp-server
+ endef
+ TARGET_DEVICES += xiaomi_mi-router-4a-gigabit
+ 

+ 2 - 0
devices/ramips_mt76x8/diy.sh

@@ -3,6 +3,8 @@
 shopt -s extglob
 
 SHELL_FOLDER=$(dirname $(readlink -f "$0"))
+
+sh -c "curl -sfL https://github.com/openwrt/openwrt/commit/2e6d19ee32399e37c7545aefc57d41541a406d55.patch | patch -d './' -p1 --forward" || true
 #bash $SHELL_FOLDER/../common/kernel_5.15.sh
 
 #sh -c "curl -sfL https://patch-diff.githubusercontent.com/raw/openwrt/openwrt/pull/11287.patch | patch -d './' -p1 --forward"