Support for Xiaomi Wifi R3P Pro?


I did the installation using this procedure. But at the moment, the router is looping and I can't access over the network.

read the link ...

Reverting from OpenWRT to Stock Xiaomi firmware


1 Like

That is because snapshots come without luci and you always have to install it manually. Regarding the looping, you seem to flash wrong bin. It should be the one marked with sysupgrade if you update via the web UI. Finally, I also had a problem with persistence and I solved it by booting from TFTP, formatting UBI partition and then sysupgrading. But that requires UART cable.
To recover, I would first try to feed it xiaomi dev binary on a 1GB flash and see if it will catch it up... However, it's quite a small chance for this to happen. Why don't you try with UART?

1 Like

@babyangelhp mình ít dùg fb, nick cùng tên luubungit
có gì cài thử bản mới 4.14.141 xem, mt76 giờ xài rất tốt

@babyangelhp sorry it's taken so long.

no, you've got the files copying fine.

so last i saw you have an UART, right? i'm going to need a complete bootlog (including everything before the panic message you posted earlier)

so here's what your messages mean:

[    3.400000] Bad eraseblock 130 at 0x000001040000
[    3.410000] Bad eraseblock 147 at 0x000001260000
[    3.410000] Bad eraseblock 156 at 0x000001380000
[    3.430000] Bad eraseblock 203 at 0x000001960000
[    3.510000] Bad eraseblock 515 at 0x000004060000


1. [    4.150000] 0x000000a00000-0x000003200000 : "rootfs0"

means that your first 4 bad blocks are in the "rootfs0" partition. with openwrt i blow away rootfs0, rootfs1, and overlay, and just have one big "ubi" partition. the first part of that ends up being the squashfs read-only root filesystem, and the rest is the true "ubifs" (read-write, where your modified files go). ubifs can deal with bad blocks (or.. it theoretically can), so what you'd expect is that as long as the squashfs stuff fits in the not-bad part, you should be OK. so far so good.

it looks like squashfs is about 3MB, and your bad blocks start around the 6th MB into the partition... so things should be working actually.

the crash log portion you sent suggests that ubifs is coming across the bad block and is failing in a bad way. openwrt does some funny stuff with ubifs during installation, and there's probably a bug there.

so, having said all of that (and my apologies for the very late response):

  1. could you send me the full boot log of it crashing?
  2. your best bet is to tftp boot using the "initramfs" file, then once it's booted, do a sysupgrade. that almost certainly will work. it's a little fiddly, but not really too hard to setup a tftp server.
1 Like


I have been bricked and have restored my stock a few times using usb UART, but the last time I got this error:

[    4.841358]         ...
[    4.843796] Call Trace:
[    4.846252] [<8000c8d0>] show_stack+0x58/0x100
[    4.850707] [<804c5ecc>] dump_stack+0x9c/0xe0
[    4.855046] [<8033cf68>] do_sync_erase.part.7+0x118/0x2ac
[    4.860423] [<8033d448>] ubi_io_sync_erase+0x2ac/0x2e4
[    4.865539] [<8033e0d4>] sync_erase.isra.14+0x150/0x25c
[    4.870743] [<8033e33c>] __erase_worker+0x4c/0x4b0
[    4.875511] [<8033e804>] erase_worker+0x64/0x8c
[    4.880024] [<8033df40>] do_work+0xf8/0x13c
[    4.884188] [<80340140>] ubi_wl_get_peb+0xcc/0x26c
[    4.888960] [<80338c04>] try_write_vid_and_data+0x54/0x200
[    4.894420] [<8033a444>] ubi_eba_atomic_leb_change+0x208/0x314
[    4.900229] [<803309b0>] ubi_update_layout_vol+0x40/0x74
[    4.905516] [<8033106c>] ubi_change_vtbl_record+0xb0/0x104
[    4.910979] [<80332fc0>] ubi_resize_volume+0x254/0x4c4
[    4.916092] [<803343e0>] autoresize+0x144/0x1cc
[    4.920605] [<803355a8>] ubi_attach_mtd_dev+0x6e4/0xb44
[    4.925810] [<8064d634>] ubi_init+0x344/0x3fc
[    4.930150] [<80001650>] do_one_initcall+0xd0/0x1a0
[    4.935027] [<80634e38>] kernel_init_freeable+0x1ec/0x2ac
[    4.940405] [<804dd2d8>] kernel_init+0x10/0x10c
[    4.944914] [<80007078>] ret_from_kernel_thread+0x14/0x1c
[    4.950383] ubi0 error: __erase_worker: failed to erase PEB 1963, error -5
[    4.957226] ubi0: mark PEB 1963 as bad

The last time it was really hard to recover to stock using usb UART, I was scared of the error because I couldn't restore the stock.
Now that I am in the stock firmware, how do I install openwrt on my device, please help me. Thank you very much

@babyangelhp can you send me the FULL boot log? you had already posted this error message but i want to see how far it gets without this.

as for restoring stock... don't worry it's actually really easy to do (even if your system is completely messed up)... you just reverse the steps you took when telling the router to boot openwrt... unfortunately i don't have my UART handy (and it's a little hard for me to take the router offline)... maybe @pjgowtham or @andreykiselev can double check (it's in the uboot menu.. you basically set the flag_try_sys2_failed to 1 and flag_try_sys1_failed to 0.. then remember to save the settings and reboot)

now that you're on stock, to install openwrt you're going to setup a tftp server (on a pc), connect it (via ethernet) to the router, setup the IP settings (they have to be on the same subnet) and boot from it (again from the uboot menu)... there are online guides for setting up a tftp server.

anyway, once you've tftp booted (you're going to use the "initramfs" file, not "sysupgrade" or "factory") then you'll just do a sysupgrade and all should be well. oh and you'll need to make sure those flag_try_sys_failed settings are setup so your system is set to boot from sys2 (that is, sys1 should be "failed")

however, it would be nice (since you have an UART anyhow) to first install openwrt the "regular" way, save the bootlog, and then do the tftp thing (you won't need to restore to stock first). there's probably a bug there and it would be nice to at least have it filed or known.

I used the "initramfs" file and successfully installed openwrt on mi pro, but upon reboot the device immediately reverted to the stock firmware. After installing the "initramfs" file, do I need to install the "sysupgrade" or "factory" firmware?
I did the following:
Access ssh then use the command:
nvram set flag_try_sys1_failed = 1
nvram set flag_try_sys2_failed = 0
nvram set flag_boot_success = 0
nvram commit
Next I used the usb to install the "initramfs" file using tftp.
The installation was successful, but when the device reboots, it will return to the stock firmware.

right. so you're going to want to make sure you only boot (not install) the initramfs file. it sounds like you already did that. after you've booted that, do a sysupgrade using the "sysupgrade" file. then you should be fine.

Sorry is R3P will be included in official 19.07 build rota? Thx

Oh yes BTW can I check flash used from the packaging?

A short note here for those who (just like me) have problems with a UAS driver and USB3 external drives. The symptoms are that the device is recognized and you can see it with lsusb -t command. The driver lists uas, but the drive does not show up in /dev/sd*.

root@AndyNet:~# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-mtk/2p, 480M

At the same time, drives using usb-storage driver work well. Unfortunately, removing the kernel module or actually removing the module file does not solve the problem and the drive is listed without any driver at all. So, the solution is to set a quirk to hint the system to use a specific driver for the drive:

  1. Get the ID of the external drive with lsusb -v. There should be something like Bus 002 Device 002: ID 059f:105e LaCie, Ltd. Be careful to look for the actual device, not the USB hub.
  2. Edit /etc/modules.d/usb-storage and append quirks=DEVICE_ID:u, so in my case the line looks like usb-storage quirks=059f:105e:u
  3. Save and reboot. After reboot, check lsusb -t should list your drive with usb-storage driver instead of uas. And the drive should appear in /dev/.
  4. Enjoy!

A side note, I do have kmod-usb-core, kmod-usb3, kmod-usb-storage, and kmod-usb-storage-uas installed. And I do NOT have kmod-usb2 and kmod-usb-storage-extras.


Moved to open source (official) Openwrt today. Yey!

Some quick questions.

  1. 5Ghz speed seems to be 1/3 slower than the "closed" drivers. Is there any trick to fix that, or patience?
  2. Again on 5Ghz it seems that no other channel that 36 works (@80Mhz), at least for me. Is it a restriction? Am I doing something wrong?
1 Like

Hi @andreykiselev, Get reverse using the UART cable!

Now I came back again for the Xiaomi DEV ROM.

I am wanting to apply OpenWRT again but would not want to go through the same issues again.

I had the same problem that many reported here, after installation, when the router is restarted, all the initial version returns, does not save the changes, it is necessary to install LUCI again, etc.

I don't know what the problem is.

1 Like

There are one snapshots come with luci?

Is 160mhz channel possible?


the solution we recommend is to do a sysupgrade (after installation) to the same version ("sysupgrade" file) for cases where this happens. have you tried it?

@ilyas, you can have standard install log and the log by sysupgrade here!

hope it can help resolve "unable to mount the UBI partition" issue.

I have not tried that. Is there a procedure that teaches all the steps? Can you induce?