From 594180d8d0bfc0dc8924b17f203cc000ba58f6ef Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 28 Feb 2024 12:37:40 -0800 Subject: [PATCH] Makefile: Optimize the code for creating the kernel module list The time needed for executing shell code strongly depends on how many times the shell has to call fork(). Hence, instead of invoking 'basename' once per kernel module, invoke 'basename' once for all kernel modules. Change-Id: Ibe322c8ebf0a466568f902beb5ab91988381678c Signed-off-by: Bart Van Assche --- core/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/Makefile b/core/Makefile index b023df1e40..381b9f75f3 100644 --- a/core/Makefile +++ b/core/Makefile @@ -465,9 +465,7 @@ $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1) $(6) ) $(if $(1),\ cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/; \ - for MODULE in $$(PRIVATE_LOAD_MODULES); do \ - basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); \ - done; \ + if [ -n "$$(PRIVATE_LOAD_MODULES)" ]; then basename -a $$(PRIVATE_LOAD_MODULES); fi > $$(PRIVATE_LOAD_FILE); \ ) # The ln -sf + find -delete sequence is to remove any modules in # PRIVATE_EXTRA_MODULES which have same basename as MODULES in PRIVATE_MODULES