8e643320c0
It's not actually needed, and AFAICT has never been. Or at least Buildroot can build kernel headers as old as 3.2 without running the config phase. While at it, set ARCH unconditionally.
67 lines
1.7 KiB
Nix
67 lines
1.7 KiB
Nix
{ stdenvNoCC, lib, buildPackages
|
|
, buildPlatform, hostPlatform
|
|
, 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;
|
|
};
|
|
|
|
ARCH = hostPlatform.platform.kernelArch;
|
|
|
|
# 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
|
|
'';
|
|
|
|
# !!! 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 lib; {
|
|
description = "Header files and scripts for Linux kernel";
|
|
license = licenses.gpl2;
|
|
platforms = platforms.linux;
|
|
};
|
|
};
|
|
in {
|
|
|
|
linuxHeaders_4_4 = common {
|
|
version = "4.4.10";
|
|
sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
|
|
};
|
|
|
|
linuxHeaders_4_15 = common {
|
|
version = "4.15";
|
|
sha256 = "0sd7l9n9h7vf9c6gd6ciji28hawda60yj0llh17my06m0s4lf9js";
|
|
};
|
|
}
|