Adding OpenWrt support for Xiaomi Mi Router 3G NOR

Hello,
This device (NAND to 16 MB NOR spi flash modded mir3g) is already supported by an OpenWrt fork but not by vanilla OpenWrt. I guess there are all necessary files on the OpenWrt fork which is called X-WRT github repo but I want to add them to the vanilla OpenWrt. I'm not a dev so I'm totally confused. Can you please help me with this?

In addition, Xiaomi Mi Router 3G NOR profile on X-WRT firmware is working fine. I think no changes will be necessary.

DTS file: https://github.com/x-wrt/x-wrt/blob/master/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g-nor.dts
mt7621.mk file: https://github.com/x-wrt/x-wrt/blob/master/target/linux/ramips/image/mt7621.mk
01_leds file: https://github.com/x-wrt/x-wrt/blob/master/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
02_network file: https://github.com/x-wrt/x-wrt/blob/master/target/linux/ramips/mt7621/base-files/etc/board.d/02_network

Thank you for your help in advance.
Regards.

ulpian

Good news!! :smiley:

I gathered up my courage and decided to do it myself. I took the original file as a reference and included the necessary additions in my OpenWrt fork. And then I compiled an image for myself. Everything seems fine for now.
I've created a PR for adding support for this device. I hope I didn't do anything wrong. This is very my first time doing something like this.

ulpian

1 Like

In general, custom hardware means custom firmware - because of that, this getting merged into OpenWrt is not very likely.

Hello good morning!!
Thank you for your reply and explanation. To be honest I never thought like that. I don't know if there has been such an example before.

Yes you're right, it is a NOR modified variant of the same device.
I know that there are people who modify and use their device like this for various reasons. (Bad nand blocks, corrupted bootloader etc.) I'm one of them. But while the device itself is already supported, I don't see any harm in not adding a new variant. But you know that's me. Otherwise I agreed that that's pretty reasonable and acceptable.


In addition,
I know I will be so extra, but if PR is not accepted, how can I compile the vanilla 21.02.X version for myself for this device? Do you have an idea about it? I think I can only compile master snapshots at the moment. Thank you.

ulpian

The problem is, it's a one-off device - you picked a 16 MB flash chip, others might go with 8 MB (because they have it/ salvaged it from another device) or a 32 MB flash (yes, 4 bit addressing might make this harder). How to agree on the partitioning, where to start, where to stop.

This question has come up in the past with 4/32 devices and users replacing flash/ RAM chips on those, the resulting consensus was that only the unmodified OEM devices (which sell in huge quantities of identical devices) are considered for merging.

The "vanilla 21.02.X version" would imply unmodified OpenWrt, which in turn means that you can't do that (even if this PR were accepted to master, chances of this being accepted as a backport to 21.02.x would be essentially zero, device backports for stable releases are the (rare-) exception (for trivial additions and common devices), not the rule). You'd have to maintain your patches locally and rebase them as needed.

Thank you for the information you provided. I really appreciate your help. :smiley:


About 21.02.X section

even if this PR were accepted to master

Oh no, not like that actually. I meant that how can I build a 21.02.1 firmware (with default official 21.02.1 config) to use on my very own device. Since we both assume that it'll very likely be rejected by OpenWrt. Can I do this personally? Or not. It is not required to be officially built by github.com/openwrt. I think that's what you called backport. Right?

Please forgive me if my questions sounds silly to you. I can't find my way on the internet because I don't even know the right keywords. I think I've bitten off more than I can chew! LOL

I really appreciate your support. You're awesome!

ulpian