From 5e34f402969b505f889dc491c9c67aa7346279a8 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 13 Jul 2021 21:11:06 +0800 Subject: [PATCH] ramips: improve support for dlink and xiaomi devices (#7370) * ramips: dlink_dir-8xx-a1: switch to breed partition * ramips: improve support for cr660x --- package/boot/uboot-envtools/files/ramips | 2 +- .../ramips/dts/mt7621_dlink_flash-16m-a1.dtsi | 9 ++++---- ...dts => mt7621_xiaomi_mi-router-cr660x.dts} | 14 ++++++------- target/linux/ramips/image/mt7621.mk | 21 ++++++++----------- .../mt7621/base-files/etc/board.d/01_leds | 6 ++---- .../mt7621/base-files/etc/board.d/02_network | 2 +- .../mt7621/base-files/lib/upgrade/platform.sh | 2 +- 7 files changed, 24 insertions(+), 32 deletions(-) rename target/linux/ramips/dts/{mt7621_xiaomi_mi-router-cr6606.dts => mt7621_xiaomi_mi-router-cr660x.dts} (88%) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 7d616ede4..34aaf9a5e 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -58,7 +58,7 @@ xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" ;; -xiaomi,mi-router-cr6606) +xiaomi,mi-router-cr660x) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ;; zyxel,nr7101) diff --git a/target/linux/ramips/dts/mt7621_dlink_flash-16m-a1.dtsi b/target/linux/ramips/dts/mt7621_dlink_flash-16m-a1.dtsi index 911de595d..3f71ab971 100644 --- a/target/linux/ramips/dts/mt7621_dlink_flash-16m-a1.dtsi +++ b/target/linux/ramips/dts/mt7621_dlink_flash-16m-a1.dtsi @@ -27,15 +27,14 @@ factory: partition@40000 { label = "factory"; - reg = <0x40000 0x20000>; + reg = <0x40000 0x10000>; read-only; }; - partition@60000 { - compatible = "openwrt,uimage", "denx,uimage"; - openwrt,padding = <96>; + partition@50000 { + compatible = "denx,uimage"; label = "firmware"; - reg = <0x60000 0xfa0000>; + reg = <0x50000 0xfb0000>; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts similarity index 88% rename from target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts rename to target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts index 22c86dbd8..9ee0b9f8d 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr6606.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; #include "mt7621.dtsi" @@ -7,8 +6,8 @@ #include / { - compatible = "xiaomi,mi-router-cr6606", "mediatek,mt7621-soc"; - model = "Xiaomi Mi Router CR6606/CR6608/CR6609"; + compatible = "xiaomi,mi-router-cr660x", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router CR660x"; aliases { led-boot = &led_sys_yellow; @@ -26,22 +25,22 @@ compatible = "gpio-leds"; led_sys_yellow: sys_yellow { - label = "mi-router-cr6606:yellow:sys"; + label = "yellow:sys"; gpios = <&gpio 14 GPIO_ACTIVE_LOW>; }; led_sys_blue: sys_blue { - label = "mi-router-cr6606:blue:sys"; + label = "blue:sys"; gpios = <&gpio 16 GPIO_ACTIVE_LOW>; }; net_yellow { - label = "mi-router-cr6606:yellow:net"; + label = "yellow:net"; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; net_blue { - label = "mi-router-cr6606:blue:net"; + label = "blue:net"; gpios = <&gpio 15 GPIO_ACTIVE_LOW>; }; }; @@ -74,7 +73,6 @@ partition@0 { label = "Bootloader"; reg = <0x0 0x80000>; - read-only; }; partition@80000 { diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 671cc3ab0..0c73c3459 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -283,15 +283,9 @@ TARGET_DEVICES += cudy_wr2100 define Device/dlink_dir-8xx-a1 $(Device/dsa-migration) - IMAGE_SIZE := 16000k + IMAGE_SIZE := 16064k DEVICE_VENDOR := D-Link DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware - KERNEL_INITRAMFS := $$(KERNEL) | uimage-padhdr 96 - IMAGES += factory.bin - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | uimage-padhdr 96 |\ - pad-rootfs | check-size | append-metadata - IMAGE/factory.bin := append-kernel | append-rootfs | uimage-padhdr 96 |\ - check-size endef define Device/dlink_dir-8xx-r1 @@ -1162,7 +1156,7 @@ define Device/phicomm_k2p DEVICE_VENDOR := Phicomm DEVICE_MODEL := K2P SUPPORTED_DEVICES += k2p - DEVICE_PACKAGES := -luci-newapi -wpad-openssl kmod-mt7615d_dbdc luci-app-adbyby-plus xray-core UnblockNeteaseMusicGo + DEVICE_PACKAGES := kmod-mt7615d_dbdc -luci-newapi -wpad-openssl endef TARGET_DEVICES += phicomm_k2p @@ -1567,7 +1561,8 @@ define Device/xiaomi_mi-router-ac2100 endef TARGET_DEVICES += xiaomi_mi-router-ac2100 -define Device/xiaomi_mi-router-cr6606 +define Device/xiaomi_mi-router-cr660x + $(Device/dsa-migration) $(Device/uimage-lzma-loader) BLOCKSIZE := 128k PAGESIZE := 2048 @@ -1576,12 +1571,14 @@ define Device/xiaomi_mi-router-cr6606 IMAGE_SIZE := 128512k IMAGES += factory.bin IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size DEVICE_VENDOR := Xiaomi - DEVICE_MODEL := Mi Router CR6606/CR6608/CR6609 + DEVICE_MODEL := Mi Router CR660x DEVICE_PACKAGES += kmod-mt7915e wpad-openssl uboot-envtools + SUPPORTED_DEVICES += xiaomi,mi-router-cr6606 endef -TARGET_DEVICES += xiaomi_mi-router-cr6606 +TARGET_DEVICES += xiaomi_mi-router-cr660x define Device/xiaomi_redmi-router-ac2100 $(Device/xiaomi_nand_separate) 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 93e4981be..78e60173e 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 @@ -37,7 +37,8 @@ dlink,dir-2660-a1) dlink,dir-853-a3) ucidef_set_led_netdev "wan" "wan" "blue:net" "wan" ;; -dlink,dir-853-r1) +dlink,dir-853-r1|\ +xiaomi,mi-router-cr660x) ucidef_set_led_netdev "internet" "internet" "blue:net" "wan" ;; dlink,dir-860l-b1|\ @@ -116,9 +117,6 @@ tplink,re650-v1) xiaomi,mi-router-ac2100) ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan" ;; -xiaomi,mi-router-cr6606) - ucidef_set_led_netdev "internet" "internet" "$boardname:blue:net" "wan" - ;; xiaomi,redmi-router-ac2100) ucidef_set_led_netdev "wan" "wan" "white: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 40d22950d..e37fe4f82 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 @@ -26,7 +26,7 @@ ramips_setup_interfaces() hiwifi,hc5962|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-ac2100|\ - xiaomi,mi-router-cr6606|\ + xiaomi,mi-router-cr660x|\ xiaomi,redmi-router-ac2100) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index a2ad38b7c..12c45f110 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -79,7 +79,7 @@ platform_do_upgrade() { xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ xiaomi,mi-router-ac2100|\ - xiaomi,mi-router-cr6606|\ + xiaomi,mi-router-cr660x|\ xiaomi,redmi-router-ac2100) nand_do_upgrade "$1" ;;