mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 04:47:17 +04:00
kernel: configure the kernel only when an input changed
The configure stage rewrites the kernel configuration on every build. It runs kconfig.pl twice and package-metadata.pl once, which takes an eighth of a second. target/compile and target/install both pay it. The rule carries FORCE because the kernel configuration also depends on the package metadata, which is not a prerequisite. Add a check file that the rule creates only when the configure stage must run, and make the stamp depend on it. The check covers the kernel configuration files, .config, the package metadata, the scripts that read them, the two build system files that hold the recipe, the target directory and the user headers. This takes the time of target/linux install on an unchanged tree from 1.33 s to 1.15 s, and the time of a full no-op build from 3.68 s to 3.40 s for the OpenWrt One. Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
1 parent
746c76168c
commit
e97e3f36bd
1 file changed
+13
-1
+13
-1
@@ -81,6 +81,11 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
|
||||
endif
|
||||
endif
|
||||
|
||||
KERNEL_CONFIG_CHECK:=$(LINUX_DIR)/.configured-check
|
||||
KERNEL_CONFIG_DEPENDS:=$(LINUX_KCONFIG_LIST) $(TOPDIR)/.config $(TMP_DIR)/.packageinfo \
|
||||
$(SCRIPT_DIR)/kconfig.pl $(SCRIPT_DIR)/package-metadata.pl $(SCRIPT_DIR)/metadata.pm \
|
||||
$(INCLUDE_DIR)/kernel-defaults.mk $(INCLUDE_DIR)/kernel-build.mk $(CURDIR)
|
||||
|
||||
IMAGE_INSTALL_STAMP:=$(KERNEL_BUILD_DIR)/.image_install
|
||||
IMAGE_INSTALL_INPUTS:=$(LINUX_DIR) $(STAGING_DIR)/image \
|
||||
$(STAGING_DIR_HOST)/bin $(CURDIR) $(INCLUDE_DIR) $(SCRIPT_DIR) $(TOPDIR)/.config
|
||||
@@ -149,7 +154,14 @@ define BuildKernel
|
||||
) > $$@
|
||||
$(call BuildTimeLog,end,compile)
|
||||
|
||||
$(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_KCONFIG_LIST) $(TOPDIR)/.config FORCE
|
||||
$(KERNEL_CONFIG_CHECK): $(STAMP_PREPARED) $(LINUX_KCONFIG_LIST) $(TOPDIR)/.config FORCE
|
||||
@mkdir -p $(LINUX_DIR)
|
||||
@[ -f $(STAMP_CONFIGURED) ] && [ -d $(LINUX_DIR)/user_headers ] && \
|
||||
[ -z "$$$$(find $(KERNEL_CONFIG_DEPENDS) ! -type d \
|
||||
-newer $(STAMP_CONFIGURED) -print -quit 2>/dev/null)" ] || \
|
||||
touch $$@
|
||||
|
||||
$(STAMP_CONFIGURED): $(KERNEL_CONFIG_CHECK)
|
||||
$(call BuildTimeLog,begin,configure)
|
||||
$(Kernel/Configure)
|
||||
touch $$@
|
||||
|
||||
Reference in new issue
Block a user