at 16.09-beta 36 lines 1.2 kB view raw
1source $stdenv/setup 2 3version=$(cd $kernel/lib/modules && ls -d *) 4 5echo "kernel version is $version" 6 7# Determine the dependencies of each root module. 8closure= 9for module in $rootModules; do 10 echo "root module: $module" 11 deps=$(modprobe --config no-config -d $kernel --set-version "$version" --show-depends "$module" \ 12 | sed 's/^insmod //') \ 13 || if test -z "$allowMissing"; then exit 1; fi 14 if [[ "$deps" != builtin* ]]; then 15 closure="$closure $deps" 16 fi 17done 18 19echo "closure:" 20mkdir -p $out/lib/modules/"$version" 21for module in $closure; do 22 target=$(echo $module | sed "s^$NIX_STORE.*/lib/modules/^$out/lib/modules/^") 23 if test -e "$target"; then continue; fi 24 if test \! -e "$module"; then continue; fi # XXX: to avoid error with "cp builtin builtin" 25 mkdir -p $(dirname $target) 26 echo $module 27 cp $module $target 28 # If the kernel is compiled with coverage instrumentation, it 29 # contains the paths of the *.gcda coverage data output files 30 # (which it doesn't actually use...). Get rid of them to prevent 31 # the whole kernel from being included in the initrd. 32 nuke-refs $target 33 echo $target >> $out/insmod-list 34done 35 36depmod -b $out -a $version