Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 2dfec88

Browse files
committed
kbuild: reduce the number of mkdir calls during modules_install
Calling 'mkdir' for every module results in redundant syscalls. Use $(sort ...) to drop the duplicated directories. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
1 parent d8131c2 commit 2dfec88

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/Makefile.modinst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ __modinst:
99
include include/config/auto.conf
1010
include $(srctree)/scripts/Kbuild.include
1111

12+
install-y :=
13+
1214
modules := $(call read-file, $(MODORDER))
1315

1416
ifeq ($(KBUILD_EXTMOD),)
@@ -27,6 +29,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
2729
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
2830

2931
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
32+
install-$(CONFIG_MODULES) += $(modules)
3033

3134
__modinst: $(modules)
3235
@:
@@ -35,7 +38,7 @@ __modinst: $(modules)
3538
# Installation
3639
#
3740
quiet_cmd_install = INSTALL $@
38-
cmd_install = mkdir -p $(dir $@); cp $< $@
41+
cmd_install = cp $< $@
3942

4043
# Strip
4144
#
@@ -81,6 +84,9 @@ endif
8184

8285
ifeq ($(modules_sign_only),)
8386

87+
# Create necessary directories
88+
$(shell mkdir -p $(sort $(dir $(install-y))))
89+
8490
$(dst)/%.ko: $(extmod_prefix)%.ko FORCE
8591
$(call cmd,install)
8692
$(call cmd,strip)

0 commit comments

Comments
 (0)