From e44dad3096a21ca86398f08f882da13dff6e68ac Mon Sep 17 00:00:00 2001 From: Felix Held Date: Wed, 25 Aug 2021 01:07:31 +0200 Subject: [PATCH] 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 Suggested-by: Furquan Shaikh Change-Id: Ice4a59e5a723c3c0a40b1f3f3227aee6b9dcb39a Reviewed-on: https://review.coreboot.org/c/coreboot/+/57129 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/soc/amd/common/fsp/Makefile.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/soc/amd/common/fsp/Makefile.inc b/src/soc/amd/common/fsp/Makefile.inc index 8a5cef5ffe..503d3bfc0e 100644 --- a/src/soc/amd/common/fsp/Makefile.inc +++ b/src/soc/amd/common/fsp/Makefile.inc @@ -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