2019-08-28 15:48:48 +02:00
|
|
|
{ stdenvNoCC, kmod, modules, buildEnv, name ? "kernel-modules" }:
|
2008-01-04 18:02:12 +01:00
|
|
|
|
2009-04-20 21:13:40 +02:00
|
|
|
buildEnv {
|
2019-04-13 23:22:07 +02:00
|
|
|
inherit name;
|
2008-05-08 17:36:19 +02:00
|
|
|
|
2009-04-20 21:13:40 +02:00
|
|
|
paths = modules;
|
|
|
|
|
|
|
|
postBuild =
|
|
|
|
''
|
2019-08-28 15:48:48 +02:00
|
|
|
source ${stdenvNoCC}/setup
|
2013-08-09 17:55:45 +02:00
|
|
|
|
2018-04-05 16:58:50 +02:00
|
|
|
if ! test -d "$out/lib/modules"; then
|
|
|
|
echo "No modules found."
|
|
|
|
# To support a kernel without modules
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-04-20 21:13:40 +02: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 17:55:45 +02:00
|
|
|
|
2009-04-20 21:13:40 +02:00
|
|
|
echo "kernel version is $kernelVersion"
|
|
|
|
|
2016-10-11 11:40:48 +02:00
|
|
|
shopt -s extglob
|
|
|
|
|
2009-04-20 21:13:40 +02: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 11:40:48 +02:00
|
|
|
rm -f $out/lib/modules/$kernelVersion/modules.!(builtin*|order*)
|
2019-11-03 10:57:29 +01:00
|
|
|
${kmod}/bin/depmod -b $out -C $out/etc/depmod.d -a $kernelVersion
|
2009-04-20 21:13:40 +02:00
|
|
|
fi
|
|
|
|
'';
|
2008-01-04 18:02:12 +01:00
|
|
|
}
|