aboutsummaryrefslogtreecommitdiffstats
path: root/include/kernel-build.mk
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2022-09-06 16:48:37 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2022-12-04 16:43:04 +0100
commitd419136ad5bfa0449083b1a07a9a265cea20dcd5 (patch)
treec84f8c0789f98cc8cb75273629c57a515350583b /include/kernel-build.mk
parentbe2da47ced2fd0842922fdbd7a428a19138f6fc2 (diff)
downloadupstream-d419136ad5bfa0449083b1a07a9a265cea20dcd5.tar.gz
upstream-d419136ad5bfa0449083b1a07a9a265cea20dcd5.tar.bz2
upstream-d419136ad5bfa0449083b1a07a9a265cea20dcd5.zip
build: make find_md5 reproducible with AUTOREMOVE
While experimenting with the AUTOREMOVE option in search of a way to use prebuilt host tools in different buildroot, it was discovered that the md5 generated by find_md5 in depends.mk is not reproducible. Currently the hash is generated by the path of the file in addition to the file mod time. Out of confusion, probably, there was an idea that such command was used on the package build_dir. Reality is that this command is run on the package files. (Makefile, patches, src) This is problematic because the package Makefile (for example) change at each git clone and base the hash on the Makefile mtime doesn't really reflect if the Makefile actually changes across a buildroot or not. A better approach is to generate an hash of each file and then generate an hash on the sort hash list. This way we remove the problem of git clone setting a wrong mtime while keeping the integrity of checking if a file changed for the package as any change will result in a different hash. Introduce a new kind of find_md5 function, find_md5_reproducible that apply this new logic and limit it only with AUTOREMOVE option set to prevent any kind of slowdown due to additional hash generation. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit 53a08e37437972ba0a8fbf953a93a70a6b784ef4)
Diffstat (limited to 'include/kernel-build.mk')
-rw-r--r--include/kernel-build.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 80da4455bc..5dd033cda6 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -10,7 +10,7 @@ ifneq ($(DUMP),1)
endif
KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
-STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),)))
+STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call $(if $(CONFIG_AUTOREMOVE),find_md5_reproducible,find_md5),$(KERNEL_FILE_DEPENDS),)))
STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
include $(INCLUDE_DIR)/download.mk
include $(INCLUDE_DIR)/quilt.mk