summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-05-16 15:18:45 -0500
committerAaron Durbin <adurbin@chromium.org>2016-05-18 03:19:12 +0200
commit493ec92eb3c379c127754dd2459563c21d9d6ed9 (patch)
treeb6cc3341bdaff7f99db3976e51ad5ec9f8cdefa4
parent15843bdad076149e9d04dcfaa07f4eedda84acfa (diff)
downloadcoreboot-493ec92eb3c379c127754dd2459563c21d9d6ed9.tar.xz
util/cbfstool: allow option to honor FSP modules' linked address
If '-b' isn't passed when adding an FSP file type to CBFS allow the currently linked address to be used. i.e. don't relocate the FSP module and just add it to CBFS. Change-Id: I61fefd962ca9cf8aff7a4ca2bea52341ab41d67b Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/14839 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
-rw-r--r--util/cbfstool/cbfstool.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 0f24af99c9..7b30ce94f7 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -471,6 +471,7 @@ static int cbfstool_convert_fsp(struct buffer *buffer,
{
uint32_t address;
struct buffer fsp;
+ int do_relocation = 1;
address = *offset;
@@ -486,14 +487,13 @@ static int cbfstool_convert_fsp(struct buffer *buffer,
address = -convert_to_from_absolute_top_aligned(
param.image_region, address);
} else {
- if ((param.baseaddress_assigned == 0) ||
- (param.baseaddress == 0)) {
- ERROR("Invalid baseaddress for non-XIP FSP.\n");
- return 1;
+ if (param.baseaddress_assigned == 0) {
+ INFO("Honoring pre-linked FSP module.\n");
+ do_relocation = 0;
+ } else {
+ address = param.baseaddress;
}
- address = param.baseaddress;
-
/*
* *offset should either be 0 or the value returned by
* do_cbfs_locate. do_cbfs_locate should not ever return a value
@@ -508,6 +508,13 @@ static int cbfstool_convert_fsp(struct buffer *buffer,
*offset = 0;
}
+ /*
+ * Nothing left to do if relocation is not being attempted. Just add
+ * the file.
+ */
+ if (!do_relocation)
+ return cbfstool_convert_raw(buffer, offset, header);
+
/* Create a copy of the buffer to attempt relocation. */
if (buffer_create(&fsp, buffer_size(buffer), "fsp"))
return -1;