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
This commit is contained in:
LuK1337 2023-12-11 01:33:44 +01:00 committed by Michael Bestas
parent aeb5e1171e
commit c0250e3ab6

View File

@ -201,3 +201,12 @@ $(strip \
$(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