about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/os-specific/linux/kernel/builder.sh3
-rw-r--r--pkgs/os-specific/linux/kernel/generate-config.pl3
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix8
-rw-r--r--pkgs/top-level/platforms.nix4
4 files changed, 15 insertions, 3 deletions
diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh
index a67877c9fd6af..9c7f0ea4086b2 100644
--- a/pkgs/os-specific/linux/kernel/builder.sh
+++ b/pkgs/os-specific/linux/kernel/builder.sh
@@ -30,7 +30,8 @@ configurePhase() {
     # Create the config file.
     echo "generating kernel configuration..."
     echo "$kernelConfig" > kernel-config
-    DEBUG=1 ARCH=$arch KERNEL_CONFIG=kernel-config perl -w $generateConfig
+    DEBUG=1 ARCH=$arch KERNEL_CONFIG=kernel-config AUTO_MODULES=$autoModules \
+        perl -w $generateConfig
 }
 
 
diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl
index e8f7e6555d33b..3db050c900c7b 100644
--- a/pkgs/os-specific/linux/kernel/generate-config.pl
+++ b/pkgs/os-specific/linux/kernel/generate-config.pl
@@ -13,6 +13,7 @@ use strict;
 use IPC::Open2;
 
 my $debug = $ENV{'DEBUG'};
+my $autoModules = $ENV{'AUTO_MODULES'};
     
 $SIG{PIPE} = 'IGNORE';
 
@@ -69,7 +70,7 @@ sub runConfig {
                 my $question = $1; my $name = $2; my $alts = $3;
                 my $answer = "";
                 # Build everything as a module if possible.
-                $answer = "m" if $alts =~ /\/m/;
+                $answer = "m" if $autoModules && $alts =~ /\/m/;
                 $answer = $answers{$name} if defined $answers{$name};
                 print STDERR "QUESTION: $question, NAME: $name, ALTS: $alts, ANSWER: $answer\n" if $debug;
                 print OUT "$answer\n";
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index f1981d261c699..42e12314a2178 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -33,7 +33,12 @@
 
 , preConfigure ? ""
 , extraMeta ? {}
-, platform ? { name = "pc"; uboot = null; kernelBaseConfig = "defconfig"; }
+, platform ? {
+    name = "pc";
+    uboot = null;
+    kernelBaseConfig = "defconfig";
+    kernelAutoModules = true;
+  }
 , ...
 }:
 
@@ -64,6 +69,7 @@ stdenv.mkDerivation {
   generateConfig = ./generate-config.pl;
 
   inherit preConfigure src module_init_tools localVersion;
+  autoModules = platform.kernelAutoModules;
 
   patches = map (p: p.patch) kernelPatches;
 
diff --git a/pkgs/top-level/platforms.nix b/pkgs/top-level/platforms.nix
index a80c328ea00e0..305b4dbd537c1 100644
--- a/pkgs/top-level/platforms.nix
+++ b/pkgs/top-level/platforms.nix
@@ -5,6 +5,8 @@ with pkgs;
     name = "pc";
     uboot = null;
     kernelBaseConfig = "defconfig";
+    # Build whatever possible as a module, if not stated in the extra config.
+    kernelAutoModules = true;
     kernelExtraConfig =
       ''
         # Virtualisation (KVM, Xen...).
@@ -23,6 +25,7 @@ with pkgs;
     name = "sheevaplug";
     kernelBaseConfig = "kirkwood_defconfig";
     kernelArch = "arm";
+    kernelAutoModules = false;
     kernelExtraConfig =
       ''
         BLK_DEV_RAM y
@@ -51,6 +54,7 @@ with pkgs;
     name = "versatileARM";
     kernelBaseConfig = "versatile_defconfig";
     kernelArch = "arm";
+    kernelAutoModules = false;
     uboot = null;
   };
 }