nix-build -E 'with import <nixpkgs> {}; callPackage ./build_nxp_wifi_kmod.nix {}'
Last active
May 22, 2024 13:05
-
-
Save pete3n/68155969a76404c009e94e34fb162c4c to your computer and use it in GitHub Desktop.
Out-of-tree NXP WiFi kernel module Nix build derivation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
lib, | |
stdenv, | |
fetchFromGitHub, | |
linuxPackages, | |
pkgs, | |
}: let | |
kernel = pkgs.linuxPackages.kernel; | |
makeFlagsStr = lib.concatStringsSep " " (kernel.makeFlags | |
++ [ | |
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" | |
"INSTALL_MOD_PATH=$(out)" | |
]); | |
in | |
stdenv.mkDerivation { | |
pname = "nxp-wifi-driver"; | |
version = "lf-6.6.3_1.0.0"; | |
src = fetchFromGitHub { | |
owner = "nxp-imx"; | |
repo = "mwifiex"; | |
rev = "lf-6.6.3_1.0.0"; | |
sha256 = "sha256-4RnvJN2vo0DF2kOuWfamn64tQaopcaEiSSIQMFZn6fg="; | |
}; | |
nativeBuildInputs = | |
kernel.moduleBuildDependencies | |
++ [ | |
pkgs.bc | |
pkgs.kmod | |
]; | |
buildPhase = '' | |
cd mxm_wifiex/wlan_src | |
make ${makeFlagsStr} build | |
''; | |
installPhase = '' | |
echo "Checking for built kernel modules:" | |
find . -name "*.ko" -exec ls -l {} \; | |
mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra | |
find . -name "*.ko" -exec cp {} $out/lib/modules/${kernel.modDirVersion}/extra/ \; | |
echo "Contents of $out/lib/modules/${kernel.modDirVersion}/extra:" | |
ls -l $out/lib/modules/${kernel.modDirVersion}/extra | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment