* Check against accidentally mixing kernel versions (e.g. Linux 2.6.25

with AUFS built against Linux 2.6.23).

svn path=/nixpkgs/trunk/; revision=11784
This commit is contained in:
Eelco Dolstra 2008-05-08 15:36:19 +00:00
parent e6028ae5f4
commit fb790c15e9
2 changed files with 28 additions and 39 deletions

View File

@ -1,39 +1,28 @@
args : with args;
let localDefs = builderDefs {
addSbinPath = true;
src = "";
buildInputs = [module_init_tools];
configureFlags = [];
} null; /* null is a terminator for sumArgs */
in with localDefs;
let
{stdenv, module_init_tools, modules}:
doCollect = FullDepEntry (''
ensureDir $out/lib/modules
cd $out/
for i in $moduleSources; do
cp -rfs $i/* .
chmod -R u+w .
done
rm -rf nix-support
cd lib/modules/
rm */modules.*
# linux-* will pass the new kernel version to depmod to take rather than `uname -r` (see man page)
MODULE_DIR=$PWD/ depmod -a $(basename lib/modules/2.*)
cd $out/
'') [minInit addInputs defEnsureDir];
in
stdenv.mkDerivation rec {
name = "kernel-modules";
inherit moduleSources;
builder = writeScript (name + "-builder")
(textClosure localDefs [doCollect doForceShare doPropagate]);
meta = {
description = "
A directory to hold all the modules, including those
built separately from kernel. Later mentioned directories in
moduleSources have higher priority.
";
inherit src;
};
stdenv.mkDerivation {
name = "kernel-modules";
buildCommand = ''
ensureDir $out/lib/modules
cd $out/
modules="${toString modules}"
for i in $modules; do
cp -rfs $i/* .
chmod -R u+w .
v=$(cd $i/lib/modules && ls -d *)
if test -n "$version" -a "$v" != "$version"; then
echo "kernel version mismatch: $version versus $v (in the module paths $modules)";
exit 1
fi
version=$v
done
echo "kernel version is $version"
rm -rf nix-support
cd lib/modules/
rm */modules.*
# linux-* will pass the new kernel version to depmod to take rather than `uname -r` (see man page)
MODULE_DIR=$PWD/ ${module_init_tools}/sbin/depmod -a $(basename lib/modules/2.*)
cd $out/
'';
}

View File

@ -4494,9 +4494,9 @@ let pkgs = rec {
inherit fetchurl stdenv;
};
module_aggregation = moduleSources:
aggregateModules = modules:
import ../os-specific/linux/module-init-tools/aggregator.nix {
inherit fetchurl stdenv module_init_tools moduleSources builderDefs;
inherit stdenv module_init_tools modules;
};
modutils = import ../os-specific/linux/modutils {