Xiaomi mi wifi 3 support


#1

im very interested in this router are there any hopes for there being support soon?
it has the same hardware as the nano


Is Mi Router 3 (mir3) supported?
Is Mi Router 3 (mir3) supported?
What's your favourite cheap LEDE/OpenWrt device?
#2

So looks like the "mi wifi mini" firmware is compatible.

While looking at https://wiki.openwrt.org/toh/xiaomi/mir3 and https://wiki.openwrt.org/toh/xiaomi/mini, there're no instructions on how to write the LEDE firmware onto wifi 3 router. The regular "mini" instructions state:

If you find a line "OS1" go ahead with flashing:  # mtd -r write <firmware-image you downloaded> OS1

There's no "OS1" partition on the mini 3 tho:

root@XiaoQiang:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 08000000 00020000 "ALL"
mtd1: 00040000 00020000 "Bootloader"
mtd2: 00040000 00020000 "Config"
mtd3: 00040000 00020000 "Bdata"
mtd4: 00040000 00020000 "Factory"
mtd5: 00040000 00020000 "crash"
mtd6: 00040000 00020000 "crash_syslog"
mtd7: 00080000 00020000 "reserved0"
mtd8: 00400000 00020000 "kernel0"
mtd9: 00400000 00020000 "kernel1"
mtd10: 02000000 00020000 "rootfs0"
mtd11: 02000000 00020000 "rootfs1"
mtd12: 03600000 00020000 "overlay"

Do I run: mtd -r write <firmware-image you downloaded> rootfs1?

Or how can I find which partition to write LEDE firmware to?


#3

I was very short on time and looks like wifi 3 uses NAND while wifi mini does not, so I ended up flashing Padavan's firmware.


#4

Yes,it uses NAND.
That is only difference


#5

Is there any plan to support this device?
By the looks of it it already does use OpenWRT, but it "calls home" to 2 Chinese domains, so I do not plan to use the original firmware.
For now it just sits in my network-bin box...


#6

Looks like the partitions (or at least their names) are different too.


#7

Yes,everything about flash memory is different.
That is only difference,unfortunately I do not know ho do make a proper DTS for it.
It would be great to have LEDE for it since it is great router


#8

xiaomi router 3 flash lede must upgrade uboot,but no have supported nand flash uboot now.
if you use spi flash insted the nand flash ,it supported.
I'm build a nand flash firmware,but I'm not tested,because my router's nand uboot it's bad,
I'm used spi flash now.


#9

Stupid question. The router apparently does run OpenWRT - I flashed "dev" version of the firmware and using ssh I've seen the file structure.
Now, how big of a rework would it be to take the mi wifi mini partition and "mix-and-match" it with the Xiaomi version?
I really do not want my home router to call home...


#10

This PR for Mi Router 3G looks like it could be modified to also support R3
https://github.com/lede-project/source/pull/1299


#11

I have built LEDE images for R3,but I cant test them.
If anyone wants to try here they are:
https://drive.google.com/drive/folders/0B1VOQQ-_EIXKcmVHOEJpbmFKNGs?usp=sharing

Instructions should be the following:
Installation through telnet/ssh:

copy lede-ramips-mt7621-mir3g-squashfs-kernel1.bin and lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin to usb disk or wget it from LEDE download site to /tmp
switch to /extdisks/sda1/ (if copied to USB drive) or to /tmp if wgetted from LEDE download site
run: mtd write lede-ramips-mt7621-mir3g-squashfs-kernel1.bin kernel1
run: mtd write lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin rootfs0
run: mtd erase kernel0
run: reboot

As always I am I no way responsible for any damage that can incurr


#12

tried the image and did follow the commands. However boot not possible :frowning:

U-Boot 1.1.3 (Apr 15 2016 - 17:46:32)

Board: Ralink APSoC DRAM:  128 MB
Power on memory test. Memory size= 128 MB...OK!
relocate_code Pointer at: 87fb8000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
******************************
Software System Reset Occurred
******************************
!!! nand page size = 2048, addr len=4
..============================================
Ralink UBoot Version: 4.2.S.1
--------------------------------------------
ASIC 7620_MP (Port5<->None)
DRAM_CONF_FROM: Auto-detection
DRAM_TYPE: DDR2
DRAM component: 1024 Mbits
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: NAND Flash
Date:Apr 15 2016  Time:17:46:32
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 580 MHZ ####
 estimate memory size =128 Mbytes

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   9: Load Boot Loader code then write to Flash via TFTP.


3: System Boot system code via Flash.
Booting System 2
..ranand_erase_write: offs:40000, count:20000
.Done!
done
## Booting image at bc600000 ...
   Image Name:   MIPS LEDE Linux-4.9.44
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1351940 Bytes =  1.3 MB
   Load Address: 80000000
   Entry Point:  80000000
.....................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
commandline uart_en=0 factory_mode=0 mem=128m
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 4.9.44 (robimarko@Builder) (gcc version 5.4.0 (LEDE GCC 5.4.0 r4710-34b5230) ) #0 Fri Aug 18 13:02:29 2017
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is Xiaomi MiWiFi R3
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0007e000
[    0.000000] Readback ErrCtl register=0007e000
[    0.000000] Memory: 125404K/131072K available (3139K kernel code, 157K rwdata, 752K rodata, 168K init, 216K bss, 5668K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000011] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007577] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.070067] pid_max: default: 32768 minimum: 301
[    0.074685] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.081058] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.094793] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.104342] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.110298] pinctrl core: initialized pinctrl subsystem
[    0.116000] NET: Registered protocol family 16
[    0.381764] PCI host bridge /pcie@10140000 ranges:
[    0.386378]  MEM 0x0000000020000000..0x000000002fffffff
[    0.391430]   IO 0x0000000010160000..0x000000001016ffff
[    0.410089] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.415484] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.421892] rt2880_gpio 10000638.gpio: registering 16 gpios
[    0.427270] rt2880_gpio 10000638.gpio: registering 16 irq handlers
[    0.433606] rt2880_gpio 10000660.gpio: registering 32 gpios
[    0.43.........   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
commandline uart_en=0 factory_mode=0 mem=128m
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 4.9.44 (robimarko@Builder) (gcc version 5.4.0 (LEDE GCC 5.4.0 r4710-34b5230) ) #0 Fri Aug 18 13:02:29 2017
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is Xiaomi MiWiFi R3
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0007e000
[    0.000000] Readback ErrCtl register=0007e000
[    0.000000] Memory: 125404K/131072K available (3139K kernel code, 157K rwdata, 752K rodata, 168K init, 216K bss, 5668K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000011] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007577] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.070068] pid_max: default: 32768 minimum: 301
[    0.074687] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.081060] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.094795] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.104345] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.110300] pinctrl core: initialized pinctrl subsystem
[    0.116002] NET: Registered protocol family 16
[    0.381766] PCI host bridge /pcie@10140000 ranges:
[    0.386381]  MEM 0x0000000020000000..0x000000002fffffff
[    0.391433]   IO 0x0000000010160000..0x000000001016ffff
[    0.410092] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.415487] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.421895] rt2880_gpio 10000638.gpio: registering 16 gpios
[    0.427273] rt2880_gpio 10000638.gpio: registering 16 irq handlers
[    0.433609] rt2880_gpio 10000660.gpio: registering 32 gpios
[    0.438983] rt2880_gpio 10000660.gpio: registering 32 irq handlers
[    0.445839] PCI host bridge to bus 0000:00
[    0.449765] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.456475] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    0.462182] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.468786] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.476938] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.485464] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.491832] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.498639] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.505188] pci 0000:00:00.0: BAR 9: assigned [mem 0x20100000-0x201fffff pref]
[    0.512216] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.518803] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[    0.525923] pci 0000:01:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
[    0.532909] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.537741] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.544322] pci 0000:00:00.0:   bridge window [mem 0x20100000-0x201fffff pref]
[    0.551365] pci 0000:00:00.0: card - bus=0x0, slot = 0x0 irq=0
[    0.557005] pci 0000:01:00.0: card - bus=0x1, slot = 0x0 irq=4
[    0.566367] clocksource: Switched to clocksource systick
[    0.572826] NET: Registered protocol family 2
[    0.577923] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.584648] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.590873] TCP: Hash tables configured (established 1024 bind 1024)
[    0.597107] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.602731] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.609121] NET: Registered protocol family 1
[    0.615647] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.622335] Crashlog allocated RAM at address 0x3f00000
[    0.628703] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.643149] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.648797] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.667118] io scheduler noop registered
[    0.670863] io scheduler deadline registered (default)
[    0.676070] ralink-usb-phy usbphy: invalid resource
[    0.681434] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.688704] console [ttyS0] disabled
[    0.692158] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.701833] console [ttyS0] enabled
[    0.701833] console [ttyS0] enabled
[    0.708867] bootconsole [early0] disabled
[    0.708867] bootconsole [early0] disabled
[    0.718835] libphy: Fixed MDIO Bus: probed
[    0.728868] gsw: setting port4 to ephy mode
[    0.733187] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 4 link up (100Mbps/Full duplex)
[    0.742590] mtk_soc_eth 10100000.ethernet: generated random MAC address 02:8e:40:99:1a:0a
[    0.751027] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    0.757944] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.766991] rt2880_wdt 10000120.watchdog: Initialized
[    0.773287] NET: Registered protocol family 10
[    0.780964] NET: Registered protocol family 17
[    0.785564] 8021q: 802.1Q VLAN Support v1.8
[    0.792607] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.800314] Please append a correct "root=" boot option; here are the available partitions:
[    0.808849] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.818504] Rebooting in 1 seconds..

#13

used commands:

root@XiaoQiang:/tmp# mtd write lede-ramips-mt7620-miwifi-r3-squashfs-kernel1.bin kernel1
Unlocking kernel1 ...

Writing from lede-ramips-mt7620-miwifi-r3-squashfs-kernel1.bin to kernel1 ...

root@XiaoQiang:/tmp# mtd write lede-ramips-mt7620-miwifi-r3-squashfs-rootfs0.bin rootfs0
Unlocking rootfs0 ...

Writing from lede-ramips-mt7620-miwifi-r3-squashfs-rootfs0.bin to rootfs0 ...
root@XiaoQiang:/tmp# mtd erase kernel0
Unlocking kernel0 ...
Erasing kernel0 ...
root@XiaoQiang:/tmp# reboot


#14

@dgiese I will look into the log today and try to fix it.
Can you try booting kernel image and then sysupgrading?


#15

Cannot do anything at the moment. As Xiaomi disables the console write and the reset button for recovery does not work, i have to wait a few day until i get access to a nand flasher.


#16

Yeah,I completelly forgot that they disable console by default


#17

Your nand driver is not starting, show me DTS that you have made


#18

To enable console run these commands while in u-boot
setenv uart_en 1
saveenv
You can also restore from tftp procedure


#19

You can find my R3 branch here:

and DTS is here:


#20

You've forgot & here, should be &nand

And you should put it outside of main brackets, it's a seldom node, not within any other, like this one


Put that &nand node just before &gpio0