Xiaomi WiFi Router 3G

It's been close to a year and there's still no fully supported open source webflash bin for this? Will it ever? Don't get me wrong, appreciating all the efforts and "hacks" in this thread, but to be effective we need official support in the form of a webflashable .bin file. No need to register the device, no need to get another rom first, no need for ssh, etc. Just a .bin we can put in the router GUI firmware upgrade page.

any clue about this error:

root@open-:/etc/config# opkg install luci-ssl-openssl
Installing luci-ssl-openssl (git-18.145.51107-9de9a71-1) to root...
Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/luci/luci-ssl-openssl_git-18.145.51107-9de9a71-1_all.ipk
Installing zlib (1.2.11-2) to root...
Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/base/zlib_1.2.11-2_mipsel_24kc.ipk
Installing libopenssl (1.0.2o-1) to root...
Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/base/libopenssl_1.0.2o-1_mipsel_24kc.ipk
Installing libustream-openssl (2018-05-24-189cd38b-1) to root...
Downloading http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/base/libustream-openssl_2018-05-24-189cd38b-1_mipsel_24kc.ipk
Configuring zlib.
Configuring libopenssl.
Collected errors:

  • check_data_file_clashes: Package libustream-openssl wants to install file /lib/libustream-ssl.so
    But that file is already provided by package * libustream-mbedtls
  • opkg_install_cmd: Cannot install package luci-ssl-openssl.

I completely agree with you, ppl will be grateful when you accomplish it :slight_smile:

Hello. Who can tell how to turn off all indicators on the router at night on schedule ?? I do not understand how to do it. Help me please.

for both commands you could use crontab

to turn all triggers and leds off

echo none | tee /sys/class/leds/*/trigger && echo 0 | tee /sys/class/leds/*/brightness

to reload your led config (turn all indications on)
/etc/init.d/led restart

The green leds from the ethernet ports could not switched off because this are triggered directly by the phys

1 Like

Thank you very much

Hi everyone:
I have made a xiaomi router r3 to boot from spi flash,refer to https://www.jianshu.com/p/338f5f5a119d, and I soldered a 2p2t switch on it so that I can chose which flash to boot from. I think the way to change it is similar with r3g.
So I have a question that if there is any way to recognise both flashes when booted? If the answer is yes,then we can make it as a nand programer,It would be awsome !

This mod is also listed here

If you mean recognize from within linux this should be possible...
My suggestion is that this switch only configures the boot device from which the first programmcode is loaded. Uboot in this case.
Probably only your dts is missing the spi and or flash node toi recognize it and or you need to include kernel driver.

I dont think it would be similar to mir3 (mt7620) on mir3g(mt7621), because this are different soc´s and board layouts... But it would be great if anyone would achive this on mir3g.
I´d like to run a modified uboot on my mir3g, but bricking this device with nand and no jtag is currently to hot for me.

Thank you juppin .
I did the similar things just like you have mentioned in https://openwrt.org/toh/xiaomi/mir3#hardware_mods.
In spi I flush xiaomi mini's breed and Xiaomi Mini's firmware(of cause it can be changed to lede),but I can't find the nand device in system(neither mini's stock firmware or lede),am I miss something? I mean something like kernel driver or even I just ignore the actual device in /dev/ folder ?

You will need something like this in your dts file:

&spi0 {
	status = "okay";
	num-cs = <1>;

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "u-boot";
				reg = <0x000000 0x020000>;
				read-only;
			};

			partition@20000 {
				label = "firmware";
				reg = <0x020000 0x7d0000>;
			};
                        ...
		};
	};
};

Driver or something else should be already included because there are some devices that use spi nor flash instead of nand...

I doesn´t find your corresponding dts file... Which one does use MIR3? The one from Mini?

Very thanks.I'll try and feedback soon. And if it failed after the dts way,should I provide something like boot log?
Yes,I use mini's firmware in spi.

You could look into E1700.dts ...
It´s the same soc and does use spi nor flash.

But i don´t know what will happen if you have nand and spi flash defined... Probalby openwrt does look also in spi for firmware... Would be better to not label a partition as "firmware" in spi node.

Doesn´t look like the dts for mini is used for your mir3 because there is only spi flash defined and no nand...

OK.I'll try and wait my feedback plz, thank you again!

Sorry I'm a bit confused.
I look into your dts snippet, does "compatible = "jedec,spi-nor" mean it just compatible with spi-nor ?
My demand is when I boot from spi(now it can boot normally to lede/stock),I want system can read/write the nand partition,for example by dd or mtd etc.If I misunderstood it,plz ignore me.

Now i understand, you on spi you have mini firmware and on nand you have stock mir3 firmware...

Ok.

For nand you should take a look into this dts as example... Add the nand node with the right partiton layout to mini dts.
NA930.dts
MIWIFI-R3.dts

Please do a complete backup of all your nand partitions with dd before you do anything with it...
And as i said, do not name/label a nand partition as "firmware" on spi mini firmware...

Worked like a charm.

1 Like

I have tried but failed.I can't find the nand partition when I boot from spi with newer compiled firmware.
Here is my modified MIWIFI-MINI.dts

/dts-v1/;

#include "mt7620a.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "xiaomi,miwifi-mini", "ralink,mt7620a-soc";
	model = "Xiaomi MiWiFi Mini";

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	nand {
	status = "okay";
	#address-cells = <1>;
	#size-cells = <1>;	
	compatible = "mtk,mt7620-nand";

	partition@0 {
		label = "Bootloader";
		reg = <0x0 0x40000>;
		read-only;
	};

	partition@40000 {
		label = "Config";
		reg = <0x40000 0x40000>;
		read-only;
	};

	partition@80000 {
		label = "Bdata";
		reg = <0x80000 0x40000>;
		read-only;
	};

	partition@0xc0000 {
		label = "Factory";
		reg = <0xc0000 0x40000>;
		read-only;
	};

	partition@100000 {
		label = "crash";
		reg = <0x100000 0x40000>;
		read-only;
	};

	partition@140000 {
		label = "crash_syslog";
		reg = <0x140000 0x40000>;
		read-only;
	};

	partition@180000 {
		label = "reserved0";
		reg = <0x180000 0x80000>;
		read-only;
	};

	partition@200000 {
		label = "kernel0_rsvd";
		reg = <0x200000 0x400000>;
	};

	partition@600000 {
		label = "kernel";
		reg = <0x600000 0x400000>;
	};

	/* ubi partition is the result of squashing
	 * next consequent stock partitions:
	 * - rootfs0 (rootfs partition for stock kernel0), 
	 * - rootfs1 (rootfs partition for stock failsafe kernel1), 
	 * - overlay (used as ubi overlay in stock fw)
	 * resulting 117,5MiB space for packages.
	 */
	partition@a00000 {
		label = "ubi";
		reg = <0xa00000 0x7600000>;
	};
};

	gpio-leds {
		compatible = "gpio-leds";

		blue {
			label = "miwifi-mini:blue:status";
			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
		};

		yellow {
			label = "miwifi-mini:yellow:status";
			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
		};

		red {
			label = "miwifi-mini:red:status";
			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
		};
	};

	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
			linux,code = <KEY_RESTART>;
		};
	};
};

&gpio0 {
	status = "okay";
};

&gpio1 {
	status = "okay";
};

&gpio2 {
	status = "okay";
};

&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;

		partition@0 {
			label = "u-boot";
			reg = <0x0 0x30000>;
		};

		partition@30000 {
			label = "u-boot-env";
			reg = <0x30000 0x10000>;
			read-only;
		};

		factory: partition@40000 {
			label = "factory";
			reg = <0x40000 0x10000>;
			read-only;
		};

		partition@50000 {
			label = "firmware";
			reg = <0x50000 0xf80000>;
		};

		partition@fd0000 {
			label = "crash";
			reg = <0xfd0000 0x10000>;
		};

		partition@fe0000 {
			label = "reserved";
			reg = <0xfe0000 0x10000>;
			read-only;
		};

		partition@ff0000 {
			label = "Bdata";
			reg = <0xff0000 0x10000>;
		};
	};
};

&ehci {
	status = "okay";
};

&ohci {
	status = "okay";
};

&ethernet {
	pinctrl-names = "default";
	pinctrl-0 = <&ephy_pins>;
	mtd-mac-address = <&factory 0x28>;
	mediatek,portmap = "llllw";
};

&wmac {
	ralink,mtd-eeprom = <&factory 0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pa_pins>;
};

&pcie {
	status = "okay";

	pcie-bridge {
		mt76@0,0 {
			reg = <0x0000 0 0 0 0>;
			device_type = "pci";
			mediatek,mtd-eeprom = <&factory 0x8000>;
			ieee80211-freq-limit = <5000000 6000000>;
		};
	};
};

&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "i2c", "rgmii1";
			ralink,function = "gpio";
		};
	};
};

Any idea ?

what is the difference/advantage in spi flash and nand?
is it really worth the effort of soldering?

Dear All,

any chance lede will release a stable version rather then using snapshot?

By now I can choose which flash to boot from, So you can use two system/setting in one router,just like windows/linux in one pc :grinning:
And if I can read/write nand flash when boot from spi,then you can regard the router as a cheap nand programer,that would be great ! the real nand programer is somehow expensive.But by now it's beyond my knowlege,anyway I'll keep seeking solution,and hope someone have interest in it too.
Here is my dual os router now :sunglasses:
image
image
image
image

4 Likes