summary refs log tree commit diff
path: root/pkgs/os-specific/linux/kernel-headers
diff options
context:
space:
mode:
authorJoachim Fasting <joachifm@fastmail.fm>2016-05-14 09:13:46 +0200
committerJoachim Fasting <joachifm@fastmail.fm>2016-05-14 09:14:00 +0200
commitc9750f538274a199a12102f02c72da0ce0713cd6 (patch)
treec35c7b78c811b9c9c386c9729a661b16d53809fd /pkgs/os-specific/linux/kernel-headers
parent77022120f710b6640606282450420cadbbb2d2ca (diff)
downloadnixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.tar
nixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.tar.gz
nixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.tar.bz2
nixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.tar.lz
nixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.tar.xz
nixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.tar.zst
nixpkgs-c9750f538274a199a12102f02c72da0ce0713cd6.zip
linuxHeaders_4_4: init at 4.4.10
Diffstat (limited to 'pkgs/os-specific/linux/kernel-headers')
-rw-r--r--pkgs/os-specific/linux/kernel-headers/4.4.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/kernel-headers/4.4.nix b/pkgs/os-specific/linux/kernel-headers/4.4.nix
new file mode 100644
index 00000000000..be6dd847201
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel-headers/4.4.nix
@@ -0,0 +1,71 @@
+{ stdenv, fetchurl, perl, cross ? null }:
+
+assert cross == null -> stdenv.isLinux;
+
+let
+
+  version = "4.4.10";
+
+  kernelHeadersBaseConfig =
+    if cross == null
+    then stdenv.platform.kernelHeadersBaseConfig
+    else cross.platform.kernelHeadersBaseConfig;
+
+in
+
+stdenv.mkDerivation {
+  name = "linux-headers-${version}";
+
+  src = fetchurl {
+    url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
+    sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
+  };
+
+  targetConfig = if cross != null then cross.config else null;
+
+  platform =
+    if cross != null then cross.platform.kernelArch else
+    if stdenv.system == "i686-linux" then "i386" else
+    if stdenv.system == "x86_64-linux" then "x86_64" else
+    if stdenv.system == "powerpc-linux" then "powerpc" else
+    if stdenv.isArm then "arm" else
+    if stdenv.platform ? kernelArch then stdenv.platform.kernelArch else
+    abort "don't know what the kernel include directory is called for this platform";
+
+  buildInputs = [perl];
+
+  extraIncludeDirs =
+    if cross != null then
+        (if cross.arch == "powerpc" then ["ppc"] else [])
+    else if stdenv.system == "powerpc-linux" then ["ppc"] else [];
+
+  buildPhase = ''
+    if test -n "$targetConfig"; then
+       export ARCH=$platform
+    fi
+    make ${kernelHeadersBaseConfig} SHELL=bash
+    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
+  '';
+
+  # !!! hacky
+  fixupPhase = ''
+    ln -s asm $out/include/asm-$platform
+    if test "$platform" = "i386" -o "$platform" = "x86_64"; then
+      ln -s asm $out/include/asm-x86
+    fi
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Header files and scripts for Linux kernel";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}