Skip to contentSkip to conversation

kbuild: avoid long argument lists in make modules_install

PATCH In review Michal Kubecek 2 participants 2 messages Sep 11, 2023 – Sep 14, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: avoid long argument lists in make modules_install

Running "make modules_install" may fail with

make[2]: execvp: /bin/sh: Argument list too long

if many modules are built and INSTALL_MOD_PATH is long. This is because scripts/Makefile.modinst creates all directories with one mkdir command. Use $(foreach ...) instead to prevent an excessive argument list.

Fixes 2dfec887c0fd ("kbuild: reduce the number of mkdir calls during modules_install")
---
 scripts/Makefile.modinst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.modinst +1 -1
index c59cc57286ba..346f5ec50682 100644
@@ -113,7 +113,7 @@ quiet_cmd_sign :=
 endif
 
 # Create necessary directories
-$(shell mkdir -p $(sort $(dir $(install-y))))
+$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
 
 $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
 	$(call cmd,install)
Signature · 1 line
2.42.0
#1 lore raw
Quoted 5 lines · Michal Kubecek

Running "make modules_install" may fail with

make[2]: execvp: /bin/sh: Argument list too long

Quoted 7 lines

if many modules are built and INSTALL_MOD_PATH is long. This is because scripts/Makefile.modinst creates all directories with one mkdir command. Use $(foreach ...) instead to prevent an excessive argument list.

Fixes 2dfec887c0fd ("kbuild: reduce the number of mkdir calls during modules_install")

---

Applied to linux-kbuild/fixes.
Thanks.

Quoted 19 lines
 scripts/Makefile.modinst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.modinst +1 -2
index c59cc57286ba..346f5ec50682 100644
@@ -113,7 +113,7 @@ quiet_cmd_sign :=
 endif
 
 # Create necessary directories
-$(shell mkdir -p $(sort $(dir $(install-y))))
+$(foreach dir, $(sort $(dir $(install-y))), $(shell mkdir -p $(dir)))
 
 $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
        $(call cmd,install)
--

2.42.0

Signature · 2 lines
Best Regards
Masahiro Yamada