2018-01-13 22:28:11 +01:00
|
|
|
{ stdenvNoCC, lib, buildPackages
|
2018-07-21 02:44:44 +02:00
|
|
|
, hostPlatform
|
2018-01-13 22:28:11 +01:00
|
|
|
, fetchurl, perl
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert hostPlatform.isLinux;
|
|
|
|
|
|
|
|
let
|
|
|
|
common = { version, sha256, patches ? null }: stdenvNoCC.mkDerivation {
|
|
|
|
name = "linux-headers-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2018-02-08 03:29:12 +01:00
|
|
|
ARCH = hostPlatform.platform.kernelArch;
|
2018-01-13 22:28:11 +01:00
|
|
|
|
|
|
|
# It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
|
|
|
|
# We do this so we have a build->build, not build->host, C compiler.
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
nativeBuildInputs = [ perl ];
|
|
|
|
|
|
|
|
extraIncludeDirs = lib.optional hostPlatform.isPowerPC ["ppc"];
|
|
|
|
|
|
|
|
# "patches" array defaults to 'null' to avoid changing hash
|
|
|
|
# and causing mass rebuild
|
|
|
|
inherit patches;
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
make mrproper headers_check SHELL=bash
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
make INSTALL_HDR_PATH=$out headers_install
|
|
|
|
|
|
|
|
# Some builds (e.g. KVM) want a kernel.release.
|
|
|
|
mkdir -p $out/include/config
|
|
|
|
echo "${version}-default" > $out/include/config/kernel.release
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Header files and scripts for Linux kernel";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
|
2018-02-18 22:59:29 +01:00
|
|
|
linuxHeaders = common {
|
2018-01-31 00:17:45 +01:00
|
|
|
version = "4.15";
|
|
|
|
sha256 = "0sd7l9n9h7vf9c6gd6ciji28hawda60yj0llh17my06m0s4lf9js";
|
2018-01-13 22:28:11 +01:00
|
|
|
};
|
|
|
|
}
|