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