BPI R2 LEDE(openwrt) source code

I’m suffering from the same error. Please help me how you solved that problem. T…T

I am curious what is the current state of (official) OpenWrt on the R2? I see that they are regularly publishing images, but they claim the latest OpenWrt that supports the BPI R2 is 19.07.9?

Has the MT6625 driver made it into OpenWrt proper, or is it only in BPI’s older OpwnWrt versions? I don’t see it in the current OpenWrt source tree so I’m assuming it’s not there, but then I haven’t fully figured out their build system. If it’s not there is there any ongoing effort to getting it included?

I see no official mention of using the Mediatek Smart Phone Flash Tool to flash the eMMC image. Have people used this tool with much success? OpenWrt’s device pages for the R2 don’t mention it, but they seem to publish a scatter file for it with every release.

Afair @dangowrt / @dwmw2 wrote image building scripts,but imho they are not avalable in main branch.

Mt6625 driver is too huge and dirty to be ever merged to official openwrt.

I have not seen any way using a flashtool for r2

The new images will be part of the upcoming 22.03.0 release, we branched off a couple of days ago.

You can already download pre-release images from

https://downloads.openwrt.org/releases/22.03-SNAPSHOT/targets/mediatek/mt7623/

Soon there is going to be release candidate images and then the official release will follow in a couple of weeks.

The MT6625 WiFi driver is not supported in any official version of OpenWrt and will need porting in case you want to use it.

Porting can be found in my repo, just use the main branch for target kernel version (maybe newer one if there are additional patches in openwrt). But imho it is tricky to get it into the build system

Perhaps we can make a custom repo that contains the wifi driver as a package. Then that repo can be added to a stock OpenWrt /etc/opkg/customfeeds.conf.

This flash tool works quite well. You can skip having any sort of MicroSD card image and write directly to eMMC. The stock OpenWrt BPI R2 21.02.02 image will flash and boot this way. Though right now I’m having a problem getting WAN DHCP to work, but I’m still in the early stages. (EDIT: DHCP works fine, was a dumb error, besides not having the MT6625 driver, the current 21.02.2 image seems to work just fine)

I can post full instructions if needed. You can mostly follow the debricking instructions on OpenWrt’s u7623 board wiki page and just use the scatter file, preloader, and uncompressed BPI R2 images.

I’m having trouble getting your repo to build - I was able to work around some of the sources not downloading, but the MT6625 package builds as an empty package.

Maybe you have defined driver as builtin and not as module? Do you have any build errors?

As i said i don’t know openwrts build system very well

just remember that you need additional files (wmt-tools, config, firmware-blob) to initialize the mt6625 wifi. depending on the openwrt-source you may need a newer version of the driver (till 5.17 in my repo in the main branches)…openwrt has many backportings so maybe some api-changes from recent versions are in openwrts “5.10”

With OpenWrt making it as a “builtin” is supposed to cause the package to be in the rootfs of the image. Compiling it as a module is supposed to compile it as an installable package. It doesn’t matter what I select, in either case the image builds but the actual kernel modules are absent. I get a package file, but it is empty in either case:

-rw-r--r-- 1 root root 909 Apr 12 23:46 kmod-mt6625l-wlan-gen2_5.4.28+2019-09-01-5a8fafb8-1_arm_cortex-a7_neon-vfpv4.ipk

The “package” has nothing except the opkg control files inside it.

Me neither. I have to say, I find their build system extremely frustrating. It is one of the biggest impediments to contributing to the project.

If anyone has the right magic for getting the package to actually build, I’d appreciate it.

Do you see in buildlog,that driver is compiled without errors?

Maybe publish your repo and @dangowrt or @dwmw2 can look into the changes?

It is your public repo I’m using: https://www.github.com/frank-w/openwrt

I’m trying to build the standalone MT6625 kernel module package:

<M> kmod-mt6625l-wlan-gen2............ Mediatek MT6625L wireless chip support

My openwrt repo is old version i forked some years ago…

I meant my kernel repo…BPI-R2-4.14…it contains all kernel version from 4.14 to 5.18-rc

It’s the only repo I know of that has the standalone (not in-tree) MT6625 driver set up as an OpenWrt package. Do you know any other location for the out-of-tree driver?

The in-tree version will require a lot more work to port into an OpenWrt package.

i’m not sure it was ever working…afair it was only a try…there was a repo imho from @abbradar that added the driver. but all sources are for older linux-versions an may not compile due to api-changes.

so imho it’s better to add the version i have in the kernel repo to a patchfile in openwrt to patch kernel directly (in-tree)

maybe you can look in my openwrt repo, and adapt the way to include newer driver version. But if this source creates empty package i guess it’s broken anyway

Yes, I’ve already been working on this in parallel, but OpenWrt doesn’t make this easy.

I have got this driver into the tree and got it to build, but I can’t test it. OpenWrt’s cfg80211 driver causes a kernel panic when it is built with the “Testmode command support” that this driver requires. Even if I take a vanilla OpenWrt 21.02.2 pull, use their configuration and make the sole change of enabling the cfg80211 driver’s testmode support it causes a kernel panic when loaded.

So I am working on debugging OpenWrt’s cfg80211 before I can test this out.

I am frustrated.

The way OpenWrt is designed at the moment you cannot have wireless drivers in the Linux tree because all cfg80211 and mac80211 are built using out-of-tree backports. You will have to build the driver as out-of-tree module and using cfg80211 headers from backports rather than Linux sources.

See mt76 package for an example how to do that in principle (obviously the driver sources as well as build-system will need some changes for that to work).

And well, yes, the build system is a mess and generating the wireless backports using semantic patches and all that is quite a science for itself…

Thanks for the advice. I’m doing ok with the actual driver porting. I’m still fighting with the build system, but at least I have something that compiles. I’m only three symbols short of it actually loading, so I think I might have something in the next day or two.

My biggest issue now is that there is clearly a bug in OpenWrt’s cfg80211 module as they supply it. If I take a vanilla 21.02.2 build, make the sole change of checking “Enable Testmode Command Support” for kmod-cfg80211 (which is something the mt6625 driver needs) then any time I load any other working wireless driver the cfg80211 module oopses and causes a kernel panic. There is clearly something wrong in their backports, and that is where I’m going to have the biggest problem debugging.

you could try dropping testmode depency…i guess it’s not really needed, only defined in Kconfig. maybe some code needs to be disabled. imho driver should be working without

Where are you do you “Enable Testmode Command Support”?

Are you using CONFIG_PACKAGE_CFG80211_TESTMODE?