soc/amd/common/fsp/Makefile: check if FSP-M is larger than FSP_M_SIZE

The FSP-M binary needs to fit into the memory region that starts at
FSP_M_ADDR and is FSP_M_SIZE bytes large, so error out during build time
if the uncompressed FSP-M file is larger than the size of the region it
will be copied into.

BUG=b:186149011

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Suggested-by: Furquan Shaikh <furquan@google.com>
Change-Id: Ice4a59e5a723c3c0a40b1f3f3227aee6b9dcb39a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57129
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Felix Held 2021-08-25 01:07:31 +02:00
parent 5ff1808f20
commit e44dad3096
1 changed files with 7 additions and 0 deletions

View File

@ -6,4 +6,11 @@ ramstage-$(CONFIG_SOC_AMD_COMMON_FSP_DMI_TABLES) += dmi.c
subdirs-y += ./*
ifeq ($(call int-gt,\
$(call file-size,$(call strip_quotes,$(CONFIG_FSP_M_FILE)))\
$(shell printf "%d" $(CONFIG_FSP_M_SIZE))),\
1)
$(error FSP-M binary larger than FSP_M_FILE.)
endif
endif # CONFIG_PLATFORM_USES_FSP2_0