mediatek: add CMCC RAX3000M support
Hardware specification:
SoC: MediaTek MT7981B 2x A53
Flash: 64GB eMMC or 128 MB SPI-NAND
RAM: 512MB
Ethernet: 4x 10/100/1000 Mbps
Switch: MediaTek MT7531AE
WiFi: MediaTek MT7976C
Button: Reset, Mesh
Power: DC 12V 1A
- UART: 3.3v, 115200n8
--------------------------
| Layout |
| ----------------- |
| 4 | GND TX VCC RX | <= |
| ----------------- |
--------------------------
Gain SSH access:
1. Login into web interface, and download the configuration.
2. Enter fakeroot, decompress the configuration:
tar -zxf cfg_export_config_file.conf
3. Edit 'etc/config/dropbear', set 'enable' to '1'.
4. Edit 'etc/shadow', update (remove) root password:
'root::19523:0:99999:7:::'
5. Repack 'etc' directory:
tar -zcf cfg_export_config_file.conf etc/
* If you find an error about 'etc/wireless/mediatek/DBDC_card0.dat',
just ignore it.
6. Upload new configuration via web interface, now you can SSH to RAX3000M.
Check stroage type:
Check the label on the back of the device:
"CH EC CMIIT ID: xxxx" is eMMC version
"CH CMIIT ID: xxxx" is NAND version
eMMC Flash instructions:
1. SSH to RAX3000M, and backup everything, especially 'factory' part.
('data' partition can be ignored, it's useless.)
2. Write new GPT table:
dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-emmc-gpt.bin of=/dev/mmcblk0 bs=512 seek=0 count=34 conv=fsync
3. Erase and write new BL2:
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/dev/zero of=/dev/mmcblk0boot0 bs=512 count=8192 conv=fsync
dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-emmc-preloader.bin of=/dev/mmcblk0boot0 bs=512 conv=fsync
4. Erase and write new FIP:
dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=13312 count=8192 conv=fsync
dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-emmc-bl31-uboot.fip of=/dev/mmcblk0 bs=512 seek=13312 conv=fsync
5. Set static IP on your PC:
IP 192.168.1.254, GW 192.168.1.1
6. Serve OpenWrt initramfs image using TFTP server.
7. Cut off the power and re-engage, wait for TFTP recovery to complete.
8. After OpenWrt has booted, perform sysupgrade.
NAND Flash instructions:
1. SSH to RAX3000M, and backup everything, especially 'Factory' part.
2. Erase and write new BL2:
mtd erase BL2
mtd write openwrt-mediatek-filogic-cmcc_rax3000m-nand-preloader.bin BL2
3. Erase and write new FIP:
mtd erase FIP
mtd write openwrt-mediatek-filogic-cmcc_rax3000m-nand-bl31-uboot.fip FIP
4. Set static IP on your PC:
IP 192.168.1.254, GW 192.168.1.1
5. Serve OpenWrt initramfs image using TFTP server.
6. Cut off the power and re-engage, wait for TFTP recovery to complete.
7. After OpenWrt has booted, erase UBI volumes:
ubidetach -p /dev/mtd0
ubiformat -y /dev/mtd0
ubiattach -p /dev/mtd0
8. Create new ubootenv volumes:
ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB
ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
9. Additionally, if you want to have NAND recovery boot feature:
(Don't worry! You will always have TFTP recovery boot feature.)
ubimkvol /dev/ubi0 -n 2 -N recovery -s 20MiB
ubiupdatevol /dev/ubi0_2 openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb
10. Perform sysupgrade.
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -37,6 +37,23 @@ bananapi,bpi-r3)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
cmcc,rax3000m)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
local envdev=$(find_mmc_part "ubootenv" "mmcblk0")
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
|
||||
;;
|
||||
*)
|
||||
. /lib/upgrade/nand.sh
|
||||
local envubi=$(nand_find_ubi ubi)
|
||||
local envdev=/dev/$(nand_find_volume $envubi ubootenv)
|
||||
local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
|
||||
ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
glinet,gl-mt3000)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
|
||||
;;
|
||||
|
||||
58
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
Normal file
58
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-emmc.dtso
Normal file
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "cmcc,rax3000m", "mediatek,mt7981";
|
||||
|
||||
fragment@0 {
|
||||
target-path = "/";
|
||||
__overlay__ {
|
||||
reg_1p8v: regulator-1p8v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "fixed-1.8V";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&mmc0>;
|
||||
__overlay__ {
|
||||
bus-width = <8>;
|
||||
max-frequency = <26000000>;
|
||||
no-sd;
|
||||
no-sdio;
|
||||
non-removable;
|
||||
pinctrl-names = "default", "state_uhs";
|
||||
pinctrl-0 = <&mmc0_pins_default>;
|
||||
pinctrl-1 = <&mmc0_pins_uhs>;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
vqmmc-supply = <®_1p8v>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&pio>;
|
||||
__overlay__ {
|
||||
mmc0_pins_default: mmc0-pins {
|
||||
mux {
|
||||
function = "flash";
|
||||
groups = "emmc_45";
|
||||
};
|
||||
};
|
||||
|
||||
mmc0_pins_uhs: mmc0-uhs-pins {
|
||||
mux {
|
||||
function = "flash";
|
||||
groups = "emmc_45";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
128
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
Normal file
128
target/linux/mediatek/dts/mt7981b-cmcc-rax3000m-nand.dtso
Normal file
@@ -0,0 +1,128 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "cmcc,rax3000m", "mediatek,mt7981";
|
||||
|
||||
fragment@0 {
|
||||
target = <&gmac0>;
|
||||
__overlay__ {
|
||||
nvmem-cells = <&macaddr_factory_2a 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&gmac1>;
|
||||
__overlay__ {
|
||||
nvmem-cells = <&macaddr_factory_24 0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&pio>;
|
||||
__overlay__ {
|
||||
spi0_flash_pins: spi0-pins {
|
||||
mux {
|
||||
function = "spi";
|
||||
groups = "spi0", "spi0_wp_hold";
|
||||
};
|
||||
|
||||
conf-pu {
|
||||
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
drive-strength = <8>;
|
||||
mediatek,pull-up-adv = <0>; /* bias-disable */
|
||||
};
|
||||
|
||||
conf-pd {
|
||||
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
drive-strength = <8>;
|
||||
mediatek,pull-up-adv = <0>; /* bias-disable */
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&spi0>;
|
||||
__overlay__ {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spi0_flash_pins>;
|
||||
status = "okay";
|
||||
|
||||
spi_nand@0 {
|
||||
compatible = "spi-nand";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
reg = <0>;
|
||||
|
||||
spi-max-frequency = <52000000>;
|
||||
spi-tx-bus-width = <4>;
|
||||
spi-rx-bus-width = <4>;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "bl2";
|
||||
reg = <0x00000 0x0100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@100000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x100000 0x80000>;
|
||||
};
|
||||
|
||||
factory: partition@180000 {
|
||||
label = "factory";
|
||||
reg = <0x180000 0x200000>;
|
||||
read-only;
|
||||
|
||||
compatible = "nvmem-cells";
|
||||
nvmem-layout {
|
||||
compatible = "fixed-layout";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_factory_24: macaddr@24 {
|
||||
compatible = "mac-base";
|
||||
reg = <0x24 0x6>;
|
||||
#nvmem-cell-cells = <1>;
|
||||
};
|
||||
|
||||
macaddr_factory_2a: macaddr@2a {
|
||||
compatible = "mac-base";
|
||||
reg = <0x2a 0x6>;
|
||||
#nvmem-cell-cells = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
partition@380000 {
|
||||
label = "fip";
|
||||
reg = <0x380000 0x200000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@580000 {
|
||||
label = "ubi";
|
||||
reg = <0x580000 0x7200000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@4 {
|
||||
target = <&wifi>;
|
||||
__overlay__ {
|
||||
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -35,6 +35,7 @@ mediatek_setup_interfaces()
|
||||
glinet,gl-mt3000)
|
||||
ucidef_set_interfaces_lan_wan eth1 eth0
|
||||
;;
|
||||
cmcc,rax3000m|\
|
||||
cmcc,rax3000m-nand-ubootmod|\
|
||||
h3c,magic-nx30-pro|\
|
||||
h3c,magic-nx30-pro-nmbm|\
|
||||
@@ -91,6 +92,15 @@ mediatek_setup_macs()
|
||||
bananapi,bpi-r3)
|
||||
wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1)
|
||||
;;
|
||||
cmcc,rax3000m)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
wan_mac=$(mmc_get_mac_binary factory 0x2a)
|
||||
lan_mac=$(mmc_get_mac_binary factory 0x24)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
h3c,magic-nx30-pro|\
|
||||
h3c,magic-nx30-pro-nmbm)
|
||||
wan_mac=$(mtd_get_mac_ascii pdt_data_1 ethaddr)
|
||||
|
||||
@@ -14,6 +14,17 @@ case "$FIRMWARE" in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
|
||||
case "$board" in
|
||||
cmcc,rax3000m)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
caldata_extract_mmc "factory" 0x0 0xA0000
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"mediatek/mt7986_eeprom_mt7976.bin")
|
||||
case "$board" in
|
||||
acer,predator-w6)
|
||||
|
||||
@@ -36,6 +36,17 @@ case "$board" in
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
cmcc,rax3000m)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
addr=$(mmc_get_mac_binary factory 0xa)
|
||||
;;
|
||||
*)
|
||||
addr=$(mtd_get_mac_binary factory 0xa)
|
||||
;;
|
||||
esac
|
||||
[ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
cmcc,rax3000m-nand-ubootmod)
|
||||
[ "$PHYNBR" = "1" ] && mtd_get_mac_binary Factory 0xa > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
|
||||
@@ -81,6 +81,18 @@ platform_do_upgrade() {
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
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,wr3000-v1)
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
@@ -120,7 +132,8 @@ platform_check_image() {
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r3)
|
||||
bananapi,bpi-r3|\
|
||||
cmcc,rax3000m)
|
||||
[ "$magic" != "d00dfeed" ] && {
|
||||
echo "Invalid image type."
|
||||
return 1
|
||||
@@ -138,7 +151,8 @@ platform_check_image() {
|
||||
|
||||
platform_copy_config() {
|
||||
case "$(board_name)" in
|
||||
bananapi,bpi-r3)
|
||||
bananapi,bpi-r3|\
|
||||
cmcc,rax3000m)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
emmc_copy_config
|
||||
|
||||
@@ -226,6 +226,39 @@ define Device/cetron_ct3003-ubootmod
|
||||
endef
|
||||
TARGET_DEVICES += cetron_ct3003-ubootmod
|
||||
|
||||
define Device/cmcc_rax3000m
|
||||
DEVICE_VENDOR := CMCC
|
||||
DEVICE_MODEL := RAX3000M
|
||||
DEVICE_DTS := mt7981b-cmcc-rax3000m
|
||||
DEVICE_DTS_OVERLAY := mt7981b-cmcc-rax3000m-emmc mt7981b-cmcc-rax3000m-nand
|
||||
DEVICE_DTS_DIR := ../dts
|
||||
DEVICE_DTC_FLAGS := --pad 4096
|
||||
DEVICE_DTS_LOADADDR := 0x43f00000
|
||||
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 \
|
||||
automount f2fsck mkf2fs
|
||||
KERNEL_LOADADDR := 0x44000000
|
||||
KERNEL := kernel-bin | gzip
|
||||
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
||||
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
||||
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
||||
KERNEL_IN_UBI := 1
|
||||
UBOOTENV_IN_UBI := 1
|
||||
IMAGES := sysupgrade.itb
|
||||
IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
|
||||
IMAGE/sysupgrade.itb := append-kernel | \
|
||||
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | \
|
||||
pad-rootfs | append-metadata
|
||||
ARTIFACTS := \
|
||||
emmc-gpt.bin emmc-preloader.bin emmc-bl31-uboot.fip \
|
||||
nand-preloader.bin nand-bl31-uboot.fip
|
||||
ARTIFACT/emmc-gpt.bin := mt798x-gpt emmc
|
||||
ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr4
|
||||
ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-emmc
|
||||
ARTIFACT/nand-preloader.bin := mt7981-bl2 spim-nand-ddr4
|
||||
ARTIFACT/nand-bl31-uboot.fip := mt7981-bl31-uboot cmcc_rax3000m-nand
|
||||
endef
|
||||
TARGET_DEVICES += cmcc_rax3000m
|
||||
|
||||
define Device/cmcc_rax3000m-nand-ubootmod
|
||||
DEVICE_VENDOR := CMCC
|
||||
DEVICE_MODEL := RAX3000M NAND version (custom U-Boot layout)
|
||||
|
||||
Reference in New Issue
Block a user