Author: shlevy
Date: Sun Oct  2 11:01:08 2011
New Revision: 29559
URL: https://ssl.nixos.org/websvn/nix/?rev=29559&sc=1

Log:
Linux 3.x: Use our module directory during modules_install

The "unset MODULE_DIR" trick was enough to get Linux 3.x kernels compiling, but 
it was definitely the Wrong Thing
We NEED MODULE_DIR set so that depmod can store the right dependencies during 
the build. The REAL problem with the
3.x kernels was two-fold: Our module-init-tools was so old that the kernel 
build needed to introduce a hack when
calling depmod (involving creating a symlink prepending 99.98 to the version 
number), and the depmod wrapper was
moved out of the Makefile into scripts/depmod.sh, so our substituteInPlace to 
get rid of '-b $(INSTALL_MOD_PATH)' in
the Makefile was a noop and INSTALL_MOD_PATH was still being passed to depmod. 
This is now fixed and modprobe can
successfully find dependencies using the modules.dep created during install

Modified:
   nixpkgs/trunk/pkgs/os-specific/linux/kernel/generic.nix
   nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.0.nix
   nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.1.nix

Modified: nixpkgs/trunk/pkgs/os-specific/linux/kernel/generic.nix
==============================================================================
--- nixpkgs/trunk/pkgs/os-specific/linux/kernel/generic.nix     Sun Oct  2 
09:24:23 2011        (r29558)
+++ nixpkgs/trunk/pkgs/os-specific/linux/kernel/generic.nix     Sun Oct  2 
11:01:08 2011        (r29559)
@@ -38,7 +38,6 @@
 , extraMeta ? {}
 , ubootChooser ? null
 , postInstall ? ""
-, setModuleDir ? true
 
 , # After the builder did a 'make all' (kernel + modules)
   # we force building the target asked: bzImage/zImage/uImage/...
@@ -80,15 +79,6 @@
 
   inherit preConfigure src module_init_tools localVersion postInstall;
 
-  #Currently, the builder sets $MODULE_DIR during installPhase. This causes
-  #problems with at least linux 3.0, so we need to conditionally avoid
-  #setting $MODULE_DIR. This prepend to postBuild accomplishes this with a
-  #sed/eval trick thanks to MarcWeber
-
-  postBuild = (if setModuleDir then "" else '' 
-    eval "$(type installPhase | sed -e '1d' -e '/export MODULE_DIR/d')";
-  '') + postBuild;
-
   patches = map (p: p.patch) kernelPatches;
 
   kernelConfig = kernelConfigFun config;

Modified: nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.0.nix
==============================================================================
--- nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.0.nix   Sun Oct  2 
09:24:23 2011        (r29558)
+++ nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.0.nix   Sun Oct  2 
11:01:08 2011        (r29559)
@@ -202,6 +202,10 @@
   rec {
     version = "3.0.4";
   
+    preConfigure = ''
+      substituteInPlace scripts/depmod.sh --replace '-b "$INSTALL_MOD_PATH"' ""
+    '';
+
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.bz2";
       sha256 = "1vypjcdii75h5f4zsw9lm8wzxd5ix0mk5p94c96hxv828mqqkmhk";
@@ -210,8 +214,6 @@
     config = configWithPlatform stdenv.platform;
     configCross = configWithPlatform stdenv.cross.platform;
 
-    setModuleDir = false;
-
     features.iwlwifi = true;
   }
 

Modified: nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.1.nix
==============================================================================
--- nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.1.nix   Sun Oct  2 
09:24:23 2011        (r29558)
+++ nixpkgs/trunk/pkgs/os-specific/linux/kernel/linux-3.1.nix   Sun Oct  2 
11:01:08 2011        (r29559)
@@ -203,6 +203,10 @@
     version = "3.1-rc8";
 
     modDirVersion = "3.1.0-rc8";
+
+    preConfigure = ''
+      substituteInPlace scripts/depmod.sh --replace '-b "$INSTALL_MOD_PATH"' ""
+    '';
   
     src = fetchurl {
       url = "https://github.com/torvalds/linux/tarball/v${version}";;
@@ -213,8 +217,6 @@
     config = configWithPlatform stdenv.platform;
     configCross = configWithPlatform stdenv.cross.platform;
 
-    setModuleDir = false;
-
     features.iwlwifi = true;
   }
 
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to