build: Add macro for sha1 checked add-radio-file
This makes it slightly safer in case radio/*.img contains LFS pointer
instead of actual blob.
Change-Id: Ia3561400c62675eac9f717f7eae74e4cdf71cf45
diff --git a/build/core/utils.mk b/build/core/utils.mk
index 4b29233..dedb214 100644
--- a/build/core/utils.mk
+++ b/build/core/utils.mk
@@ -201,3 +201,12 @@
$(if $(strip $(acn)),true,) \
)
endef
+
+# $(call add-radio-file-sha1-checked,path,sha1)
+define add-radio-file-sha1-checked
+ $(eval path := $(LOCAL_PATH)/$(1))
+ $(eval sha1 := $(shell sha1sum "$(path)" | cut -d" " -f 1))
+ $(if $(filter $(sha1),$(2)),
+ $(call add-radio-file,$(1)),
+ $(error $(path) SHA1 mismatch ($(sha1) != $(2))))
+endef