Just passing here to say thanks to @edeso and to confirm that his method worked for me (2GHz wifi and LAN only). Then upgrading to openwrt-22.03.3-ramips-mt76x8-xiaomi_mi-router-4a-100m-squashfs-sysupgrade.bin
did the job :).
Note that it worked with a slightly different layout:
root@XiaoQiang:~# cat /proc/mtd
dev: size erasesize name
mtd0: 01000000 00010000 "ALL"
mtd1: 00020000 00010000 "Bootloader"
mtd2: 00010000 00010000 "NULL"
mtd3: 00010000 00010000 "Factory"
mtd4: 00010000 00010000 "crash"
mtd5: 00010000 00010000 "cfg_bak"
mtd6: 00100000 00010000 "overlay"
mtd7: 00c60000 00010000 "OS1"
mtd8: 00b00000 00010000 "rootfs"
mtd9: 00230000 00010000 "disk"
mtd10: 00010000 00010000 "Config"
billic
December 10, 2023, 9:44am
22
Nothing interesting in my reply. There is an new revision, and it requires 7663, 7615 etc. But there is no stuff at current snapshot (=
Building mage with custom dts and other stuff (.targetinfo
, target/linux/ramips/image/mt76x8.mk
, etc...) bring me error messages:
* opkg_install_cmd: Cannot install package kmod-mt7603.
* opkg_install_cmd: Cannot install package kmod-mt7615e.
* opkg_install_cmd: Cannot install package kmod-mt7663-firmware-ap.
As we can see, current 5.15.141-1 kernel has no this modules, but 5.15.140-1 did.
original post:
Found similar issue. Bought the R4A 100m router with international stock firmware (around december 2023). It has R4AC label on back side, After invasion found some strange thing with mtd layout:
mtd6: 00100000 00010000 “overlay”
and after flashing international firmware i've got a brick. Restoring via TFTP with international firmware gave no success. But R4A did.
After flashing last openwrt-ramips-mt76x8-xiaomi_mi-router-4a-100m-squashfs-sysupgrade.bin
got successfully booted OpenWRT. But it without 5GHz wireless interface. Looks like there is some other revision on international R4AC with R4A flash layout.
billic
December 25, 2023, 10:49pm
23
made successful build at snapshot with this patch (4pda ). dts was taken from BestMC's imagebuilder .
Link looks broken. Can someone post the patch for v2?
billic
January 22, 2024, 10:28pm
25
There is active PR for this patch. It will be included in upstream if someone could help with review.
2 Likes
chanRG
February 15, 2024, 9:48am
26
I compiled the image about a week ago and my colleague @sergio-gimenez and i have been running it on 10 routers, all of them work perfectly. Thank you very much.
We had different layouts on different routers but the image still worked, here's another layout example:
root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00020000 00010000 "bootloader"
mtd1: 00010000 00010000 "config"
mtd2: 00010000 00010000 "factory"
mtd3: 00010000 00010000 "crash"
mtd4: 00010000 00010000 "cfg_bak"
mtd5: 00100000 00010000 "overlay"
mtd6: 00ea0000 00010000 "firmware"
mtd7: 00232d49 00010000 "kernel"
mtd8: 00c6d2b7 00010000 "rootfs"
mtd9: 008e0000 00010000 "rootfs_data"
How can we help to validate the PR? I'm not really familiar with that.
r0nmlt
March 2, 2024, 11:05am
27
Is there a guide how to compile this as I have never compiled firmwares and I'm running this device on a snapshot that @werecatf had uploaded.
billic
April 11, 2024, 2:03pm
28
actually, I have no idea how to cast users with review permission)
I hope that all valid PR will be merged at new release. Cause there is no other steps at special wiki page :
Fork the project to a public repo using GitHub web interface, clone the repo to your computer, create a branch for your changes, push these back to GitHub and submit a pull request.
So I have no an idea is there any other mechanisms to speedup this pull request)
billic
April 11, 2024, 2:07pm
29
I used this steps; You can clone repo with PR and checkout to billic:xiaomi-r4ac-100m-intl-v2 branch. Then you can follow main instruction and build own image)
r0nmlt
April 11, 2024, 3:29pm
30
Thanks will look into it.
Thank you so much, I think, I have the same device like yours and I followed your method and it is installed. Thanks again.....
billic
August 4, 2024, 9:34am
34
It was forked from main repo on late 2023. There was 23.05.02 . 23.05.4 was released in july but my PR seens
PR means Pull Request I made into main repo from my fork. But it stil on review after eight months and I have no ability to speedup accep code to main repo. Only 2 of 6 required reviewers made an action. Looks like OpenWRT developers has no ability to review all incoming code.
mbunal
August 4, 2024, 10:34am
35
I tried to compile latest code (23.05.4) with your modified files:
mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dts
mt76x8.mk
01_leds
02_network
but I stuck an error about eeprom_factory_8000 label not found.
can you help me?
billic
August 4, 2024, 11:37am
36
AFAIK easiest way to create firmware is a Imagebuilder way .
Download one, then put these files into it and pray.
Can you show more logs? eeprom_factotry_8000 is available in ...intl-v2.dts file and something becomes wrong before if it could not be found.
mbunal
August 5, 2024, 3:05am
37
error is:
touch /23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/.image
make -C image compile install TARGET_BUILD=
make[5]: Entering directory '/23.05.4/target/linux/ramips/image'
make[5]: Nothing to be done for 'compile'.
mipsel-openwrt-linux-musl-cpp -nostdinc -x assembler-with-cpp -I/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/arch/mips/boot/dts -I/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/arch/mips/boot/dts/include -I/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/include/ -undef -D__DTS__ -o /23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dtb.tmp ../dts/mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dts /23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/scripts/dtc/dtc -O dtb -i../dts/ -Wno-unit_address_vs_reg -Wno-simple_bus_reg -Wno-unit_address_format -Wno-pci_bridge -Wno-pci_device_bus_num -Wno-pci_device_reg -Wno-avoid_unnecessary_addr_size -Wno-alias_paths -Wno-graph_child_address -Wno-graph_port -Wno-unique_unit_address -o /23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dtb /23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dtb.tmp
Error: ./dts/mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dts:60.1-21 Label or path eeprom_factory_8000 not found
FATAL ERROR: Syntax error parsing input tree
make[5]: *** [Makefile:235: /23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m-intl-v2.dtb] Error 1
make[5]: Leaving directory '/23.05.4/target/linux/ramips/image'
make[4]: *** [Makefile:22: install] Error 2
make[4]: Leaving directory '/23.05.4/target/linux/ramips'
make[3]: *** [Makefile:11: install] Error 2
make[3]: Leaving directory '/23.05.4/target/linux'
time: target/linux/install#28.31#7.45#32.90
ERROR: target/linux failed to build.
make[2]: *** [target/Makefile:32: target/linux/install] Error 1
make[2]: Leaving directory '/23.05.4'
make[1]: *** [target/Makefile:26: /23.05.4/staging_dir/target-mipsel_24kc_musl/stamp/.target_install] Error 2
make[1]: Leaving directory '/23.05.4'
make: *** [/23.05.4/include/toplevel.mk:232: world] Error 2
dts file is:
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7628an_xiaomi_mi-router-4.dtsi"
#include <dt-bindings/leds/common.h>
/ {
compatible = "xiaomi,mi-router-4a-100m-intl-v2", "mediatek,mt7628an-soc";
model = "Xiaomi Mi Router 4A (100M International Edition V2)";
aliases {
led-boot = &led_power_yellow;
led-failsafe = &led_power_yellow;
led-running = &led_power_blue;
led-upgrade = &led_power_yellow;
label-mac-device = ðernet;
};
leds {
compatible = "gpio-leds";
led_power_blue: power_blue {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_POWER;
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
};
led_power_yellow: power_yellow {
color = <LED_COLOR_ID_YELLOW>;
function = LED_FUNCTION_POWER;
gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
};
wan {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_WAN;
gpios = <&gpio 37 GPIO_ACTIVE_LOW>;
};
};
};
&partitions {
partition@60000 {
label = "overlay";
reg = <0x60000 0x100000>;
read-only;
};
partition@160000 {
label = "firmware";
reg = <0x160000 0xea0000>;
compatible = "denx,uimage";
};
};
&pcie {
status = "okay";
};
&eeprom_factory_8000 {
/* MT7613 has different eeprom size '0x4da8' */
/* See https://github.com/openwrt/openwrt/pull/13587 */
/* You can also see this in mt76/mt7615/eeprom.h: */
/* MT7615_EEPROM_FULL_SIZE = MT7615_EEPROM_TXDPD_OFFSET + \ */
/* MT7615_EEPROM_TXDPD_COUNT * MT7615_EEPROM_TXDPD_SIZE */
/* where MT7615_EEPROM_TXDPD_OFFSET is 1024 + 256 * 34 = 9728: */
/* MT7615_EEPROM_SIZE(1024 defined in mt7615.h) + \ */
/* MT7615_EEPROM_DCOC_COUNT(34) * MT7615_EEPROM_DCOC_SIZE(256)*/
/* where MT7615_EEPROM_TXDPD_COUNT = 44 + 3 = 47 */
/* and MT7615_EEPROM_TXDPD_SIZE = 216. */
/* Altogether it will be 19880 or 0x4da8. */
reg = <0x8000 0x4da8>;
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_8000>;
nvmem-cell-names = "eeprom";
ieee80211-freq-limit = <5000000 6000000>;
};
};
ðernet {
nvmem-cells = <&macaddr_factory_4 (-1)>;
nvmem-cell-names = "mac-address";
};
&esw {
mediatek,portmap = <0x3e>;
mediatek,portdisable = <0x2a>;
};
billic
August 7, 2024, 10:51pm
38
Sounds strange... I see definition of eeprom_factory_8000
at mt7628an_xiaomi_mi-router-4.dtsi
file whick included at 3rd line.
Can you build firmware with ...100m-intl.dts
file? What about mt7621_xiaomi_mi-router-4a-gigabit-v2.dts
which has same MT7613?
mbunal
August 8, 2024, 10:03pm
39
I tried with 23.05.4. Since mt7621_xiaomi_mi-router-4a-gigabit-v2.dts is officially supported, there is no problem. but I can't compile intl-v2.dts
mbunal
August 11, 2024, 2:48pm
40
what does this mean?
make -C image compile install TARGET_BUILD=
make[5]: Entering directory '/ext4-8tb/mbu/abacik/23.05.4/target/linux/ramips/image'
make[5]: Nothing to be done for 'compile'.
mipsel-openwrt-linux-musl-cpp -nostdinc -x assembler-with-cpp -I/ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/arch/mips/boot/dts -I/ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/arch/mips/boot/dts/include -I/ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/include/ -undef -D__DTS__ -o /ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m.dtb.tmp ../dts/mt7628an_xiaomi_mi-router-4a-100m.dts
/ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-5.15.162/scripts/dtc/dtc -O dtb -i../dts/ -Wno-unit_address_vs_reg -Wno-simple_bus_reg -Wno-unit_address_format -Wno-pci_bridge -Wno-pci_device_bus_num -Wno-pci_device_reg -Wno-avoid_unnecessary_addr_size -Wno-alias_paths -Wno-graph_child_address -Wno-graph_port -Wno-unique_unit_address -o /ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m.dtb /ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m.dtb.tmp
Error: ../dts/mt7628an_xiaomi_mi-router-4a-100m.dts:76.1-9 Label or path factory not found
FATAL ERROR: Syntax error parsing input tree
make[5]: *** [Makefile:235: /ext4-8tb/mbu/abacik/23.05.4/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/image-mt7628an_xiaomi_mi-router-4a-100m.dtb] Error 1
make[5]: Leaving directory '/ext4-8tb/mbu/abacik/23.05.4/target/linux/ramips/image'
make[4]: *** [Makefile:22: install] Error 2
make[4]: Leaving directory '/ext4-8tb/mbu/abacik/23.05.4/target/linux/ramips'
make[3]: *** [Makefile:11: install] Error 2
make[3]: Leaving directory '/ext4-8tb/mbu/abacik/23.05.4/target/linux'
time: target/linux/install#35.77#8.69#42.82
ERROR: target/linux failed to build.
make[2]: *** [target/Makefile:32: target/linux/install] Error 1
make[2]: Leaving directory '/ext4-8tb/mbu/abacik/23.05.4'
make[1]: *** [target/Makefile:26: /ext4-8tb/mbu/abacik/23.05.4/staging_dir/target-mipsel_24kc_musl/stamp/.target_install] Error 2
make[1]: Leaving directory '/ext4-8tb/mbu/abacik/23.05.4'
make: *** [/ext4-8tb/mbu/abacik/23.05.4/include/toplevel.mk:232: world] Error 2
billic
August 11, 2024, 8:24pm
41
It means that there is some syntax error in dts-file. It can't found definition of eeprom_factory_8000. As you said before. But there is an definition at target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi (line 63)
I have no an idea how this happened so I asked you to try to build another version with same method (eeprom_factory_8000 included from similar file)