2010-03-10 21:32:35 +00:00
|
|
|
{stdenv, fetchurl, perl, cross ? null}:
|
|
|
|
|
|
|
|
assert cross == null -> stdenv.isLinux;
|
|
|
|
|
|
|
|
let
|
|
|
|
version = "2.4.37.9";
|
2012-12-28 18:54:15 +00:00
|
|
|
kernelHeadersBaseConfig = if cross == null then
|
2010-03-10 21:32:35 +00:00
|
|
|
stdenv.platform.kernelHeadersBaseConfig
|
|
|
|
else
|
|
|
|
cross.platform.kernelHeadersBaseConfig;
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "linux-headers-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://kernel/linux/kernel/v2.4/linux-${version}.tar.bz2";
|
|
|
|
sha256 = "08rca9lcb5l5w483hgaqk8pi2njd7cmwpkifjqxwlb3g8liz4r5g";
|
|
|
|
};
|
|
|
|
|
2012-12-28 18:54:15 +00:00
|
|
|
targetConfig = if cross != null then cross.config else null;
|
2010-03-10 21:32:35 +00:00
|
|
|
|
|
|
|
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
|
2012-04-16 00:41:25 +01:00
|
|
|
if stdenv.isArm then "arm" else
|
2010-03-10 21:32:35 +00:00
|
|
|
abort "don't know what the kernel include directory is called for this platform";
|
|
|
|
|
|
|
|
buildInputs = [perl];
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i s,/bin/pwd,pwd, Makefile
|
|
|
|
'';
|
|
|
|
|
|
|
|
extraIncludeDirs =
|
|
|
|
if cross != null then
|
|
|
|
(if cross.arch == "powerpc" then ["ppc"] else [])
|
|
|
|
else if stdenv.system == "powerpc-linux" then ["ppc"] else [];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
cp arch/$platform/${kernelHeadersBaseConfig} .config
|
|
|
|
make mrproper symlinks include/linux/{version,compile}.h \
|
|
|
|
ARCH=$platform
|
|
|
|
yes "" | make oldconfig ARCH=$platform
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/include
|
2010-03-10 21:32:35 +00:00
|
|
|
cp -a include/{asm,asm-$platform,acpi,linux,pcmcia,scsi,video} \
|
|
|
|
$out/include
|
|
|
|
'';
|
|
|
|
}
|