diff options
author | aszlig <aszlig@redmoonstudios.org> | 2016-08-30 06:26:12 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2016-08-30 06:55:52 +0200 |
commit | f19c961b4e461da045f2e72e73701059e5117be0 (patch) | |
tree | 1d1b4accbba99222ae9d47a03da0d920ee5477b7 | |
parent | e7b2f05d209b8d07263a6b3891f1eae1cc12944a (diff) | |
download | nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.tar nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.tar.gz nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.tar.bz2 nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.tar.lz nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.tar.xz nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.tar.zst nixpkgs-f19c961b4e461da045f2e72e73701059e5117be0.zip |
linux-testing: Fix arg list too long in modinst
With the default kernel and thus with the build I have tested in 74ec94bfa2e57e2c0beeee0e469de58391d04a7b, we get an error during modules_install: make[2]: execvp: /nix/store/.../bin/bash: Argument list too long I haven't noticed this build until I actually tried booting using this kernel because make didn't fail here. The reason this happens within Nix and probably didn't yet surface in other distros is that programs only have a limited amount of memory available for storing the environment and the arguments. Environment variables however are quite common on Nix and thus we stumble on problems like this way earlier - in this case Linux 4.8 - but I have noticed this in 4.7-next as well already. The fix is far from perfect and suffers performance overhead because we now run grep for every *.mod file instead of passing all *.mod files into one single invocation of grep. But comparing the performance overhead (around 1s on my machine) with the overall build time of the kernel I think the overhead really is neglicible. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r-- | pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch | 14 | ||||
-rw-r--r-- | pkgs/os-specific/linux/kernel/patches.nix | 5 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 14 |
3 files changed, 27 insertions, 6 deletions
diff --git a/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch b/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch new file mode 100644 index 00000000000..58a9191989a --- /dev/null +++ b/pkgs/os-specific/linux/kernel/modinst-arg-list-too-long.patch @@ -0,0 +1,14 @@ +diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst +index 07650ee..934a7a8 100644 +--- a/scripts/Makefile.modinst ++++ b/scripts/Makefile.modinst +@@ -9,7 +9,8 @@ include scripts/Kbuild.include + + # + +-__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) ++__modules := $(sort $(foreach f,$(wildcard $(MODVERDIR)/*.mod),$(shell \ ++ grep -h '\.ko$$' '$f'))) + modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) + + PHONY += $(modules) diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 2a74f9063bf..03a3023053a 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -74,6 +74,11 @@ rec { patch = ./mips-ext3-n32.patch; }; + modinst_arg_list_too_long = + { name = "modinst-arglist-too-long"; + patch = ./modinst-arg-list-too-long.patch; + }; + ubuntu_fan_4_4 = { name = "ubuntu-fan"; patch = ./ubuntu-fan-4.4.patch; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 302069fd521..9b1234b3b40 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11185,12 +11185,14 @@ in }; linux_testing = callPackage ../os-specific/linux/kernel/linux-testing.nix { - kernelPatches = [ kernelPatches.bridge_stp_helper ] - ++ lib.optionals ((platform.kernelArch or null) == "mips") - [ kernelPatches.mips_fpureg_emu - kernelPatches.mips_fpu_sigill - kernelPatches.mips_ext3_n32 - ]; + kernelPatches = [ + kernelPatches.bridge_stp_helper + kernelPatches.modinst_arg_list_too_long + ] ++ lib.optionals ((platform.kernelArch or null) == "mips") [ + kernelPatches.mips_fpureg_emu + kernelPatches.mips_fpu_sigill + kernelPatches.mips_ext3_n32 + ]; }; linux_chromiumos_3_14 = callPackage ../os-specific/linux/kernel/linux-chromiumos-3.14.nix { |