about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2007-05-15 12:53:03 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2007-05-15 12:53:03 +0000
commit311dc72bf125bc4d701c678223ef278617e44b41 (patch)
tree95964cc57b34ef47ffa84638f8f006d7d8d99189
parentceb097cd01fefadc1ae971bf999f493b712ced6d (diff)
downloadnixlib-311dc72bf125bc4d701c678223ef278617e44b41.tar
nixlib-311dc72bf125bc4d701c678223ef278617e44b41.tar.gz
nixlib-311dc72bf125bc4d701c678223ef278617e44b41.tar.bz2
nixlib-311dc72bf125bc4d701c678223ef278617e44b41.tar.lz
nixlib-311dc72bf125bc4d701c678223ef278617e44b41.tar.xz
nixlib-311dc72bf125bc4d701c678223ef278617e44b41.tar.zst
nixlib-311dc72bf125bc4d701c678223ef278617e44b41.zip
* Suppress localversion from kernel patches, allow the user to set
  one.
* Allow the entire kernel configuration to be overridden through a
  function argument.

svn path=/nixpkgs/trunk/; revision=8699
-rw-r--r--pkgs/os-specific/linux/kernel/builder.sh13
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.20.nix14
2 files changed, 26 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh
index 336d11d9ac1b..9aec3b0b8de9 100644
--- a/pkgs/os-specific/linux/kernel/builder.sh
+++ b/pkgs/os-specific/linux/kernel/builder.sh
@@ -6,6 +6,19 @@ configurePhase() {
     export INSTALL_PATH=$out
     export INSTALL_MOD_PATH=$out
 
+
+    # Get rid of any "localversion" files installed by patches.
+    if test -z "$allowLocalVersion"; then
+        rm -f localversion*
+    fi
+
+    # Set our own localversion, if specified.
+    if test -n "$localVersion"; then
+        echo "$localVersion" > localversion-nix
+    fi
+
+
+    # Create the config file.
     cp $config .config
     chmod u+w .config
 
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.20.nix b/pkgs/os-specific/linux/kernel/linux-2.6.20.nix
index d839a7632fee..0d3df58459c3 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.20.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.20.nix
@@ -8,6 +8,14 @@
 
 , # 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";
@@ -33,6 +41,7 @@ stdenv.mkDerivation {
   extraConfig = lib.concatStrings (map (p: "\n" + p.extraConfig + "\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
@@ -44,12 +53,15 @@ stdenv.mkDerivation {
     if userModeLinux then "um" else
     if stdenv.system == "i686-linux" then "i386" else
     if stdenv.system == "x86_64-linux" then "x86_64" else
-    abort "";
+    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