summaryrefslogtreecommitdiff
path: root/scripts/Makefile.modinst
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-08-23 20:50:45 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2023-09-01 15:56:30 +0900
commit2dfec887c0fd7d25d26b2ba7e60479208f9b6fb8 (patch)
treed895bba6ffd7faba2c29f230f81dd0dd46dac952 /scripts/Makefile.modinst
parentd8131c2965d5ee59bfa4d548641e52a13cbe17c9 (diff)
downloadlwn-2dfec887c0fd7d25d26b2ba7e60479208f9b6fb8.tar.gz
lwn-2dfec887c0fd7d25d26b2ba7e60479208f9b6fb8.zip
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>
Diffstat (limited to 'scripts/Makefile.modinst')
-rw-r--r--scripts/Makefile.modinst8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 7a64ece9b826..96fea7c5dbe1 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -9,6 +9,8 @@ __modinst:
include include/config/auto.conf
include $(srctree)/scripts/Kbuild.include
+install-y :=
+
modules := $(call read-file, $(MODORDER))
ifeq ($(KBUILD_EXTMOD),)
@@ -27,6 +29,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz
suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
+install-$(CONFIG_MODULES) += $(modules)
__modinst: $(modules)
@:
@@ -35,7 +38,7 @@ __modinst: $(modules)
# Installation
#
quiet_cmd_install = INSTALL $@
- cmd_install = mkdir -p $(dir $@); cp $< $@
+ cmd_install = cp $< $@
# Strip
#
@@ -81,6 +84,9 @@ endif
ifeq ($(modules_sign_only),)
+# Create necessary directories
+$(shell mkdir -p $(sort $(dir $(install-y))))
+
$(dst)/%.ko: $(extmod_prefix)%.ko FORCE
$(call cmd,install)
$(call cmd,strip)