linux module handling: support kernels without modules

This commit is contained in:
Robert Hensing 2018-04-05 16:58:50 +02:00
parent 59ddb3ebfb
commit 30bff42231
2 changed files with 20 additions and 0 deletions

View file

@ -1,5 +1,19 @@
source $stdenv/setup source $stdenv/setup
# When no modules are built, the $out/lib/modules directory will not
# exist. Because the rest of the script assumes it does exist, we
# handle this special case first.
if ! test -d "$out/lib/modules"; then
if test -z "$rootModules" || test -n "$allowMissing"; then
mkdir -p "$out"
exit 0
else
echo "Required modules: $rootModules"
echo "Can not derive a closure of kernel modules because no modules were provided."
exit 1
fi
fi
version=$(cd $kernel/lib/modules && ls -d *) version=$(cd $kernel/lib/modules && ls -d *)
echo "kernel version is $version" echo "kernel version is $version"

View file

@ -9,6 +9,12 @@ buildEnv {
'' ''
source ${stdenv}/setup source ${stdenv}/setup
if ! test -d "$out/lib/modules"; then
echo "No modules found."
# To support a kernel without modules
exit 0
fi
kernelVersion=$(cd $out/lib/modules && ls -d *) kernelVersion=$(cd $out/lib/modules && ls -d *)
if test "$(echo $kernelVersion | wc -w)" != 1; then if test "$(echo $kernelVersion | wc -w)" != 1; then
echo "inconsistent kernel versions: $kernelVersion" echo "inconsistent kernel versions: $kernelVersion"