From 794d1d7f6cb1092e52e24f132baf00d034591ea7 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Mon, 13 Nov 2023 02:07:01 +0100 Subject: util/ifdtool/ifdtool.c: Add NULL check for fmapname Some boards (e.g. prodrive/hermes) that do not provide their own FMAP and therefore have been generated by the build system (+ ifdtool) experience a failure when trying to build with an IFD that contains regions which do not have equivalent fmap names (set to NULL). Therefore add a NULL check for the fmapname and ignore the region if we do not have an fmapname. Test: compile prodrive/hermes Signed-off-by: Maximilian Brune Change-Id: Ib4589b7fdbd11d644214ca5601536e9aeb26882f Reviewed-on: https://review.coreboot.org/c/coreboot/+/79010 Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- util/ifdtool/ifdtool.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'util') diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index ddbc0fb91b2a..43451b165f9d 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -1068,6 +1068,14 @@ static void create_fmap_template(char *image, int size, const char *layout_fname if (region.limit == 0 || region.base == 0x07FFF000) continue; + /* Is there an FMAP equivalent? IFD reserved regions are usually thrown out + * of the FMAP here + */ + if (!region_names[region.type].fmapname) { + printf("Skip IFD region: %s\n", region_names[region.type].pretty); + continue; + } + /* Here we decide to use the coreboot generated FMAP BIOS region, instead of * the one specified in the IFD. The case when IFD and FMAP BIOS region do not * match cannot be caught here, therefore one should still validate IFD and -- cgit v1.2.3