qemu: switch to building wireless as kernel modules

This is a hefty change

* add support for kernel backports project
* build wireless stack/drivers as modules from a backported kernel
* create a service to load/unload the modules
This commit is contained in:
Daniel Barlow
2023-02-22 18:41:41 +00:00
parent 891db9edc5
commit 751920c8fc
9 changed files with 388 additions and 32 deletions

View File

@@ -60,6 +60,11 @@ in {
};
loadAddress = mkOption { default = null; };
entryPoint = mkOption { };
radios = mkOption {
type = types.listOf types.str;
default = [];
example = ["ath9k" "ath10k"];
};
};
};
config = {

View File

@@ -3,35 +3,38 @@ let
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
inherit (pkgs.pseudofile) dir symlink;
inherit (pkgs) busybox;
mac80211 = pkgs.mac80211.override {
drivers = config.device.radios;
klibBuild = config.outputs.kernel.modulesupport;
};
in {
config = {
services.wlan_module = mac80211;
kernel = rec {
config = {
CFG80211= "y";
MAC80211= "y";
MAC80211_MESH= "y";
RFKILL= "y";
WLAN = "y";
# if/when we switch to using backported mac80211 drivers built
# as modules, based on nixwrt code we expect we will need this config
# to enable them
# "ASN1" = "y";
# "ASYMMETRIC_KEY_TYPE" = "y";
# "ASYMMETRIC_PUBLIC_KEY_SUBTYPE" = "y";
# "CRC_CCITT" = "y";
# "CRYPTO" = "y";
# "CRYPTO_ARC4" = "y";
# "CRYPTO_CBC" = "y";
# "CRYPTO_CCM" = "y";
# "CRYPTO_CMAC" = "y";
# "CRYPTO_GCM" = "y";
# "CRYPTO_HASH_INFO" = "y";
# "CRYPTO_LIB_ARC4" = "y";
# "CRYPTO_RSA" = "y";
# "CRYPTO_SHA1" = "y";
# "ENCRYPTED_KEYS" = "y";
# "KEYS" = "y";
# Most of this is necessary infra to allow wireless stack/
# drivers to be built as module
ASN1 = "y";
ASYMMETRIC_KEY_TYPE = "y";
ASYMMETRIC_PUBLIC_KEY_SUBTYPE = "y";
CRC_CCITT = "y";
CRYPTO = "y";
CRYPTO_ARC4 = "y";
CRYPTO_CBC = "y";
CRYPTO_CCM = "y";
CRYPTO_CMAC = "y";
CRYPTO_GCM = "y";
CRYPTO_HASH_INFO = "y";
CRYPTO_USER_API = "y"; # ARC4 needs this
CRYPTO_USER_API_HASH = "y";
CRYPTO_USER_API_ENABLE_OBSOLETE = "y"; # ARC4 needs this
CRYPTO_LIB_ARC4 = "y"; # for WEP
CRYPTO_RSA = "y";
CRYPTO_SHA1 = "y";
ENCRYPTED_KEYS = "y";
KEYS = "y";
};
};
};