diff --git a/pkgs/build-support/kernel/modules-closure.nix b/pkgs/build-support/kernel/modules-closure.nix index cc197edbef19..cad0c7a21f94 100644 --- a/pkgs/build-support/kernel/modules-closure.nix +++ b/pkgs/build-support/kernel/modules-closure.nix @@ -4,12 +4,12 @@ # Also generate an appropriate modules.dep. { stdenv, kernel, nukeReferences, rootModules -, module_init_tools, allowMissing ? false }: +, kmod, allowMissing ? false }: stdenv.mkDerivation { name = kernel.name + "-shrunk"; builder = ./modules-closure.sh; buildInputs = [nukeReferences]; - inherit kernel rootModules module_init_tools allowMissing; + inherit kernel rootModules kmod allowMissing; allowedReferences = ["out"]; } diff --git a/pkgs/build-support/kernel/modules-closure.sh b/pkgs/build-support/kernel/modules-closure.sh index aa2615eb578d..d0ac88f69247 100644 --- a/pkgs/build-support/kernel/modules-closure.sh +++ b/pkgs/build-support/kernel/modules-closure.sh @@ -2,24 +2,20 @@ source $stdenv/setup set -o pipefail -PATH=$module_init_tools/sbin:$PATH +PATH=$kmod/sbin:$PATH version=$(cd $kernel/lib/modules && ls -d *) echo "kernel version is $version" -export MODULE_DIR=$(readlink -f $kernel/lib/modules/) - # Determine the dependencies of each root module. closure= for module in $rootModules; do 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 //') \ || 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" fi done @@ -41,4 +37,4 @@ for module in $closure; do echo $target >> $out/insmod-list done -MODULE_DIR=$out/lib/modules/ depmod -a $version +depmod -b $out -a $version diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2565ef2d87dc..8b36b2f1595f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -348,10 +348,9 @@ let 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 { - inherit stdenv module_init_tools kernel nukeReferences - rootModules allowMissing; + inherit stdenv kmod kernel nukeReferences rootModules allowMissing; }; pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;