From 34144e835dc1fbc31dc8e38662ff330c278db1c7 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 2 Oct 2011 11:01:08 +0000 Subject: [PATCH] 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 svn path=/nixpkgs/trunk/; revision=29559 --- pkgs/os-specific/linux/kernel/generic.nix | 10 ---------- pkgs/os-specific/linux/kernel/linux-3.0.nix | 6 ++++-- pkgs/os-specific/linux/kernel/linux-3.1.nix | 6 ++++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index af62125eb75..9fe1dedda86 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -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 @@ stdenv.mkDerivation { 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; diff --git a/pkgs/os-specific/linux/kernel/linux-3.0.nix b/pkgs/os-specific/linux/kernel/linux-3.0.nix index 1b685cd2d94..6f1a32e5c0f 100644 --- a/pkgs/os-specific/linux/kernel/linux-3.0.nix +++ b/pkgs/os-specific/linux/kernel/linux-3.0.nix @@ -202,6 +202,10 @@ import ./generic.nix ( 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 @@ import ./generic.nix ( config = configWithPlatform stdenv.platform; configCross = configWithPlatform stdenv.cross.platform; - setModuleDir = false; - features.iwlwifi = true; } diff --git a/pkgs/os-specific/linux/kernel/linux-3.1.nix b/pkgs/os-specific/linux/kernel/linux-3.1.nix index ae78de1e476..4f8d08340e6 100644 --- a/pkgs/os-specific/linux/kernel/linux-3.1.nix +++ b/pkgs/os-specific/linux/kernel/linux-3.1.nix @@ -203,6 +203,10 @@ import ./generic.nix ( 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 @@ import ./generic.nix ( config = configWithPlatform stdenv.platform; configCross = configWithPlatform stdenv.cross.platform; - setModuleDir = false; - features.iwlwifi = true; }