[openwrt/openwrt] build: kernel: avoid unnecessary package rebuilds
LEDE Commits
lede-commits at lists.infradead.org
Tue Nov 2 01:57:06 PDT 2021
nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/6b8b5e7248fd8562e8cdd5ef6f3d52f51418fc3b
commit 6b8b5e7248fd8562e8cdd5ef6f3d52f51418fc3b
Author: Eneas U de Queiroz <cotequeiroz at gmail.com>
AuthorDate: Fri Oct 15 10:30:05 2021 -0300
build: kernel: avoid unnecessary package rebuilds
The $(LINUX_DIR)/.config timesptamp changes between runs of
make target/compile and make target/install (which builds the image).
Kernel-dependent packages and out of tree modules are built in between
those runs, and they check the .config timestamp to decide if they need
to be rebuilt.
Save the target/compile .config to use its timestamp if the file does
not change between runs. That way the subsequent kernel packages are
not unnecessarily rebuilt when you run 'make' back to back.
Signed-off-by: Eneas U de Queiroz <cotequeiroz at gmail.com>
---
include/kernel-defaults.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index f2864d6a10..77a612dbe1 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -128,6 +128,10 @@ endef
define Kernel/CompileModules/Default
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
+$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
+ # If .config did not change, use the previous timestamp to avoid package rebuilds
+ cmp -s $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save && \
+ mv $(LINUX_DIR)/.config.modules.save $(LINUX_DIR)/.config; \
+ $(CP) $(LINUX_DIR)/.config $(LINUX_DIR)/.config.modules.save
endef
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
More information about the lede-commits
mailing list