git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #38470 from roberth/linux-without-modules

linux module handling: support kernels without modules

commit38e04bbf29fe3b6af26b3505a42ce5871aeac17d authorMichael Raskin <7c6f434c@mail.ru> dateThu 12 Apr 2018, 06:31 (9 years ago) parent2a6448230bff42
2 files changed+20
pkgs/build-support/kernel/modules-closure.sh+14 pkgs/os-specific/linux/kmod/aggregator.nix+6
pkgs/build-support/kernel/modules-closure.sh+14
@@ -1,5 +1,19 @@
11source $stdenv/setup
22
3+# When no modules are built, the $out/lib/modules directory will not
4+# exist. Because the rest of the script assumes it does exist, we
5+# handle this special case first.
6+if ! test -d "$out/lib/modules"; then
7+ if test -z "$rootModules" || test -n "$allowMissing"; then
8+ mkdir -p "$out"
9+ exit 0
10+ else
11+ echo "Required modules: $rootModules"
12+ echo "Can not derive a closure of kernel modules because no modules were provided."
13+ exit 1
14+ fi
15+fi
16+
317version=$(cd $kernel/lib/modules && ls -d *)
418
519echo "kernel version is $version"
pkgs/os-specific/linux/kmod/aggregator.nix+6
@@ -9,6 +9,12 @@ buildEnv {
99 ''
1010 source ${stdenv}/setup
1111
12+ if ! test -d "$out/lib/modules"; then
13+ echo "No modules found."
14+ # To support a kernel without modules
15+ exit 0
16+ fi
17+
1218 kernelVersion=$(cd $out/lib/modules && ls -d *)
1319 if test "$(echo $kernelVersion | wc -w)" != 1; then
1420 echo "inconsistent kernel versions: $kernelVersion"