diff options
-rw-r--r-- | src/soc/intel/common/block/cse/Makefile.mk | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/soc/intel/common/block/cse/Makefile.mk b/src/soc/intel/common/block/cse/Makefile.mk index 33277571f6..653d67463c 100644 --- a/src/soc/intel/common/block/cse/Makefile.mk +++ b/src/soc/intel/common/block/cse/Makefile.mk @@ -68,10 +68,6 @@ endif ifeq ($(CONFIG_SOC_INTEL_CSE_RW_UPDATE),y) -ifeq ($(CONFIG_SOC_INTEL_CSE_RW_VERSION),"") -$(error "CSE RW version is missing and need to be set by mainboard config") -endif - ifneq ($(CONFIG_STITCH_ME_BIN),y) ifeq ($(CONFIG_SOC_INTEL_CSE_RW_FILE),"") @@ -93,8 +89,20 @@ ifeq ($(CONFIG_SOC_INTEL_CSE_LITE_COMPRESS_ME_RW),y) $(CSE_LITE_ME_RW)-compression := LZMA endif +INPUT_FILE := $(call strip_quotes,$(CONFIG_SOC_INTEL_CSE_RW_FILE)) +TEMP_FILE := $(shell mktemp) +OFFSETS := 16 18 20 22 # Offsets for CSE version components +VERSIONS := CSE_VERSION_MAJOR CSE_VERSION_MINOR CSE_VERSION_HOTFIX CSE_VERSION_BUILD +INDEXES := $(shell seq 1 $(words $(OFFSETS))) + $(obj)/cse_rw.version: - @echo '$(call strip_quotes,$(CONFIG_SOC_INTEL_CSE_RW_VERSION))' > $@ + $(foreach index,$(INDEXES), \ + $(shell dd if=$(INPUT_FILE) of=$(TEMP_FILE) bs=1 skip=$(word $(index),$(OFFSETS)) count=2 status=none) \ + $(eval $(word $(index),$(VERSIONS)) := $(shell printf "%d" 0x$(shell echo $(shell echo $(shell xxd -p $(TEMP_FILE)) | cut -c3-4)$(shell echo $(shell xxd -p $(TEMP_FILE)) | cut -c1-2))) ) \ + ) + rm -f $(TEMP_FILE) + $(eval CSE_RW_CBFS_VERSION := $(shell printf "%d.%d.%d.%d" $(CSE_VERSION_MAJOR)$(CSE_VERSION_MINOR)$(CSE_VERSION_HOTFIX)$(CSE_VERSION_BUILD))) + @echo '$(CSE_RW_CBFS_VERSION)' > $@ CSE_RW_VERSION = $(call strip_quotes,$(CONFIG_SOC_INTEL_CSE_RW_VERSION_CBFS_NAME)) regions-for-file-$(CSE_RW_VERSION) = FW_MAIN_A,FW_MAIN_B |