kernel: add standalone amdgpu kernel module package

This commit is contained in:
Leonardo Eugênio 2023-02-21 00:29:28 -03:00
parent 2006674aee
commit 80d814c9bf
6 changed files with 46 additions and 12 deletions

View file

@ -0,0 +1,38 @@
{ pkgs
, lib
, kernel ? pkgs.linuxPackages_latest.kernel
}:
pkgs.stdenv.mkDerivation {
pname = "amdgpu-kernel-module";
inherit (kernel) src version postPatch nativeBuildInputs;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
modulePath = "drivers/gpu/drm/amd/amdgpu";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
meta = {
description = "AMD GPU kernel module";
license = lib.licenses.gpl3;
};
}

View file

@ -5,4 +5,5 @@
plymouth-theme-red = pkgs.callPackage ./plymouth-theme-red.nix { inherit inputs; };
cargo-checkmate = pkgs.callPackage ./cargo-checkmate.nix { };
lipsum = pkgs.callPackage ./lipsum.nix { inherit inputs; };
amdgpu-kernel-module = pkgs.callPackage ./amdgpu-kernel-module.nix { };
}