Skip to content

Commit

Permalink
Merge pull request #38470 from roberth/linux-without-modules
Browse files Browse the repository at this point in the history
linux module handling: support kernels without modules
  • Loading branch information
7c6f434c committed Apr 12, 2018
2 parents 2a64482 + 30bff42 commit 38e04bb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkgs/build-support/kernel/modules-closure.sh
@@ -1,5 +1,19 @@
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 *)

echo "kernel version is $version"
Expand Down
6 changes: 6 additions & 0 deletions pkgs/os-specific/linux/kmod/aggregator.nix
Expand Up @@ -9,6 +9,12 @@ buildEnv {
''
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 *)
if test "$(echo $kernelVersion | wc -w)" != 1; then
echo "inconsistent kernel versions: $kernelVersion"
Expand Down

0 comments on commit 38e04bb

Please sign in to comment.