diff --git a/pkgs/os-specific/linux/mem-encryption-tests/default.nix b/pkgs/os-specific/linux/mem-encryption-tests/default.nix new file mode 100644 index 0000000000000..dc46fe2bd0016 --- /dev/null +++ b/pkgs/os-specific/linux/mem-encryption-tests/default.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchFromGitHub, linuxPackages, kernel ? linuxPackages.kernel }: + +stdenv.mkDerivation { + pname = "mem-encryption-tests"; + version = "0-master-2022-12-07"; + + src = fetchFromGitHub { + owner = "AMDESE"; + repo = "mem-encryption-tests"; + rev = "7abb072ffc50ceb0b4145ae84105ce6c91bd1ff4"; + sha256 = "sha256:1i4x1ar05yjaw03997l530f87xfj1b2qhh2kiw42swisb8d80hmz"; + }; + + nativeBuildInputs = kernel.moduleBuildDependencies; + + makeFlags = kernel.makeFlags ++ [ + "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALL_MOD_PATH=$(out)" + ]; + + installPhase = '' + mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra + cp tsme-test.ko $out/lib/modules/${kernel.modDirVersion}/extra + ''; + + meta = with lib; { + description = "Tests related to AMD Memory Encryption"; + license = licenses.gpl2; + maintainers = with maintainers; [ lyn ]; + platforms = platforms.linux; + longDescription = '' + This includes: + tsme-test - A loadable kernel module that can be used to determine the state of TSME. + ''; + }; +} diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index f83e889934509..92cde15855a3c 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -601,6 +601,8 @@ in { msi-ec = callPackage ../os-specific/linux/msi-ec { }; + mem-encryption-tests = callPackage ../os-specific/linux/mem-encryption-tests { }; + } // lib.optionalAttrs config.allowAliases { ati_drivers_x11 = throw "ati drivers are no longer supported by any kernel >=4.1"; # added 2021-05-18; hid-nintendo = throw "hid-nintendo was added in mainline kernel version 5.16"; # Added 2023-07-30