summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2023-03-08 14:58:51 -0700
committerMartin L Roth <gaumless@gmail.com>2023-03-15 19:35:54 +0000
commit6bb6ed9467926aa45fd0004df3693d5bc7b72dc0 (patch)
tree1217afccd43ace84b4762a90df0abecbeb4240ee
parenta18b8b44d746894d04fd3c2b84304d860840a472 (diff)
util/amdfwtool: Update config parser to accept full paths
This allows individual components to be placed in a location other than what is specified by the FIRMWARE_LOCATION line. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I3a83e52d081a5909d54eacc575dd2b40b09e4038 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73656 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jason Glenesk <jason.glenesk@gmail.com>
-rw-r--r--util/amdfwtool/data_parse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/amdfwtool/data_parse.c b/util/amdfwtool/data_parse.c
index aa4732f2e5..50f844fa67 100644
--- a/util/amdfwtool/data_parse.c
+++ b/util/amdfwtool/data_parse.c
@@ -655,8 +655,12 @@ static uint8_t process_one_line(char *oneline, regmatch_t *match, char *dir,
ch_lvl = get_level_from_config(oneline, ch_lvl_index, cb_config);
path_filename = malloc(MAX_LINE_SIZE * 2 + 2);
- snprintf(path_filename, MAX_LINE_SIZE * 2 + 2, "%.*s/%.*s",
- MAX_LINE_SIZE, dir, MAX_LINE_SIZE, fn);
+ if (strchr(fn, '/'))
+ snprintf(path_filename, MAX_LINE_SIZE * 2 + 2, "%.*s",
+ MAX_LINE_SIZE, fn);
+ else
+ snprintf(path_filename, MAX_LINE_SIZE * 2 + 2, "%.*s/%.*s",
+ MAX_LINE_SIZE, dir, MAX_LINE_SIZE, fn);
if (find_register_fw_filename_psp_dir(
fw_type_str, path_filename, ch_lvl, cb_config) == 0) {