[openwrt/openwrt] mediatek: switch to fitblk for cmcc rax3000m

LEDE Commits lede-commits at lists.infradead.org
Thu Jul 18 05:22:28 PDT 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/39c824f846ceca5281ee5f3ddbf92627076bdb5e

commit 39c824f846ceca5281ee5f3ddbf92627076bdb5e
Author: Tianling Shen <cnsztl at immortalwrt.org>
AuthorDate: Tue Apr 2 20:26:45 2024 +0800

    mediatek: switch to fitblk for cmcc rax3000m
    
    Use the new fitblk driver.
    
    Tested-by: Yangyu Chen <cyy at cyyself.name>
    Signed-off-by: Tianling Shen <cnsztl at immortalwrt.org>
---
 package/boot/uboot-envtools/files/mediatek_filogic | 11 +----------
 .../patches/437-add-cmcc_rax3000m.patch            |  2 +-
 .../mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso   | 19 ++++++++++++++----
 .../mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso   | 22 +++++++++++++++++----
 .../linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts   |  3 ++-
 .../filogic/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 4d1016d412..67d37931c2 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 972581fce7..f056cbf377 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 bfccc923a4..e6b140bfad 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 at 0 {
+		target = <&chosen>;
+		__overlay__ {
+			rootdisk = <&emmc_rootdisk>;
+		};
+	};
+
+	fragment at 1 {
 		target = <&gmac0>;
 		__overlay__ {
 			nvmem-cells = <&macaddr_factory_2a 0>;
@@ -14,7 +21,7 @@
 		};
 	};
 
-	fragment at 1 {
+	fragment at 2 {
 		target = <&gmac1>;
 		__overlay__ {
 			nvmem-cells = <&macaddr_factory_24 0>;
@@ -22,7 +29,7 @@
 		};
 	};
 
-	fragment at 2 {
+	fragment at 3 {
 		target = <&mmc0>;
 		__overlay__ {
 			bus-width = <8>;
@@ -69,13 +76,17 @@
 								};
 							};
 						};
+
+						emmc_rootdisk: block-partition-production {
+							partname = "production";
+						};
 					};
 				};
 			};
 		};
 	};
 
-	fragment at 3 {
+	fragment at 4 {
 		target = <&pio>;
 		__overlay__ {
 			mmc0_pins_default: mmc0-pins {
@@ -94,7 +105,7 @@
 		};
 	};
 
-	fragment at 4 {
+	fragment at 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 3f401b53d3..fded878332 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 at 0 {
+		target = <&chosen>;
+		__overlay__ {
+			rootdisk = <&ubi_rootdisk>;
+		};
+	};
+
+	fragment at 1 {
 		target = <&gmac0>;
 		__overlay__ {
 			nvmem-cells = <&macaddr_factory_2a 0>;
@@ -14,7 +21,7 @@
 		};
 	};
 
-	fragment at 1 {
+	fragment at 2 {
 		target = <&gmac1>;
 		__overlay__ {
 			nvmem-cells = <&macaddr_factory_24 0>;
@@ -22,7 +29,7 @@
 		};
 	};
 
-	fragment at 2 {
+	fragment at 3 {
 		target = <&pio>;
 		__overlay__ {
 			spi0_flash_pins: spi0-pins {
@@ -46,7 +53,7 @@
 		};
 	};
 
-	fragment at 3 {
+	fragment at 4 {
 		target = <&spi0>;
 		__overlay__ {
 			pinctrl-names = "default";
@@ -114,15 +121,22 @@
 					};
 
 					partition at 580000 {
+						compatible = "linux,ubi";
 						label = "ubi";
 						reg = <0x580000 0x7200000>;
+
+						volumes {
+							ubi_rootdisk: ubi-volume-fit {
+								volname = "fit";
+							};
+						};
 					};
 				};
 			};
 		};
 	};
 
-	fragment at 4 {
+	fragment at 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 c8db5b58f5..977a613333 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 e059048d12..3b1b2f7fa6 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




More information about the lede-commits mailing list