makeModulesClosure: Use kmod instead of module-init-tools

This commit is contained in:
Eelco Dolstra 2013-08-07 22:41:51 +02:00
parent a9b4851b74
commit 4c77c6e232
3 changed files with 8 additions and 13 deletions

View File

@ -4,12 +4,12 @@
# Also generate an appropriate modules.dep. # Also generate an appropriate modules.dep.
{ stdenv, kernel, nukeReferences, rootModules { stdenv, kernel, nukeReferences, rootModules
, module_init_tools, allowMissing ? false }: , kmod, allowMissing ? false }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = kernel.name + "-shrunk"; name = kernel.name + "-shrunk";
builder = ./modules-closure.sh; builder = ./modules-closure.sh;
buildInputs = [nukeReferences]; buildInputs = [nukeReferences];
inherit kernel rootModules module_init_tools allowMissing; inherit kernel rootModules kmod allowMissing;
allowedReferences = ["out"]; allowedReferences = ["out"];
} }

View File

@ -2,24 +2,20 @@ source $stdenv/setup
set -o pipefail set -o pipefail
PATH=$module_init_tools/sbin:$PATH PATH=$kmod/sbin:$PATH
version=$(cd $kernel/lib/modules && ls -d *) version=$(cd $kernel/lib/modules && ls -d *)
echo "kernel version is $version" echo "kernel version is $version"
export MODULE_DIR=$(readlink -f $kernel/lib/modules/)
# Determine the dependencies of each root module. # Determine the dependencies of each root module.
closure= closure=
for module in $rootModules; do for module in $rootModules; do
echo "root module: $module" echo "root module: $module"
deps=$(modprobe --config /dev/null --set-version "$version" --show-depends "$module" \ deps=$(modprobe --config no-config -d $kernel --set-version "$version" --show-depends "$module" \
| sed 's/^insmod //') \ | sed 's/^insmod //') \
|| if test -z "$allowMissing"; then exit 1; fi || if test -z "$allowMissing"; then exit 1; fi
#for i in $deps; do echo $i; done if [[ "$deps" != builtin* ]]; then
if [[ "$deps" != builtin* ]]
then
closure="$closure $deps" closure="$closure $deps"
fi fi
done done
@ -41,4 +37,4 @@ for module in $closure; do
echo $target >> $out/insmod-list echo $target >> $out/insmod-list
done done
MODULE_DIR=$out/lib/modules/ depmod -a $version depmod -b $out -a $version

View File

@ -348,10 +348,9 @@ let
makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh; makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh;
makeModulesClosure = {kernel, rootModules, allowMissing ? false}: makeModulesClosure = { kernel, rootModules, allowMissing ? false }:
import ../build-support/kernel/modules-closure.nix { import ../build-support/kernel/modules-closure.nix {
inherit stdenv module_init_tools kernel nukeReferences inherit stdenv kmod kernel nukeReferences rootModules allowMissing;
rootModules allowMissing;
}; };
pathsFromGraph = ../build-support/kernel/paths-from-graph.pl; pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;