From e8d5e4c78844d1bf6e6ea096b03e4b422265f0df Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 7 Mar 2023 21:32:21 +0000 Subject: [PATCH] move regulatory.db to wlan module --- devices/gl-ar750/default.nix | 2 -- devices/gl-mt300a/default.nix | 4 ++-- modules/wlan.nix | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix index be683e1..b452674 100644 --- a/devices/gl-ar750/default.nix +++ b/devices/gl-ar750/default.nix @@ -58,7 +58,6 @@ phases = ["installPhase"]; installPhase = '' mkdir -p $out/ath10k/QCA9887/hw1.0/ - cp ${pkgs.wireless-regdb}/lib/firmware/regulatory.db* $out/ blobdir=${firmwareBlobs}/QCA9887/hw1.0 cp $blobdir/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 $out/ath10k/QCA9887/hw1.0/firmware-5.bin cp $blobdir/board.bin $out/ath10k/QCA9887/hw1.0/ @@ -120,7 +119,6 @@ filesystem = dir { lib = dir { firmware = dir { - "regulatory.db" = symlink "${firmware}/regulatory.db"; ath10k = dir { QCA9887 = symlink "${firmware}/ath10k/QCA9887"; "cal-pci-0000:00:00.0.bin" = symlink "${ath10k_cal_data}/.outputs/data"; diff --git a/devices/gl-mt300a/default.nix b/devices/gl-mt300a/default.nix index 3041884..862a823 100644 --- a/devices/gl-mt300a/default.nix +++ b/devices/gl-mt300a/default.nix @@ -13,8 +13,8 @@ description = '' WiFi on this device is provided by the rt2800soc module. It - expects firmware to be present in the "???" MTD partition, so - - assuming we want to use the wireless - we need to build MTD + expects firmware to be present in the "factory" MTD partition, so + - assuming we want to use the wireless - we need to build MTD support into the kernel even if we're using TFTP root ''; diff --git a/modules/wlan.nix b/modules/wlan.nix index c92ec02..4af730a 100644 --- a/modules/wlan.nix +++ b/modules/wlan.nix @@ -2,9 +2,24 @@ let inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ; inherit (pkgs.pseudofile) dir symlink; - inherit (pkgs) busybox; + inherit (pkgs) stdenv busybox wireless-regdb; + regulatory = stdenv.mkDerivation { + name = "regulatory.db"; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out + cp ${wireless-regdb}/lib/firmware/regulatory.db $out/ + ''; + }; in { config = { + filesystem = dir { + lib = dir { + firmware = dir { + "regulatory.db" = symlink "${regulatory}/regulatory.db"; + }; + }; + }; kernel = rec { config = { # Most of this is necessary infra to allow wireless stack/