Support for Xiaomi Wifi R3P Pro?

@pellmen yeah i saw your message ... i started reading the code (from the readme) but i have many distractions :wink:

1 Like

Hi all!

Another Xiaomi R3P with Micron NAND here. Do you need one more hardware to test firmware?

root@XiaoQiang:~# dmesg | grep "Manufacturer ID: "
[    3.340000] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit), 256MiB, page size: 2048, OOB size: 64

Could you tell me if it is safe and simple?
What about bad blocks?
It is possible to skip it in bootloader?

@apichlinski hello and welcome!

yes, i need more hardware!... @andreykiselev has been an amazing help, but i really need someone with bad blocks on their Micron chip... (he almost certainly also has bad blocks but his bad-block-table appears to be messed up, so it's not the same...

do you have bad blocks? (please say yes)

as for "safe and simple"... nothing we're doing touches the bootloader, so you can't hard-brick your router (so don't worry about that)... you can however (and almost certainly will) end up with a bootloop (or a crashed system) which is easy to recover from, (worst case i or someone here can walk you through it) but you will definitely need a UART...

i'm not sure what you mean by "is it possible to skip it in bootloader"... but touching the bootloader is a scary and risky thing, and it's not something i'm planning to do or recommend :wink: anyhow, things should "just work" without modifying the bootloader

PS: if you're thinking about pandorabox's "modified bootloader for Micron with bad blocks" (discussed on 4pda) i'm not sure but my guess is they decided to avoid the problem completely by putting both kernel and the rootfs on a UBI partition (which is actually a very good idea), and they needed to modify the bootloader to add UBI support... we keep the kernel on a raw partition, so we have more problems :wink:

1 Like

This is for people who are trying to install additional packages:

My apologies to all... "add all repositories by default" is an openwrt build option, but i often end up playing around with the build options, and I guess I used to have that on and I don't have it on for the last build I pushed out (and I don't think it's worth a new "release" just to fix that...)

People have also been having problems because my "release" is based on kernel 4.14.104 and the latest "snapshot" has moved on to 4.14.104... The (extremely simple) script below will fix your repositories (to add "luci", "packages", "routing" and "telephony") and will also point to version 4.14.104 of openwrt/snapshot (which should be completely compatible with my latest release). Openwrt snapshots does things a little strange (ie, "kmods" doesn't have everything in "core" so it is possible that some "core" packages won't show up in 'opkg list' ... it was a tradeoff. If it doesn't work for you, edit /etc/opkg/distfeeds.conf and remove the '#' at the beginning of line 2)

To add the repositories run this (copy and paste the whole block into an ssh window):

cp /etc/opkg/distfeeds.conf /etc/opkg/distfeeds.conf-bak
cat > /etc/opkg/distfeeds.conf << EOF
src/gz openwrt_kmods http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/kmods/4.14.104-1-eb8ed4b9bf234e78fd5debca12157d30/
#src/gz openwrt_core http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/packages/
src/gz openwrt_base http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base
src/gz openwrt_packages http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages
src/gz openwrt_telephony http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/telephony
src/gz openwrt_routing http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/routing
src/gz openwrt_luci http://downloads.openwrt.org/snapshots/packages/mipsel_24kc/luci
EOF
opkg update

PS: When installing a kernel module, (ie, a package that starts with "kmod-") opkg will still complain that the versions don't match... make sure that it's trying to install version 4.14.104 (of whatever kernel module it is) then run opkg again like so:

opkg --force-depends install kmod-mtd-rw

1 Like

It's not risky for now. If you have spi flash, you can flash the bootloader to it, stick it to board of r3p (you have to solder J10 and J11 contacts to boot from spi) till bootloader boots, then take it off and flash the normal bootloader to nand. After flashing you have to unsolder J10 and J11 and boot normaly from nand. It's easy. I've done it for a several times. You can find the bootloader for spi here

3 Likes

@pellmen you my friend are a scary scary hacker :wink:

1 Like

I think, if you interested in it, we could make a bootloader, that can do a dualboot.

For example, we can separate nand for two parts (~120Mb each part). One part will have stock, another - openwrt. One part will boot normaly. Another part will boot only when we press "reload button" on start. But it's only an idea for now)))

@pellmen i think something like that is a good idea... it would be useful for testers at least :wink: or at least to enter "stock xiaomi recovery" mode when the button is pressed on power-on (that should be a fairly trivial modification)... in fact... come to think of it... doing that infamous 30/30 trick should do that (can't test it right now.. business hours ;))

EDIT: actually, in terms of modifying the bootloader... i think it would make a whole lot more sense to add UBI support to the bootloader (see an earlier post) so we can put both the kernel and the rootfs on UBI (and deal automagically with bad blocks)

1 Like

@ilyas Done, the full log is available here: https://ufile.io/dzw9m. Anything to check before I use sysupgrade?

@ilyas @PeLLmEn Doesn't u-boot have UBI support in its mainline? At least, there is a doc on using UBI here: http://www.denx.de/wiki/publish/DULG/DULG-enbw_cmc.html#Section_5.9.3.6....

@ilyas is this yours? Can we try it, or it compiled by openwrt team without wifi driver support??
http://downloads.openwrt.org/snapshots/targets/ramips/mt7621/packages/

1 Like

looks like basic support... no wifi mod

Wow
I just reboot my second r3p with modules mac80211 and its shows wlan0 and wlan1

[   14.310271] mt7615e 0000:01:00.0: Invalid MAC address, using random address ba:82:5c:43:76:3c
[   14.346232] mt7615e 0000:01:00.0: HW/SW Version: 0x8a108a10, Build Time: 20180518100604a
[   14.346232]
[   14.521386] mt7615e 0000:01:00.0: N9 Firmware Version: _reserved_, Build Time: 20190103180756
[   14.579018] mt7615e 0000:01:00.0: CR4 Firmware Version: _reserved_, Build Time: 20181207140436
[   22.233246] bus=0x2, slot = 0x1, irq=0x0
[   22.237237] PCI: Enabling device 0000:00:01.0 (0004 -> 0006)
[   22.245478] mt7615e 0000:02:00.0: Invalid MAC address, using random address 76:73:b6:a0:b5:4f
[   22.271208] mt7615e 0000:02:00.0: HW/SW Version: 0x8a108a10, Build Time: 20180518100604a
[   22.271208]
[   22.296670] mt7615e 0000:02:00.0: N9 Firmware Version: _reserved_, Build Time: 20190103180756
[   22.311988] mt7615e 0000:02:00.0: CR4 Firmware Version: _reserved_, Build Time: 20181207140436

root@OpenWrt:/# iwconfig
br-lan    no wireless extensions.

wlan0     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

eth0.1    no wireless extensions.

lo        no wireless extensions.

wlan1     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

eth0.2    no wireless extensions.

eth0      no wireless extensions.
root@OpenWrt:/# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr 78:11:DC:05:39:69  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::7a11:dcff:fe05:3969/64 Scope:Link
          inet6 addr: fda1:16e6:913e::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1784 (1.7 KiB)

eth0      Link encap:Ethernet  HWaddr 78:11:DC:05:39:68  
          inet6 addr: fe80::7a11:dcff:fe05:3968/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:125 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:34795 (33.9 KiB)
          Interrupt:21 

eth0.1    Link encap:Ethernet  HWaddr 78:11:DC:05:39:69  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1784 (1.7 KiB)

eth0.2    Link encap:Ethernet  HWaddr 78:11:DC:05:39:68  
          inet6 addr: fe80::7a11:dcff:fe05:3968/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:29682 (28.9 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10880 (10.6 KiB)  TX bytes:10880 (10.6 KiB)

wlan0     Link encap:Ethernet  HWaddr BA:82:5C:43:76:3C  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan1     Link encap:Ethernet  HWaddr 76:73:B6:A0:B5:4F  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
1 Like

@pellmen :slight_smile: whoops. I guess I forgot to read the message that told me my changes had been accepted :wink: so now openwrt/r3p is official!

(too bad... there were some further changes I wanted to make... like hsdma etc)... maybe we'll have to have a follow-up "push"...

it doesn't have wifi support. it might take some time to iron out the details of whether openwrt will accept the closed-source mt7615e module as a "package" or not. so... don't run out and install :wink: (well, the wireless modules may still work if installed as a package... who knows)

@lolyinseo .... wow!

you mean this is my "release" of openwrt/r3p + the mt7615 package i uploaded? bizarre that it loads after a reboot (maybe something to do with pci?)

so.... the interfaces come up... can you actually connect to them? :wink:

@andreykiselev dunno... i'm basing my statement that "we need UBI support in the bootloader" on a comment I read on 4pda (where they were sharing the pandorabox-for-r3p-with-micron-chips-and-bad-blocks firmware ;))

btw, are you sure you don't have ECC? this is from your latest bootlog:

ECC: 1 corrected bitflip(s) at offset 0x00800000
ECC: 1 corrected bitflip(s) at offset 0x01120000

yep

looks like configuration this mod via luci is broken (( i will try via ssh

root@OpenWrt:/# iw dev
phy#1
        Interface wlan1
                ifindex 4
                wdev 0x100000001
                addr 06:6b:68:db:f7:c8
                type managed
                txpower 0.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes        tx-packets
                        0       0       0       0       0       0       0       0               0
phy#0
        Interface wlan0
                ifindex 3
                wdev 0x1
                addr ea:0d:96:f7:dd:37
                type managed
                txpower 20.00 dBm
                multicast TXQ:
                        qsz-byt qsz-pkt flows   drops   marks   overlmt hashcol tx-bytes        tx-packets
                        0       0       0       0       0       0       0       0               0
root@OpenWrt:/# iw list
Wiphy phy1
        max # scan SSIDs: 4
        max scan IEs length: 2247 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        max # scan plans: 1
        max scan plan interval: -1
        max scan plan iterations: 0
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Available Antennas: TX 0xf RX 0xf
        Supported interface modes:
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
        Band 2:
                Capabilities: 0x1ff
                        RX LDPC
                        HT20/HT40
                        SM Power Save disabled
                        RX Greenfield
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 3839 bytes
                        No DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 4 usec (0x05)
                HT TX/RX MCS rate indexes supported: 0-31
                VHT Capabilities (0x038001fa):
                        Max MPDU length: 11454
                        Supported Channel Width: 160 MHz, 80+80 MHz
                        RX LDPC
                        short GI (80 MHz)
                        short GI (160/80+80 MHz)
                        TX STBC
                VHT RX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: MCS 0-9
                        4 streams: MCS 0-9
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT RX highest supported: 0 Mbps
                VHT TX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: MCS 0-9
                        4 streams: MCS 0-9
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT TX highest supported: 0 Mbps
                Frequencies:
                        * 5180 MHz [36] (20.0 dBm)
                        * 5200 MHz [40] (20.0 dBm)
                        * 5220 MHz [44] (20.0 dBm)
                        * 5240 MHz [48] (20.0 dBm)
                        * 5260 MHz [52] (20.0 dBm) (no IR, radar detection)
                        * 5280 MHz [56] (20.0 dBm) (no IR, radar detection)
                        * 5300 MHz [60] (20.0 dBm) (no IR, radar detection)
                        * 5320 MHz [64] (20.0 dBm) (no IR, radar detection)
                        * 5500 MHz [100] (20.0 dBm) (no IR, radar detection)
                        * 5520 MHz [104] (20.0 dBm) (no IR, radar detection)
                        * 5540 MHz [108] (20.0 dBm) (no IR, radar detection)
                        * 5560 MHz [112] (20.0 dBm) (no IR, radar detection)
                        * 5580 MHz [116] (20.0 dBm) (no IR, radar detection)
                        * 5600 MHz [120] (20.0 dBm) (no IR, radar detection)
                        * 5620 MHz [124] (20.0 dBm) (no IR, radar detection)
                        * 5640 MHz [128] (20.0 dBm) (no IR, radar detection)
                        * 5660 MHz [132] (20.0 dBm) (no IR, radar detection)
                        * 5680 MHz [136] (20.0 dBm) (no IR, radar detection)
                        * 5700 MHz [140] (20.0 dBm) (no IR, radar detection)
                        * 5745 MHz [149] (20.0 dBm) (no IR)
                        * 5765 MHz [153] (20.0 dBm) (no IR)
                        * 5785 MHz [157] (20.0 dBm) (no IR)
                        * 5805 MHz [161] (20.0 dBm) (no IR)
                        * 5825 MHz [165] (20.0 dBm) (no IR)
        valid interface combinations:
                 * #{ AP } <= 4,
                   total <= 4, #channels <= 1, STA/AP BI must match
        HT Capability overrides:
                 * MCS: ff ff ff ff ff ff ff ff ff ff
                 * maximum A-MSDU length
                 * supported channel width
                 * short GI for 40 MHz
                 * max A-MPDU length exponent
                 * min MPDU start spacing
        Supported extended features:
                * [ RRM ]: RRM
                * [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
                * [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
                * [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
Wiphy phy0
        max # scan SSIDs: 4
        max scan IEs length: 2257 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        max # scan plans: 1
        max scan plan interval: -1
        max scan plan iterations: 0
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Available Antennas: TX 0xf RX 0xf
        Supported interface modes:
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
        Band 1:
                Capabilities: 0x1ff
                        RX LDPC
                        HT20/HT40
                        SM Power Save disabled
                        RX Greenfield
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 3839 bytes
                        No DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 4 usec (0x05)
                HT TX/RX MCS rate indexes supported: 0-31
                Frequencies:
                        * 2412 MHz [1] (20.0 dBm)
                        * 2417 MHz [2] (20.0 dBm)
                        * 2422 MHz [3] (20.0 dBm)
                        * 2427 MHz [4] (20.0 dBm)
                        * 2432 MHz [5] (20.0 dBm)
                        * 2437 MHz [6] (20.0 dBm)
                        * 2442 MHz [7] (20.0 dBm)
                        * 2447 MHz [8] (20.0 dBm)
                        * 2452 MHz [9] (20.0 dBm)
                        * 2457 MHz [10] (20.0 dBm)
                        * 2462 MHz [11] (20.0 dBm)
                        * 2467 MHz [12] (20.0 dBm) (no IR)
                        * 2472 MHz [13] (20.0 dBm) (no IR)
                        * 2484 MHz [14] (20.0 dBm) (no IR)
        valid interface combinations:
                 * #{ AP } <= 4,
                   total <= 4, #channels <= 1, STA/AP BI must match
        HT Capability overrides:
                 * MCS: ff ff ff ff ff ff ff ff ff ff
                 * maximum A-MSDU length
                 * supported channel width
                 * short GI for 40 MHz
                 * max A-MPDU length exponent
                 * min MPDU start spacing
        Supported extended features:
                * [ RRM ]: RRM
                * [ CQM_RSSI_LIST ]: multiple CQM_RSSI_THOLD records
                * [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
                * [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
root@OpenWrt:/#

1 Like

No, I am not sure. I deliberately disabled hardware ECC in the memory chip when I was flashing raw image. But ECC should be handled by the driver. If the memory chip does not have a hardware ECC generator, then it's all managed by the driver in software. Alternatively, since this is a standard ONFI feature, I guess, the driver should be able to check and set it on its own. So, since I have no knowledge in the internals of this driver, I cannot say for sure what is the status of HW ECC now...

1 Like

Here's all logs, that you've asked.

https://yadi.sk/d/i1VvggafSADixQ

And my friend has discovered, why changes to settings don't want to save. On the first login after first firmware installing you have to set New password and relogin. If you leave stock password and make changes to settings, they will work only to the next reboot and will reset after it.

1 Like

@lolyinseo that's pretty impressive... can you connect?