2013-08-09 19:55:45 +04:00
|
|
|
{ stdenv, kmod, modules, buildEnv }:
|
2008-01-04 20:02:12 +03:00
|
|
|
|
2009-04-20 23:13:40 +04:00
|
|
|
buildEnv {
|
2008-05-08 19:36:19 +04:00
|
|
|
name = "kernel-modules";
|
|
|
|
|
2009-04-20 23:13:40 +04:00
|
|
|
paths = modules;
|
|
|
|
|
|
|
|
postBuild =
|
|
|
|
''
|
|
|
|
source ${stdenv}/setup
|
2013-08-09 19:55:45 +04:00
|
|
|
|
2009-04-20 23:13:40 +04:00
|
|
|
kernelVersion=$(cd $out/lib/modules && ls -d *)
|
|
|
|
if test "$(echo $kernelVersion | wc -w)" != 1; then
|
|
|
|
echo "inconsistent kernel versions: $kernelVersion"
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-08-09 19:55:45 +04:00
|
|
|
|
2009-04-20 23:13:40 +04:00
|
|
|
echo "kernel version is $kernelVersion"
|
|
|
|
|
2016-10-11 12:40:48 +03:00
|
|
|
shopt -s extglob
|
|
|
|
|
2009-04-20 23:13:40 +04:00
|
|
|
# Regenerate the depmod map files. Be sure to pass an explicit
|
|
|
|
# kernel version number, otherwise depmod will use `uname -r'.
|
|
|
|
if test -w $out/lib/modules/$kernelVersion; then
|
2016-10-11 12:40:48 +03:00
|
|
|
rm -f $out/lib/modules/$kernelVersion/modules.!(builtin*|order*)
|
2016-08-14 12:57:45 +03:00
|
|
|
${kmod}/bin/depmod -b $out -a $kernelVersion
|
2009-04-20 23:13:40 +04:00
|
|
|
fi
|
|
|
|
'';
|
2008-01-04 20:02:12 +03:00
|
|
|
}
|