2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchurl, kernel, which }:
|
2015-05-09 00:11:20 +02:00
|
|
|
|
2016-01-25 20:08:34 +01:00
|
|
|
# Don't bother with older versions, though some might even work:
|
2017-03-01 23:34:37 +01:00
|
|
|
assert stdenv.lib.versionAtLeast kernel.version "4.10";
|
2015-05-09 00:11:20 +02:00
|
|
|
|
2015-08-31 20:53:41 +02:00
|
|
|
let
|
|
|
|
release = "0.4.0";
|
2018-03-28 22:33:07 +02:00
|
|
|
revbump = "rev25"; # don't forget to change forum download id...
|
2016-01-25 20:08:34 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2015-05-09 00:11:20 +02:00
|
|
|
name = "linux-phc-intel-${version}-${kernel.version}";
|
2016-01-25 20:08:34 +01:00
|
|
|
version = "${release}-${revbump}";
|
2015-05-09 00:11:20 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-03-28 22:33:07 +02:00
|
|
|
sha256 = "1w91hpphd8i0br7g5qra26jdydqar45zqwq6jq8yyz6l0vb10zlz";
|
|
|
|
url = "http://www.linux-phc.org/forum/download/file.php?id=194";
|
2015-08-31 20:53:41 +02:00
|
|
|
name = "phc-intel-pack-${revbump}.tar.bz2";
|
2015-05-09 00:11:20 +02:00
|
|
|
};
|
|
|
|
|
2018-01-19 14:24:08 +01:00
|
|
|
nativeBuildInputs = [ which ] ++ kernel.moduleBuildDependencies;
|
2015-08-31 20:53:41 +02:00
|
|
|
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "pic" ];
|
2016-02-12 04:56:06 +01:00
|
|
|
|
2015-08-31 20:53:41 +02:00
|
|
|
makeFlags = with kernel; [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"KERNELSRC=${dev}/lib/modules/${modDirVersion}/build"
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
make $makeFlags brave
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
|
|
|
installPhase = ''
|
2015-12-17 14:47:25 +01:00
|
|
|
install -m 755 -d $out/lib/modules/${kernel.modDirVersion}/extra/
|
|
|
|
install -m 644 *.ko $out/lib/modules/${kernel.modDirVersion}/extra/
|
2015-08-31 20:53:41 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2015-05-09 00:11:20 +02:00
|
|
|
description = "Undervolting kernel driver for Intel processors";
|
|
|
|
longDescription = ''
|
|
|
|
PHC is a Linux kernel patch to undervolt processors. This can divide the
|
|
|
|
power consumption of the CPU by two or more, increasing battery life
|
|
|
|
while noticably reducing fan noise. This driver works only on supported
|
|
|
|
Intel architectures.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.linux-phc.org/";
|
2015-05-09 00:11:20 +02:00
|
|
|
downloadPage = "http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267";
|
2015-05-28 19:20:29 +02:00
|
|
|
license = licenses.gpl2;
|
2017-12-05 21:33:27 +01:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
2018-08-21 00:20:55 +02:00
|
|
|
broken = stdenv.lib.versionAtLeast kernel.version "4.18";
|
2015-05-09 00:11:20 +02:00
|
|
|
};
|
|
|
|
}
|