2015-05-08 23:11:20 +01:00
|
|
|
{ stdenv, fetchurl, kernel, which }:
|
|
|
|
|
|
|
|
assert stdenv.isLinux;
|
2016-01-25 19:08:34 +00:00
|
|
|
# Don't bother with older versions, though some might even work:
|
2017-03-01 22:34:37 +00:00
|
|
|
assert stdenv.lib.versionAtLeast kernel.version "4.10";
|
2015-05-08 23:11:20 +01:00
|
|
|
|
2015-08-31 19:53:41 +01:00
|
|
|
let
|
|
|
|
release = "0.4.0";
|
2017-03-01 22:34:37 +00:00
|
|
|
revbump = "rev24"; # don't forget to change forum download id...
|
2016-01-25 19:08:34 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2015-05-08 23:11:20 +01:00
|
|
|
name = "linux-phc-intel-${version}-${kernel.version}";
|
2016-01-25 19:08:34 +00:00
|
|
|
version = "${release}-${revbump}";
|
2015-05-08 23:11:20 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-03-01 22:34:37 +00:00
|
|
|
sha256 = "02b4j8ap1fy09z36pmpplbw4vpwqdi16jyzw5kl0a60ydgxkmrpz";
|
|
|
|
url = "http://www.linux-phc.org/forum/download/file.php?id=178";
|
2015-08-31 19:53:41 +01:00
|
|
|
name = "phc-intel-pack-${revbump}.tar.bz2";
|
2015-05-08 23:11:20 +01:00
|
|
|
};
|
|
|
|
|
2018-01-19 13:24:08 +00:00
|
|
|
nativeBuildInputs = [ which ] ++ kernel.moduleBuildDependencies;
|
2015-08-31 19:53:41 +01:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "pic" ];
|
2016-02-12 03:56:06 +00:00
|
|
|
|
2015-08-31 19:53:41 +01:00
|
|
|
makeFlags = with kernel; [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
"KERNELSRC=${dev}/lib/modules/${modDirVersion}/build"
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
make $makeFlags brave
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
|
|
|
installPhase = ''
|
2015-12-17 13:47:25 +00:00
|
|
|
install -m 755 -d $out/lib/modules/${kernel.modDirVersion}/extra/
|
|
|
|
install -m 644 *.ko $out/lib/modules/${kernel.modDirVersion}/extra/
|
2015-08-31 19:53:41 +01:00
|
|
|
'';
|
|
|
|
|
2015-05-08 23:11:20 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
homepage = http://www.linux-phc.org/;
|
|
|
|
downloadPage = "http://www.linux-phc.org/forum/viewtopic.php?f=7&t=267";
|
2015-05-28 18:20:29 +01:00
|
|
|
license = licenses.gpl2;
|
2017-12-05 20:33:27 +00:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
2015-05-08 23:11:20 +01:00
|
|
|
};
|
|
|
|
}
|