[BPI-R2] MT7615 Wifi no IR flag

Hello guys hopefully somebody can help me here. I recently got a R2 and a MT7615 card for Wifi, my image is a self-build Alpine 3.13.3 and it works great.

Now after I got the internal wifi working and now wanted to add a better card I aquired the MT7615 card, but ever 5GHz channel has the “no IR” flag which means no channel is usable. Hence hostapd will not select a channel.

I use @frank-w kernel 5.10 and have also tried 5.4 both have the same issue. I have the “wireless-regdb” package installed the kernel still erros with “platform regulatory.0: Direct firmware load for regulatory.db failed with error -2” “cfg80211: failed to load regulatory.db” I also tried to compile the kernels with cfg80211 as a module which fails. Lots of “undefined reference” errors. Hence I cannot pass any argument to cfg80211 like described in multiple wikis.

“iw reg set US” or any other (DE,GB,JP) doesn’t work. I need help it seems I cannot do anything.

in debian you have to install regdb, iw and maybe others.

https://wiki.fw-web.de/doku.php?id=en:bpi-r2:wlan#ghz

I’m using Alpine Linux, regdb and iw is installed. Alpine doesn’t have the crda package anymore. Can be checked here for why:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=007f6c5e6eb45c81ee89368a5f226572ae638831

I checked your wiki first and foremost before I even made this thread, nothing in there could help me.

then it looks like you need to recompile Kernel with CONFIG_CFG80211_INTERNAL_REGDB enabled

just compile kernel using the build.sh on debian/ubuntu-Host…there should be no undefined symbols if you only add this option…cfg80211 should be already a module

I’ve been compiling your kernel how it is described in your wiki

./build.sh importconfig

./build.sh config (checking some things here)

./build.sh

Your config uses CFG80211=y if I change it in the menuconfig to M there are a lot of errors.

“CONFIG_CFG80211_INTERNAL_REGDB” seems to not exist in “net/wireless/Kconfig” I’m using your branch “5.10-main”, should I use another one?

I just added the “CONFIG_CFG80211_INTERNAL_REGDB=y” to .config and am now compiling. Will report back if it did anything.

Oh and I compile on a Ubuntu 16.04 LTS.

After recompiling with “CONFIG_CFG80211_INTERNAL_REGDB=y” in the .config again and uploading everything to my R2 it’s still the same. Nothing changed.

From what I read in the kernel patchwork this option doesn’t exist anymore?

The patch you’ve linked adds this option (CONFIG_CFG80211_INTERNAL_REGDB),but maybe it cannot be set in menuconfig

Ok,seems builtin,i thought i had it made as module because of this (pass reg domain).

Please do not change .config directly as there may be depencies…change it in menuconfig (./build.sh config)

1 Like

https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

Said option doesn’t exist anymore hence no option in menuconfig nor any mention anymore in “net/wireless/Kconfig”

So alpine needs the package again :slight_smile:

According to what I’m reading crda should not be need anymore as the kernel now does everything with the regulatory.db but the kernel doesn’t load it, failing with:

“platform regulatory.0: Direct firmware load for regulatory.db failed with error -2”

“cfg80211: failed to load regulatory.db”

There is a regulatory.db file in /lib/firmware due to the wireless-regdb package, why doesn’t the kernel load it? What does error -2 mean?

Have you both files copied to /lib/firmware:

Btw error is printed here for further investigation

https://elixir.bootlin.com/linux/latest/source/net/wireless/reg.c#L1029

btw. i get same info on bootup and it seems not related

root@bpi-r2:~# dmesg | grep regulatory                                          
[    8.439895] cfg80211: Loading compiled-in X.509 certificates for regulatory e
[    8.464767] platform regulatory.0: Direct firmware load for regulatory.db fa2
[    8.473454] cfg80211: failed to load regulatory.db                           
root@bpi-r2:~# iw reg get                                                       
global                                                                          
country 00: DFS-UNSET                                                           
        (2402 - 2472 @ 40), (N/A, 20), (N/A)                                    
        (2457 - 2482 @ 20), (N/A, 20), (N/A), AUTO-BW, NO-IR                    
        (2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM, NO-IR                    
        (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW, NO-IR                    
        (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW, NO-IR              
        (5490 - 5730 @ 160), (N/A, 20), (0 ms), DFS, NO-IR                      
        (5735 - 5835 @ 80), (N/A, 20), (N/A), NO-IR                             
        (57240 - 63720 @ 2160), (N/A, 0), (N/A)                                 
                                                                                
root@bpi-r2:~# iw reg set DE                                                    
root@bpi-r2:~# iw reg get                                                       
global                                                                          
country DE: DFS-ETSI                                                            
        (2400 - 2483 @ 40), (N/A, 20), (N/A)                                    
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR, AUTO-BW               
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW         
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS                             
        (5725 - 5875 @ 80), (N/A, 13), (N/A)                                    
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)                                
                                                                                
root@bpi-r2:~#

and yes moving cfg80211 to module seems to break r2 internal wifi-driver, if i drop the driver i can compile kernel without errors. so if you don’t need internal wifi (i guess you cannot use it in alpine, disable CONFIG_MTK_COMBO) you can compile kernel with cfg80211 as module (but i think this will not help much)

1 Like

@frank-w This did the trick!!

Getting cfg80211 as a module and modprobing it with “ieee80211_regdom=US” removed all the “no IR” flags.

So how do we get to compile the kernel with the internal wlan and cfg80211 as a module?

With much work,i cannot do currently…

Imho cfg80211 needs to be linked into wifi-module too or all function calls need to be changed

1 Like

Is there no way to define that variable inside the kernel, like pass “ieee80211_regdom=US” inside the kernel? That way I could compile a kernel with everything and that variable doesn’t need to change after.

As a dirty hack you can maybe set alpha2[0] and [1] before calling this:

https://elixir.bootlin.com/linux/latest/source/net/wireless/reg.c#L554

1 Like

Uh, I hate to ask, but I’m no programer, to what should I set this? Let’s say for US or DE or GB? Should I just replce the COUNTRY=%c%c to COUNTRY=DE for example?

This should work too,but i guess you need to drop both parameters alpha2

1 Like

I don’t know what you mean with “dropping both parameters” but I found a static variable? at the top of the file and inserted U and S respectively but sadly that didn’t work.

Change

snprintf(country, sizeof(country), "COUNTRY=%c%c", alpha2[0], alpha2[1]);

To

snprintf(country, sizeof(country)), "COUNTRY=US");

1 Like

Ok changed the line you pointed out, sadly it doesn’t work. Still “country 00: DFS-UNSET” and can’t change with “iw reg set US”, thank you anyways. If you happen to know anything else, I’m willing to try :slight_smile: