mediatek: switch to fitblk for cmcc rax3000m
authorTianling Shen <cnsztl@immortalwrt.org>
Tue, 2 Apr 2024 12:26:45 +0000 (20:26 +0800)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 18 Jul 2024 12:20:58 +0000 (13:20 +0100)
Use the new fitblk driver.

Tested-by: Yangyu Chen <cyy@cyyself.name>
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
package/boot/uboot-envtools/files/mediatek_filogic
package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m.dts
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh

index 4d1016d412e26c8c709c4e8d0e56e27fb93b1cc9..67d37931c29b9e3acdb2b975c593efad53ee82fb 100644 (file)
@@ -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"
        ;;
index 972581fce72349fdcfd98e07ec65ac706ffcc07c..f056cbf3778a5eb072ff262a92c3279a25bf0438 100644 (file)
 +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
index bfccc923a4961893f1fdd82b9ea0ed3cfafcac0f..e6b140bfadcce41b520e3d786da5af5e72f995d2 100644 (file)
@@ -7,6 +7,13 @@
        compatible = "cmcc,rax3000m", "mediatek,mt7981";
 
        fragment@0 {
+               target = <&chosen>;
+               __overlay__ {
+                       rootdisk = <&emmc_rootdisk>;
+               };
+       };
+
+       fragment@1 {
                target = <&gmac0>;
                __overlay__ {
                        nvmem-cells = <&macaddr_factory_2a 0>;
@@ -14,7 +21,7 @@
                };
        };
 
-       fragment@1 {
+       fragment@2 {
                target = <&gmac1>;
                __overlay__ {
                        nvmem-cells = <&macaddr_factory_24 0>;
@@ -22,7 +29,7 @@
                };
        };
 
-       fragment@2 {
+       fragment@3 {
                target = <&mmc0>;
                __overlay__ {
                        bus-width = <8>;
                                                                };
                                                        };
                                                };
+
+                                               emmc_rootdisk: block-partition-production {
+                                                       partname = "production";
+                                               };
                                        };
                                };
                        };
                };
        };
 
-       fragment@3 {
+       fragment@4 {
                target = <&pio>;
                __overlay__ {
                        mmc0_pins_default: mmc0-pins {
                };
        };
 
-       fragment@4 {
+       fragment@5 {
                target = <&wifi>;
                __overlay__ {
                        nvmem-cells = <&eeprom_factory_0>;
index 3f401b53d342f6ac671cc4ed9b550fa00d117927..fded878332e2438ef3e093d896836d99728a2924 100644 (file)
@@ -7,6 +7,13 @@
        compatible = "cmcc,rax3000m", "mediatek,mt7981";
 
        fragment@0 {
+               target = <&chosen>;
+               __overlay__ {
+                       rootdisk = <&ubi_rootdisk>;
+               };
+       };
+
+       fragment@1 {
                target = <&gmac0>;
                __overlay__ {
                        nvmem-cells = <&macaddr_factory_2a 0>;
@@ -14,7 +21,7 @@
                };
        };
 
-       fragment@1 {
+       fragment@2 {
                target = <&gmac1>;
                __overlay__ {
                        nvmem-cells = <&macaddr_factory_24 0>;
@@ -22,7 +29,7 @@
                };
        };
 
-       fragment@2 {
+       fragment@3 {
                target = <&pio>;
                __overlay__ {
                        spi0_flash_pins: spi0-pins {
@@ -46,7 +53,7 @@
                };
        };
 
-       fragment@3 {
+       fragment@4 {
                target = <&spi0>;
                __overlay__ {
                        pinctrl-names = "default";
                                        };
 
                                        partition@580000 {
+                                               compatible = "linux,ubi";
                                                label = "ubi";
                                                reg = <0x580000 0x7200000>;
+
+                                               volumes {
+                                                       ubi_rootdisk: ubi-volume-fit {
+                                                               volname = "fit";
+                                                       };
+                                               };
                                        };
                                };
                        };
                };
        };
 
-       fragment@4 {
+       fragment@5 {
                target = <&wifi>;
                __overlay__ {
                        nvmem-cells = <&eeprom_factory_0>;
index c8db5b58f543290e2ca8966200b70ef0a3f130d8..977a61333363c29ef2a00a0b52541276dc340d66 100644 (file)
@@ -22,7 +22,8 @@
                serial0 = &uart0;
        };
 
-       chosen {
+       chosen: chosen {
+               bootargs-override = "root=/dev/fit0 rootwait";
                stdout-path = "serial0:115200n8";
        };
 
index e059048d12952fe860cfa66b10bab177eadc570a..3b1b2f7fa69ac57ba26ee97eb45e9e9545fe1cc9 100755 (executable)
@@ -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