summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2023-03-08 15:33:13 -0700
committerMartin L Roth <gaumless@gmail.com>2023-03-15 19:36:12 +0000
commitd729df03ede8e426033e7b41e3529ee6a92c6ab9 (patch)
treead5d4f1db9fa5ae449a71afc254d06dffef40791 /src
parent6bb6ed9467926aa45fd0004df3693d5bc7b72dc0 (diff)
soc/amd/common: Update PSP dependency generation
After adding the ability to add paths into the amdfw.cfg file for the amdfwtool, the dependency generation needs to be updated to not add the firmware location in front of those values. This also allows us to filter out the MP2 binaries as dependencies based on whether or not the Kconfig value is set. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I3a9b9c8246808dc60020a32a7d9d926bc5e57ccd Reviewed-on: https://review.coreboot.org/c/coreboot/+/73657 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/Makefile.inc26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/soc/amd/common/Makefile.inc b/src/soc/amd/common/Makefile.inc
index db9101815d..86fe0514c5 100644
--- a/src/soc/amd/common/Makefile.inc
+++ b/src/soc/amd/common/Makefile.inc
@@ -8,9 +8,31 @@ subdirs-y += vboot
ifneq ($(CONFIG_AMDFW_CONFIG_FILE), )
FIRMWARE_LOCATION=$(shell grep -e FIRMWARE_LOCATION $(CONFIG_AMDFW_CONFIG_FILE) | awk '{print $$2}')
-# Add all the files listed in the config file
+# Add all the files listed in the config file to the dependency list
POUND_SIGN=$(call strip_quotes, "\#")
-DEP_FILES= $(patsubst %,$(FIRMWARE_LOCATION)/%, $(shell sed -e /^$(POUND_SIGN)/d -e /*/d -e /^FIRMWARE_LOCATION/d -e /^SOC_NAME/d $(CONFIG_AMDFW_CONFIG_FILE) | awk '{print $$2}' ))
+REMOVE_MP2 =
+# If the MP2 file is not being loaded, remove it as a dependency
+ifneq ($(CONFIG_PSP_LOAD_MP2_FW),y)
+REMOVE_MP2 = /MP2/d
+endif
+
+# Steps below to generate the dependency list
+# 1a: Delete any line that starts with #, FIRMWARE_LOCATION, or SOC_NAME
+# 1b: Delete any line containing a *
+# 1c: Filter out lines containing MP2 or not, decided above.
+# 1d: Use awk to return only field 2, the filename
+# 2: Gather filenames with no path to add the firmware location later
+# 3: Gather filenames with a path
+# 4a: Add the firmware location to any files without a path to the dependencies
+# 4b: add the lines containing a path to the dependencies
+AMDFW_CFG_FILES = $(shell sed "/^$(POUND_SIGN)\|^FIRMWARE_LOCATION\|^SOC_NAME/d; \
+ /*/d; \
+ $(REMOVE_MP2)" $(CONFIG_AMDFW_CONFIG_FILE) | \
+ awk '{print $$2}')
+AMDFW_CFG_IN_FW_LOC = $(shell echo "$(AMDFW_CFG_FILES)" | tr ' ' '\n' | grep -v "/")
+AMDFW_CFG_WITH_PATH = $(shell echo "$(AMDFW_CFG_FILES)" | tr ' ' '\n' | grep "/")
+DEP_FILES = $(patsubst %,$(FIRMWARE_LOCATION)/%, $(AMDFW_CFG_IN_FW_LOC)) \
+ $(AMDFW_CFG_WITH_PATH)
amd_microcode_bins += $(wildcard ${FIRMWARE_LOCATION}/*UcodePatch_*.bin)