kernelPatches: ath driver: allow setting regulatory domain - #108725
Conversation
There was a problem hiding this comment.
Can you use structuredExtraConfig instead? Like this:
nixpkgs/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix
Lines 28 to 36 in bf0589a
There was a problem hiding this comment.
Thanks for your comment! Your example, however, refers to a derivation of an entire kernel rather than an implementation of a mere patch. Therefore, I'm not sure how to adopt this approach. At least, according to the documentation, a kernelPatch doesn't have an attribute structuredExtraConfig. Could you elaborate please?
Ports an OpenWRT patch for Atheros wireless drivers (ath*) which allows the user to change the regulatory domain code to the one which actually applies. All Atheros devices have a regulatory domain burned into their EEPROM. When using a device as AP, this domain is frequently overly restrictive when compared to the regulation which applies in the country the device actually operates in; often, this restriction disallows IR on all channels making it impossible to use the device as an AP at all. This commit introduces the NixOS config option networking.wireless.athUserRegulatoryDomain which, if enabled, applies the patch and sets the kernel config option ATH_USER_REGD. The original OpenWRT patch targets Linux 5.8.
|
This is a semi-automatic executed nixpkgs-review which does not build all packages (e.g. lumo, tensorflow or pytorch) Result of 1 package blacklisted:
|
I'm not sure what this output means for this PR. Please elaborate. |
|
I wonder if adding an option is the right thing to do. I have no strong opinion on the question, I'm just raising the idea. |
Thanks for your comment! Actually, I was just wondering what's the most straight-forward way to enable this patch from a user's perspective. I see your point though. Do you have an example of a package that follows your proposal? |
|
They are in the |
|
In fact, the patch of this PR is already added to the |
nixpkgs-review does not build tests. |
After some thought, it will probably not work because a patch is not a derivation and will not be listed in the package search. So let's forget about this. A vm built with { config, pkgs, lib, ...}: {
config = {
users.users.root.initialPassword = "root";
console = {
font = "Lat2-Terminus16";
keyMap = "fr";
};
boot.kernelParams = [ "systemd.log_level=debug" ];
networking.wireless.athUserRegulatoryDomain =true;
boot.kernelPackages = pkgs.linuxPackages_latest;
};
}compiles and boots, so it looks good to me. cc @NeQuissimus for a second, more informed, opinion. If noone complains I'll merge next week or the week after. |
|
One thing that is going to be tricky here is that sometimes kernel patches break with minor versions, sometimes with patch level releases. |
|
Good point! Actually, this patch has been part of OpenWRT long before 5.8 and I'd assume it also works for versions <5.8. I just introduced the "at least 5.8" requirement as this is the kernel version of OpenWRT for the commit the patch relates to and I didn't test any version before. I didn't consider it's worth it for the reasons you mentioned. Regarding the compatibility with 5.10.x: No worries, it works as a charm so far :)
I depend on this patch (my wifi router runs NixOS). Therefore, I can commit to maintain this patch (best-effort, of course). |
|
Then I shall have no objections :D |
|
The best test I can think of is compiling the latest kernel with this patch applied, boot it, and execute |
|
The patch is really short in fact, and only makes some functions return true. A conflict is not impossible but I this this explains that "this patch has been part of OpenWRT long before 5.8". |
Test for the option `networking.wireless.athUserRegulatoryDomain` to make sure the underlying patch still applies for the latest kernel. Also see #108725.
|
@veehaitch just wanted to say thank you for pulling in this patch. I spent about a week trying to track down why the ath10k card in a router I'm setting up wouldn't allow an AP on 5GHz despite setting the |
|
@veehaitch thanks too! It's great to be able to use NixOS with the nice patches from OpenWRT! Unfortunatly, I found about this after I created a custom package for patching the module (and not the whole kernel, which would take forever on my machine: https://github.com/PaulGrandperrin/nix-systems/blob/main/packages/kernel-module-ath-patched.nix) Anyway, since this patch is basically trivial and already part of the NixOS tests (and therefor hydra's build closure), why not include it by default?
CC @RaitoBezarius because he already changed some kernel conf to make ath easier to use by default in #239780. |
Ports an OpenWRT patch for Atheros wireless drivers (ath*) which allows
the user to change the regulatory domain code to the one which actually
applies.
All Atheros devices have a regulatory domain burned into their EEPROM.
When using a device as AP, this domain is frequently overly restrictive
when compared to the regulation which applies in the country the device
actually operates in; often, this restriction disallows IR on all
channels making it impossible to use the device as an AP at all.
This commit introduces the NixOS config option
networking.wireless.athUserRegulatoryDomain which, if enabled, applies
the patch and sets the kernel config option ATH_USER_REGD.
The original OpenWRT patch targets Linux 5.8.
Tested with a Compex WLE900VX (Qualcomm Atheros QCA986x/988x 802.11ac)
on NixOS master running Linux 5.10.5.
Motivation for this change
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)