mediatek: add stock layout for CMCC A10

This board is also as known as SuperElectron ZN-M5 and ZN-M8. However,
for ZN-M5 and ZN-M8, there's another version uses ZX279128 as CPU
chip, which is unsupported.
You can check it in "高级设置" > "系统日志" > "内核日志" page from webUI.

Stock layout flash instructions:
Login into webUI and upload sysupgrade firmware in "系统管理" > "升级固件" page.
Remember to unselect "保留配置" ("Keep configurations") first before doing that.

OpenWrt U-Boot layout flash instructions:
1. Flash stock layout firmware first.
2. Connect to the device via SSH, and backup everything,
   especially 'Factory' partition.
3. Unlock MTD partitions:
   apk update && apk add kmod-mtd-rw
   insmod mtd-rw i_want_a_brick=1
4. Write new BL2 and FIP:
   mtd write immortalwrt-mediatek-filogic-cmcc_a10-ubootmod-preloader.bin BL2
   mtd write immortalwrt-mediatek-filogic-cmcc_a10-ubootmod-bl31-uboot.fip FIP
5. Set static IP on your PC:
   IP 192.168.1.254/24, GW 192.168.1.1
6. Serve ImmortalWrt initramfs image using TFTP server.
7. Cut off the power and re-engage, wait for TFTP recovery to complete.
8. After ImmortalWrt has booted, perform sysupgrade.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2025-02-26 21:52:53 +08:00
parent 07089cedb8
commit 4e9240e733
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
9 changed files with 122 additions and 33 deletions

View File

@ -35,7 +35,7 @@ ubootenv_add_ubi_default() {
case "$board" in
abt,asr3000|\
cetron,ct3003-ubootmod|\
cmcc,a10|\
cmcc,a10-ubootmod|\
cudy,tr3000-v1-ubootmod|\
h3c,magic-nx30-pro|\
imou,lc-hx3001|\

View File

@ -246,7 +246,7 @@ endef
define U-Boot/mt7981_cmcc_a10
NAME:=CMCC A10
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=cmcc_a10
BUILD_DEVICES:=cmcc_a10-ubootmod
UBOOT_CONFIG:=mt7981_cmcc_a10
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand

View File

@ -277,10 +277,10 @@
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
+bootconf=config-1
+bootdelay=0
+bootfile=immortalwrt-mediatek-filogic-cmcc_a10-initramfs-recovery.itb
+bootfile_bl2=immortalwrt-mediatek-filogic-cmcc_a10-preloader.bin
+bootfile_fip=immortalwrt-mediatek-filogic-cmcc_a10-bl31-uboot.fip
+bootfile_upg=immortalwrt-mediatek-filogic-cmcc_a10-squashfs-sysupgrade.itb
+bootfile=immortalwrt-mediatek-filogic-cmcc_a10-ubootmod-initramfs-recovery.itb
+bootfile_bl2=immortalwrt-mediatek-filogic-cmcc_a10-ubootmod-preloader.bin
+bootfile_fip=immortalwrt-mediatek-filogic-cmcc_a10-ubootmod-bl31-uboot.fip
+bootfile_upg=immortalwrt-mediatek-filogic-cmcc_a10-ubootmod-squashfs-sysupgrade.itb
+bootled_pwr=red:status
+bootled_rec=blue:status
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60

View File

@ -0,0 +1,40 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981b-cmcc-a10.dtsi"
/ {
model = "CMCC A10 (stock layout)";
compatible = "cmcc,a10-stock", "mediatek,mt7981";
};
&partitions {
partition@580000 {
label = "ubi";
reg = <0x580000 0x4000000>;
};
partition@4580000 {
label = "firmware_backup";
reg = <0x4580000 0x2000000>;
read-only;
};
partition@6580000 {
label = "zrsave";
reg = <0x6580000 0x100000>;
read-only;
};
partition@6680000 {
label = "config2";
reg = <0x6680000 0x100000>;
read-only;
};
};
&spi_nand {
mediatek,nmbm;
mediatek,bmt-max-ratio = <1>;
mediatek,bmt-max-reserved-blocks = <64>;
};

View File

@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981b-cmcc-a10.dtsi"
/ {
model = "CMCC A10 (OpenWrt U-Boot layout)";
compatible = "cmcc,a10-ubootmod", "mediatek,mt7981";
};
&chosen {
bootargs = "root=/dev/fit0 rootwait";
rootdisk = <&ubi_rootdisk>;
};
&partitions {
partition@580000 {
compatible = "linux,ubi";
label = "ubi";
reg = <0x580000 0x7a80000>;
volumes {
ubi_rootdisk: ubi-volume-fit {
volname = "fit";
};
};
};
};

View File

@ -10,9 +10,6 @@
#include "mt7981.dtsi"
/ {
model = "CMCC A10";
compatible = "cmcc,a10", "mediatek,mt7981";
aliases {
led-boot = &boot_led;
led-failsafe = &boot_led;
@ -21,9 +18,7 @@
serial0 = &uart0;
};
chosen {
bootargs = "root=/dev/fit0 rootwait";
rootdisk = <&ubi_rootdisk>;
chosen: chosen {
stdout-path = "serial0:115200n8";
};
@ -137,13 +132,13 @@
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
partitions {
partitions: partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bl2";
label = "BL2";
reg = <0x0 0x100000>;
read-only;
};
@ -154,7 +149,7 @@
};
partition@180000 {
label = "factory";
label = "Factory";
reg = <0x180000 0x200000>;
read-only;
@ -188,22 +183,10 @@
};
partition@380000 {
label = "fip";
label = "FIP";
reg = <0x380000 0x200000>;
read-only;
};
partition@580000 {
compatible = "linux,ubi";
label = "ubi";
reg = <0x580000 0x7a80000>;
volumes {
ubi_rootdisk: ubi-volume-fit {
volname = "fit";
};
};
};
};
};
};

View File

@ -34,7 +34,8 @@ mediatek_setup_interfaces()
asus,rt-ax59u|\
cetron,ct3003|\
cetron,ct3003-ubootmod|\
cmcc,a10|\
cmcc,a10-stock|\
cmcc,a10-ubootmod|\
confiabits,mt7981|\
cudy,wr3000-v1|\
jcg,q30-pro|\

View File

@ -72,7 +72,7 @@ platform_do_upgrade() {
bananapi,bpi-r4|\
bananapi,bpi-r4-poe|\
cetron,ct3003-ubootmod|\
cmcc,a10|\
cmcc,a10-ubootmod|\
cmcc,rax3000m|\
cudy,tr3000-v1-ubootmod|\
gatonetworks,gdsp|\

View File

@ -534,11 +534,48 @@ define Device/cetron_ct3003-ubootmod
endef
TARGET_DEVICES += cetron_ct3003-ubootmod
define Device/cmcc_a10
define Device/cmcc_a10-stock
DEVICE_VENDOR := CMCC
DEVICE_MODEL := A10
DEVICE_DTS := mt7981b-cmcc-a10
DEVICE_VARIANT := (stock layout)
DEVICE_ALT0_VENDOR := SuperElectron
DEVICE_ALT0_MODEL := ZN-M5
DEVICE_ALT0_VARIANT := (stock layout)
DEVICE_ALT1_VENDOR := SuperElectron
DEVICE_ALT1_MODEL := ZN-M8
DEVICE_ALT1_VARIANT := (stock layout)
DEVICE_DTS := mt7981b-cmcc-a10-stock
DEVICE_DTS_DIR := ../dts
SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-rfb
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 65536k
KERNEL_IN_UBI := 1
IMAGES += factory.bin
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
KERNEL = kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
KERNEL_INITRAMFS = kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
endef
TARGET_DEVICES += cmcc_a10-stock
define Device/cmcc_a10-ubootmod
DEVICE_VENDOR := CMCC
DEVICE_MODEL := A10
DEVICE_VARIANT := (OpenWrt U-Boot layout)
DEVICE_ALT0_VENDOR := SuperElectron
DEVICE_ALT0_MODEL := ZN-M5
DEVICE_ALT0_VARIANT := (OpenWrt U-Boot layout)
DEVICE_ALT1_VENDOR := SuperElectron
DEVICE_ALT1_MODEL := ZN-M8
DEVICE_ALT1_VARIANT := (OpenWrt U-Boot layout)
DEVICE_DTS := mt7981b-cmcc-a10-ubootmod
DEVICE_DTS_DIR := ../dts
SUPPORTED_DEVICES += cmcc,a10
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
@ -556,7 +593,7 @@ define Device/cmcc_a10
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot cmcc_a10
endef
TARGET_DEVICES += cmcc_a10
TARGET_DEVICES += cmcc_a10-ubootmod
define Device/cmcc_rax3000m
DEVICE_VENDOR := CMCC