diff options
Diffstat (limited to 'pkgs/os-specific/linux/kernel')
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.20.nix | 37 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.21-ck.nix | 13 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.21.nix | 45 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.22-ck.nix | 13 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.22.nix | 25 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.23.1.nix | 38 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.23.12.nix | 38 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/2.6.23.nix | 17 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/builder.sh | 3 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/default.nix | 31 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-2.6.20.nix | 76 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-2.6.21.nix | 76 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-2.6.22.nix (renamed from pkgs/os-specific/linux/kernel/meta.nix) | 46 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/linux-2.6.23.nix | 84 |
14 files changed, 274 insertions, 268 deletions
diff --git a/pkgs/os-specific/linux/kernel/2.6.20.nix b/pkgs/os-specific/linux/kernel/2.6.20.nix deleted file mode 100644 index b6c0c70b580..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.20.nix +++ /dev/null @@ -1,37 +0,0 @@ -args: -(import ./meta.nix) -( args // - { - version = "2.6.20.12"; - src_hash = { sha256 = "1s7vdpg2897q5pcyxxypqcnibwpbdawbimkf3pngmahj8wr9c03x"; }; - - systemPatches = [ - { name = "paravirt-nvidia"; - patch = ./2.6.20-paravirt-nvidia.patch; - } - { name = "skas-2.6.20-v9-pre9"; - patch = args.fetchurl { - url = http://www.user-mode-linux.org/~blaisorblade/patches/skas3-2.6/skas-2.6.20-v9-pre9/skas-2.6.20-v9-pre9.patch.bz2; - md5 = "02e619e5b3aaf0f9768f03ac42753e74"; - }; - extraConfig = - "CONFIG_PROC_MM=y\n" + - "# CONFIG_PROC_MM_DUMPABLE is not set\n"; - } - { name = "fbsplash-0.9.2-r5-2.6.20-rc6"; - patch = args.fetchurl { - url = http://dev.gentoo.org/~spock/projects/gensplash/archive/fbsplash-0.9.2-r5-2.6.20-rc6.patch; - sha256 = "11v4f85f4jnh9sbhqcyn47krb7l1czgzjw3w8wgbq14jm0sp9294"; - }; - extraConfig = "CONFIG_FB_SPLASH=y"; - } - ]; - - config = with args; - if config != null then config else - if userModeLinux then ./config-2.6.20-uml else - if stdenv.system == "i686-linux" then ./config-2.6.20-i686-smp else - if stdenv.system == "x86_64-linux" then ./config-2.6.20-x86_64-smp else - abort "No kernel configuration for your platform!"; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.21-ck.nix b/pkgs/os-specific/linux/kernel/2.6.21-ck.nix deleted file mode 100644 index 0fb902c695e..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.21-ck.nix +++ /dev/null @@ -1,13 +0,0 @@ -args: -(import ./2.6.21.nix) -( args // - { - extraPatches = (if (args ? extraPatches) then args.extraPatches else []) ++ - [ - { - name = "Con Kolivas Patch"; - patch = ./patch-2.6.21-ck1; - } - ]; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.21.nix b/pkgs/os-specific/linux/kernel/2.6.21.nix deleted file mode 100644 index da7ef60e096..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.21.nix +++ /dev/null @@ -1,45 +0,0 @@ -args: -(import ./meta.nix) -( args // - { - version = "2.6.21.7"; - src_hash = { sha256 = "1c8ndsz35qd8vyng3xsxjjkjv5bnzyvc9b5vd85fz5v0bjp8hx50"; }; - - systemPatches = [ - { name = "ext3cow"; - patch = ./linux-2.6.21.7-ext3cow_wouter.patch; - extraConfig = - "CONFIG_EXT3COW_FS=m\n" + - "CONFIG_EXT3COW_FS_XATTR=y\n" + - "CONFIG_EXT3COW_FS_POSIX_ACL=y\n" + - "CONFIG_EXT3COW_FS_SECURITY=y\n"; - } - { name = "paravirt-nvidia"; - patch = ./2.6.20-paravirt-nvidia.patch; - } - { name = "skas-2.6.20-v9-pre9"; - patch = args.fetchurl { - url = http://www.user-mode-linux.org/~blaisorblade/patches/skas3-2.6/skas-2.6.20-v9-pre9/skas-2.6.20-v9-pre9.patch.bz2; - md5 = "02e619e5b3aaf0f9768f03ac42753e74"; - }; - extraConfig = - "CONFIG_PROC_MM=y\n" + - "# CONFIG_PROC_MM_DUMPABLE is not set\n"; - } - { name = "fbsplash-0.9.2-r5-2.6.21"; - patch = args.fetchurl { - url = http://dev.gentoo.org/~dsd/genpatches/trunk/2.6.21/4200_fbsplash-0.9.2-r5.patch; - sha256 = "00s8074fzsly2zpir885zqkvq267qyzg6vhsn7n1z2v1z78avxd8"; - }; - extraConfig = "CONFIG_FB_SPLASH=y"; - } - ]; - - config = with args; - if config != null then config else - if userModeLinux then ./config-2.6.21-uml else - if stdenv.system == "i686-linux" then ./config-2.6.21-i686-smp else - if stdenv.system == "x86_64-linux" then ./config-2.6.21-x86_64-smp else - abort "No kernel configuration for your platform!"; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.22-ck.nix b/pkgs/os-specific/linux/kernel/2.6.22-ck.nix deleted file mode 100644 index 23a134cfc77..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.22-ck.nix +++ /dev/null @@ -1,13 +0,0 @@ -args: -(import ./2.6.22.nix) -( args // - { - extraPatches = (if (args ? extraPatches) then args.extraPatches else []) ++ - [ - { - name = "Con Kolivas Patch"; - patch = ./patch-2.6.21-ck1; - } - ]; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.22.nix b/pkgs/os-specific/linux/kernel/2.6.22.nix deleted file mode 100644 index 36158a955cd..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.22.nix +++ /dev/null @@ -1,25 +0,0 @@ -args: -(import ./meta.nix) -( args // - { - version = "2.6.22.10"; - src_hash = { sha256 = "0kh196qzm54mvnbrdr9s2q86l9yn2321gnsl5xq44ai2idqp044g"; }; - - systemPatches = [ - { name = "fbsplash-0.9.2-r5-2.6.21"; - patch = args.fetchurl { - url = http://dev.gentoo.org/~dsd/genpatches/trunk/2.6.22/4200_fbsplash-0.9.2-r5.patch; - sha256 = "0822wwlf2dqsap5qslnnp0yl1nbvvvb76l73w2dd8zsyn0bqg3px"; - }; - extraConfig = "CONFIG_FB_SPLASH=y"; - } - ]; - - config = with args; - if config != null then config else - if userModeLinux then ./config-2.6.22-uml else - if stdenv.system == "i686-linux" then ./config-2.6.22-i686-smp else - if stdenv.system == "x86_64-linux" then ./config-2.6.22-x86_64-smp else - abort "No kernel configuration for your platform!"; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.23.1.nix b/pkgs/os-specific/linux/kernel/2.6.23.1.nix deleted file mode 100644 index 5b014b2591e..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.23.1.nix +++ /dev/null @@ -1,38 +0,0 @@ -args: -(import ./meta.nix) -( args // - { - version = "2.6.23.1"; - src_hash = { sha256 = "0737g83h7jbrlss8782b17mhc3nfn8qfbh5s71flz8pjxmbbmg1m"; }; - - systemPatches = [ - { # resume with resume=swap:/dev/xx - name = "tux on ice"; # (swsusp2) - patch = args.fetchurl { - url = "http://www.tuxonice.net/downloads/all/tuxonice-3.0-rc2-for-2.6.23.1.patch.bz2"; - sha256 = "ef86267b6f3d7e309221f5173a881afae1dfa57418be5b3963f2380b0633ca1a"; - }; - extraConfig = " - CONFIG_SUSPEND2=y - CONFIG_SUSPEND2_FILE=y - CONFIG_SUSPEND2_SWAP=y - CONFIG_CRYPTO_LZF=y - "; - } - { name = "fbsplash-0.9.2-r5-2.6.21"; - patch = args.fetchurl { - url = http://dev.gentoo.org/~dsd/genpatches/trunk/2.6.22/4200_fbsplash-0.9.2-r5.patch; - sha256 = "0822wwlf2dqsap5qslnnp0yl1nbvvvb76l73w2dd8zsyn0bqg3px"; - }; - extraConfig = "CONFIG_FB_SPLASH=y"; - } - ]; - - config = with args; - if config != null then config else - if userModeLinux then ./config-2.6.23-uml else - if stdenv.system == "i686-linux" then ./config-2.6.23-i686-smp else - if stdenv.system == "x86_64-linux" then ./config-2.6.23-x86_64-smp else - abort "No kernel configuration for your platform!"; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.23.12.nix b/pkgs/os-specific/linux/kernel/2.6.23.12.nix deleted file mode 100644 index a0e3bcbf2d8..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.23.12.nix +++ /dev/null @@ -1,38 +0,0 @@ -args: -(import ./meta.nix) -( args // - { - version = "2.6.23.12"; - src_hash = { sha256 = "1x3ngnhyxy9rlaislm2hzijaaa2mp8v930dyp8zmmhjdpzjf3w8k"; }; - - systemPatches = [ - { # resume with resume=swap:/dev/xx - name = "tux on ice"; # (swsusp2) - patch = args.fetchurl { - url = "http://www.tuxonice.net/downloads/all/tuxonice-3.0-rc3-for-2.6.23.9.patch.bz2"; - sha256 = "16f61cn0mdi7yklhdx4isi7c85843fzxq2cifd05cpsl6x6ilrfk"; - }; - extraConfig = " - CONFIG_SUSPEND2=y - CONFIG_SUSPEND2_FILE=y - CONFIG_SUSPEND2_SWAP=y - CONFIG_CRYPTO_LZF=y - "; - } - { name = "fbsplash-0.9.2-r5-2.6.21"; - patch = args.fetchurl { - url = http://dev.gentoo.org/~dsd/genpatches/trunk/2.6.22/4200_fbsplash-0.9.2-r5.patch; - sha256 = "0822wwlf2dqsap5qslnnp0yl1nbvvvb76l73w2dd8zsyn0bqg3px"; - }; - extraConfig = "CONFIG_FB_SPLASH=y"; - } - ]; - - config = with args; - if config != null then config else - if userModeLinux then ./config-2.6.23-uml else - if stdenv.system == "i686-linux" then ./config-2.6.23-i686-smp else - if stdenv.system == "x86_64-linux" then ./config-2.6.23-x86_64-smp else - abort "No kernel configuration for your platform!"; - } -) diff --git a/pkgs/os-specific/linux/kernel/2.6.23.nix b/pkgs/os-specific/linux/kernel/2.6.23.nix deleted file mode 100644 index 3b8c2c469a7..00000000000 --- a/pkgs/os-specific/linux/kernel/2.6.23.nix +++ /dev/null @@ -1,17 +0,0 @@ -args: -(import ./meta.nix) -( args // - { - version = "2.6.23"; - src_hash = { sha256 = "1nyv7004w40l4adzq2b0hrvk3f4iqwngkgrlh8as9cpz6l4prrnl"; }; - - systemPatches = [ ]; - - config = with args; - if config != null then config else - if userModeLinux then ./config-2.6.23-uml else - if stdenv.system == "i686-linux" then ./config-2.6.23-i686-smp else - if stdenv.system == "x86_64-linux" then ./config-2.6.23-x86_64-smp else - abort "No kernel configuration for your platform!"; - } -) diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh index 123b65e3f07..3512a74c196 100644 --- a/pkgs/os-specific/linux/kernel/builder.sh +++ b/pkgs/os-specific/linux/kernel/builder.sh @@ -66,7 +66,6 @@ installPhase() { cp arch/$arch/boot/bzImage $out/vmlinuz fi - sed -e '/-b $(INSTALL_MOD_PATH)/d' -i Makefile # Install the modules in $out/lib/modules with matching paths # in modules.dep (i.e., refererring to $out/lib/modules, not # /lib/modules). The depmod_opts= is to prevent the kernel @@ -96,7 +95,7 @@ installPhase() { if test "$arch" != um; then # copy all Makefiles and Kconfig files ln -s $out/lib/modules/$version/build $out/lib/modules/$version/source - cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` $out/lib/modules/$version/build + cp --parents `find -type f -name Makefile -o -name "Kconfig*"` $out/lib/modules/$version/build cp Module.symvers $out/lib/modules/$version/build # weed out unneeded stuff diff --git a/pkgs/os-specific/linux/kernel/default.nix b/pkgs/os-specific/linux/kernel/default.nix deleted file mode 100644 index c07bc4c81fb..00000000000 --- a/pkgs/os-specific/linux/kernel/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -args: -let - getValue = aSet: aName: default: - (if (builtins.hasAttr aName aSet) then (builtins.getAttr aName aSet) else default); -in - -let - newArgs = (args // - { - userModeLinux = getValue args "userModeLinux" false; - - localVersion = getValue args "localVersion" ""; - - config = getValue args "configFile" null; - - extraPatches = getValue args "extraPatches" []; - - extraConfig = getValue args "extraConfig" []; - }); -in -args.stdenv.lib.listOfListsToAttrs [ - [ "recurseForDerivations" true ] - [ "2.6.20" (import ./2.6.20.nix newArgs) ] - [ "2.6.21" (import ./2.6.21.nix newArgs) ] - [ "2.6.21-ck" (import ./2.6.21-ck.nix newArgs) ] - [ "2.6.22" (import ./2.6.22.nix newArgs) ] - [ "2.6.22-ck" (import ./2.6.22-ck.nix newArgs) ] - [ "2.6.23" (import ./2.6.23.nix newArgs) ] - [ "2.6.23.1" (import ./2.6.23.1.nix newArgs) ] - [ "default" (import ./2.6.23.1.nix newArgs) ] -] diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.20.nix b/pkgs/os-specific/linux/kernel/linux-2.6.20.nix new file mode 100644 index 00000000000..3299ba5a3cb --- /dev/null +++ b/pkgs/os-specific/linux/kernel/linux-2.6.20.nix @@ -0,0 +1,76 @@ +{ stdenv, fetchurl, perl, mktemp, module_init_tools + + # A list of patches to apply to the kernel. Each element of this list + # should be an attribute set {name, patch} where `name' is a + # symbolic name and `patch' is the actual patch. The patch may + # optionally be compressed with gzip or bzip2. +, kernelPatches ? [] + +, # Whether to build a User-Mode Linux kernel. + userModeLinux ? false + +, # Allows you to set your own kernel version suffix (e.g., + # "-my-kernel"). + localVersion ? "" + +, # Your own kernel configuration file, if you don't want to use the + # default. + kernelConfig ? null +}: + +assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; + +let + + lib = import ../../../lib; + + version = "2.6.20.12"; + +in + +stdenv.mkDerivation { + name = if userModeLinux then "user-mode-linux-${version}" else "linux-${version}"; + builder = ./builder.sh; + + src = fetchurl { + url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2"; + sha256 = "1s7vdpg2897q5pcyxxypqcnibwpbdawbimkf3pngmahj8wr9c03x"; + }; + + patches = map (p: p.patch) kernelPatches; + extraConfig = lib.concatStrings (map (p: "\n" + (if p ? extraConfig then p.extraConfig else "") + "\n") kernelPatches); + + config = + if kernelConfig != null then kernelConfig else + if userModeLinux then ./config-2.6.20-uml else + if stdenv.system == "i686-linux" then ./config-2.6.20-i686-smp else + if stdenv.system == "x86_64-linux" then ./config-2.6.20-x86_64-smp else + abort "No kernel configuration for your platform!"; + + 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)) + + ")"); + }; +} diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.21.nix b/pkgs/os-specific/linux/kernel/linux-2.6.21.nix new file mode 100644 index 00000000000..e7fc2943a5c --- /dev/null +++ b/pkgs/os-specific/linux/kernel/linux-2.6.21.nix @@ -0,0 +1,76 @@ +{ stdenv, fetchurl, perl, mktemp, module_init_tools + + # A list of patches to apply to the kernel. Each element of this list + # should be an attribute set {name, patch} where `name' is a + # symbolic name and `patch' is the actual patch. The patch may + # optionally be compressed with gzip or bzip2. +, kernelPatches ? [] + +, # Whether to build a User-Mode Linux kernel. + userModeLinux ? false + +, # Allows you to set your own kernel version suffix (e.g., + # "-my-kernel"). + localVersion ? "" + +, # Your own kernel configuration file, if you don't want to use the + # default. + kernelConfig ? null +}: + +assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; + +let + + lib = import ../../../lib; + + version = "2.6.21.7"; + +in + +stdenv.mkDerivation { + name = if userModeLinux then "user-mode-linux-${version}" else "linux-${version}"; + builder = ./builder.sh; + + src = fetchurl { + url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2"; + sha256 = "1c8ndsz35qd8vyng3xsxjjkjv5bnzyvc9b5vd85fz5v0bjp8hx50"; + }; + + patches = map (p: p.patch) kernelPatches; + extraConfig = lib.concatStrings (map (p: "\n" + (if p ? extraConfig then p.extraConfig else "") + "\n") kernelPatches); + + config = + if kernelConfig != null then kernelConfig else + if userModeLinux then ./config-2.6.21-uml else + if stdenv.system == "i686-linux" then ./config-2.6.21-i686-smp else + if stdenv.system == "x86_64-linux" then ./config-2.6.21-x86_64-smp else + abort "No kernel configuration for your platform!"; + + 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)) + + ")"); + }; +} diff --git a/pkgs/os-specific/linux/kernel/meta.nix b/pkgs/os-specific/linux/kernel/linux-2.6.22.nix index 8dcdcecab52..1abc1470616 100644 --- a/pkgs/os-specific/linux/kernel/meta.nix +++ b/pkgs/os-specific/linux/kernel/linux-2.6.22.nix @@ -1,12 +1,34 @@ -args: with args; +{ stdenv, fetchurl, perl, mktemp, module_init_tools + + # A list of patches to apply to the kernel. Each element of this list + # should be an attribute set {name, patch} where `name' is a + # symbolic name and `patch' is the actual patch. The patch may + # optionally be compressed with gzip or bzip2. +, kernelPatches ? [] + +, # Whether to build a User-Mode Linux kernel. + userModeLinux ? false + +, # Allows you to set your own kernel version suffix (e.g., + # "-my-kernel"). + localVersion ? "" + +, # Your own kernel configuration file, if you don't want to use the + # default. + kernelConfig ? null + +, # A list of additional statements to be appended to the + # configuration file. + extraConfig ? [] +}: assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; let - lib = stdenv.lib; - addNewlines = map (s: "\n" + s + "\n"); - kernelPatches = systemPatches ++ extraPatches; + lib = import ../../../lib; + + version = "2.6.22.18"; in @@ -14,18 +36,24 @@ stdenv.mkDerivation { name = if userModeLinux then "user-mode-linux-${version}" else "linux-${version}"; builder = ./builder.sh; - src = fetchurl ( { + src = fetchurl { url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2"; - } // src_hash ); + sha256 = "09acj1xr16j9y91gzwzcjhanhcpyac1ah2lc42mfi7d8c0plagry"; + }; patches = map (p: p.patch) kernelPatches; - extraConfig = - let configFromPatches = + let addNewlines = map (s: "\n" + s + "\n"); + configFromPatches = map (p: if p ? extraConfig then p.extraConfig else "") kernelPatches; in lib.concatStrings (addNewlines (configFromPatches ++ extraConfig)); - inherit config; + config = + if kernelConfig != null then kernelConfig else + if userModeLinux then ./config-2.6.22-uml else + if stdenv.system == "i686-linux" then ./config-2.6.22-i686-smp else + if stdenv.system == "x86_64-linux" then ./config-2.6.22-x86_64-smp else + abort "No kernel configuration for your platform!"; buildInputs = [perl mktemp]; diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.23.nix b/pkgs/os-specific/linux/kernel/linux-2.6.23.nix new file mode 100644 index 00000000000..d4c4b688ab4 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/linux-2.6.23.nix @@ -0,0 +1,84 @@ +{ stdenv, fetchurl, perl, mktemp, module_init_tools + + # A list of patches to apply to the kernel. Each element of this list + # should be an attribute set {name, patch} where `name' is a + # symbolic name and `patch' is the actual patch. The patch may + # optionally be compressed with gzip or bzip2. +, kernelPatches ? [] + +, # Whether to build a User-Mode Linux kernel. + userModeLinux ? false + +, # Allows you to set your own kernel version suffix (e.g., + # "-my-kernel"). + localVersion ? "" + +, # Your own kernel configuration file, if you don't want to use the + # default. + kernelConfig ? null + +, # A list of additional statements to be appended to the + # configuration file. + extraConfig ? [] +}: + +assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; + +let + + lib = import ../../../lib; + + version = "2.6.23.16"; + +in + +stdenv.mkDerivation { + name = if userModeLinux then "user-mode-linux-${version}" else "linux-${version}"; + builder = ./builder.sh; + + src = fetchurl { + url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2"; + sha256 = "0drk3981rl5j16s6amb63lai9kpi0vf0kr6avhpd9nikj27bsa83"; + }; + + patches = map (p: p.patch) kernelPatches; + extraConfig = + let addNewlines = map (s: "\n" + s + "\n"); + configFromPatches = + map (p: if p ? extraConfig then p.extraConfig else "") kernelPatches; + in lib.concatStrings (addNewlines (configFromPatches ++ extraConfig)); + + config = + if kernelConfig != null then kernelConfig else + if userModeLinux then ./config-2.6.23-uml else + if stdenv.system == "i686-linux" then ./config-2.6.23-i686-smp else + if stdenv.system == "x86_64-linux" then ./config-2.6.23-x86_64-smp else + abort "No kernel configuration for your platform!"; + + 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)) + + ")"); + }; +} |