2007-12-01 21:29:21 +01:00
|
|
|
args: with args;
|
2007-09-28 11:56:47 +02:00
|
|
|
|
|
|
|
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2007-12-01 21:29:21 +01:00
|
|
|
lib = stdenv.lib;
|
|
|
|
addNewlines = map (s: "\n" + s + "\n");
|
|
|
|
kernelPatches = systemPatches ++ extraPatches;
|
2007-09-28 11:56:47 +02:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = if userModeLinux then "user-mode-linux-${version}" else "linux-${version}";
|
|
|
|
builder = ./builder.sh;
|
|
|
|
|
2007-12-01 21:29:21 +01:00
|
|
|
src = fetchurl ( {
|
2007-09-28 11:56:47 +02:00
|
|
|
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
2007-12-01 21:29:21 +01:00
|
|
|
} // src_hash );
|
2007-09-28 11:56:47 +02:00
|
|
|
|
|
|
|
patches = map (p: p.patch) kernelPatches;
|
2007-12-01 21:29:21 +01:00
|
|
|
|
2007-10-31 15:39:43 +01:00
|
|
|
extraConfig =
|
2007-12-01 21:29:21 +01:00
|
|
|
let configFromPatches =
|
2007-10-31 15:39:43 +01:00
|
|
|
map (p: if p ? extraConfig then p.extraConfig else "") kernelPatches;
|
|
|
|
in lib.concatStrings (addNewlines (configFromPatches ++ extraConfig));
|
2007-09-28 11:56:47 +02:00
|
|
|
|
2007-12-03 23:48:03 +01:00
|
|
|
inherit config;
|
2007-09-28 11:56:47 +02:00
|
|
|
|
|
|
|
buildInputs = [perl mktemp];
|
|
|
|
|
|
|
|
arch =
|
|
|
|
if userModeLinux then "um" else
|
|
|
|
if stdenv.system == "i686-linux" then "i386" else
|
|
|
|
if stdenv.system == "x86_64-linux" then "x86_64" else
|
|
|
|
abort "Platform ${stdenv.system} is not supported.";
|
|
|
|
|
|
|
|
makeFlags = if userModeLinux then "ARCH=um SHELL=bash" else "";
|
|
|
|
|
|
|
|
inherit module_init_tools;
|
|
|
|
|
|
|
|
allowLocalVersion = false; # don't allow patches to set a suffix
|
|
|
|
inherit localVersion; # but do allow the user to set one.
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description =
|
|
|
|
(if userModeLinux then
|
|
|
|
"User-Mode Linux"
|
|
|
|
else
|
|
|
|
"The Linux kernel") +
|
|
|
|
(if kernelPatches == [] then "" else
|
|
|
|
" (with patches: "
|
|
|
|
+ lib.concatStrings (lib.intersperse ", " (map (x: x.name) kernelPatches))
|
|
|
|
+ ")");
|
|
|
|
};
|
|
|
|
}
|