[coreboot-gerrit] Patch set updated for coreboot: cbfstool: remove locate command

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Wed Sep 16 13:32:52 CET 2015


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11671

-gerrit

commit a91165cc1f35328113ed718a89896ab95ab4572a
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Tue Sep 15 21:30:58 2015 -0500

    cbfstool: remove locate command
    
    The locate command was previously being used for x86 romstage
    linking as well as alignment handling of files. The add command
    already supports alignment so there's no more users of the
    locate command. Remove the command as well as the '-T' (top-aligned)
    option.
    
    BUG=chrome-os-partner:44827
    BRANCH=None
    TEST=Built rambi. Noted microcode being directly added.
    
    Change-Id: I3b6647bd4cac04a113ab3592f345281fbcd681af
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 Makefile.inc             |  6 ++----
 util/cbfstool/cbfstool.c | 34 +++-------------------------------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index c0bedda..46d6eb2 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -562,8 +562,7 @@ cbfs-add-cmd = \
 ifneq ($(CONFIG_UPDATE_IMAGE),y)
 prebuild-files = \
 	       $(foreach file,$(cbfs-files), \
-	       $(if $(call extract_nth,6,$(file)),$(CBFSTOOL) $@.tmp locate -f $(call extract_nth,1,$(file)) -n $(call extract_nth,2,$(file)) -a $(call extract_nth,6,$(file))|xargs -i \
-	       $(cbfs-add-cmd) -b {} &&,\
+	       $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&, \
 	       $(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&))
 prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
 
@@ -580,8 +579,7 @@ prebuild-files = \
 	$(foreach file,$(cbfs-files), \
 	       $(if $(filter $(call strip_quotes, $(CONFIG_CBFS_PREFIX))/%,\
 	           $(call extract_nth,2,$(file))), \
-	       $(if $(call extract_nth,6,$(file)),$(CBFSTOOL) $@.tmp locate -f $(call extract_nth,1,$(file)) -n $(call extract_nth,2,$(file)) -a $(call extract_nth,6,$(file))|xargs -i \
-	       $(cbfs-add-cmd) -b {} &&,\
+	       $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&,\
 	       $(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&)))
 
 .PHONY: $(obj)/coreboot.pre1
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 6f8f1f4..c45f316 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -70,7 +70,6 @@ static struct param {
 	uint32_t cbfsoffset;
 	uint32_t cbfsoffset_assigned;
 	uint32_t arch;
-	bool top_aligned;
 	bool fill_partial_upward;
 	bool fill_partial_downward;
 	bool show_immutable;
@@ -155,10 +154,6 @@ static int do_cbfs_locate(int32_t *cbfs_addr, size_t metadata_size)
 		return 1;
 	}
 
-	if (param.top_aligned)
-		address = -convert_to_from_top_aligned(param.image_region,
-								address);
-
 	*cbfs_addr = address;
 	return 0;
 }
@@ -394,16 +389,6 @@ static int cbfstool_convert_mkflatpayload(struct buffer *buffer,
 	return 0;
 }
 
-static size_t cbfs_default_metadata_size(void)
-{
-	/* TODO Old cbfstool always assume input is a stage file (and adding
-	 * sizeof(cbfs_stage) for header. We should fix that by adding "-t"
-	 * (type) param in future. For right now, we assume cbfs_stage is the
-	 * largest structure and add it into header size. */
-	assert(sizeof(struct cbfs_stage) >= sizeof(struct cbfs_payload));
-	return sizeof(struct cbfs_stage);
-}
-
 static int cbfs_add(void)
 {
 	int32_t address;
@@ -414,7 +399,9 @@ static int cbfs_add(void)
 	}
 
 	if (param.alignment) {
-		if (do_cbfs_locate(&address, cbfs_default_metadata_size()))
+		/* CBFS compression file attribute is unconditionally added. */
+		size_t metadata_sz = sizeof(struct cbfs_file_attr_compression);
+		if (do_cbfs_locate(&address, metadata_sz))
 			return 1;
 		param.baseaddress = address;
 	}
@@ -593,17 +580,6 @@ static int cbfs_create(void)
 	return ret;
 }
 
-static int cbfs_locate(void)
-{
-	int32_t address;
-
-	if (do_cbfs_locate(&address, cbfs_default_metadata_size()) != 0)
-		return 1;
-
-	printf("0x%x\n", address);
-	return 0;
-}
-
 static int cbfs_layout(void)
 {
 	const struct fmap *fmap = partitioned_file_get_fmap(param.image_file);
@@ -858,7 +834,6 @@ static const struct command commands[] = {
 	{"copy", "H:D:s:h?", cbfs_copy, true, true},
 	{"create", "M:r:s:B:b:H:o:m:vh?", cbfs_create, true, true},
 	{"extract", "H:r:n:f:vh?", cbfs_extract, true, false},
-	{"locate", "H:r:f:n:P:a:Tvh?", cbfs_locate, true, false},
 	{"layout", "wvh?", cbfs_layout, false, false},
 	{"print", "H:r:vh?", cbfs_print, true, false},
 	{"read", "r:f:vh?", cbfs_read, true, false},
@@ -1153,9 +1128,6 @@ int main(int argc, char **argv)
 			case 'i':
 				param.u64val = strtoull(optarg, NULL, 0);
 				break;
-			case 'T':
-				param.top_aligned = true;
-				break;
 			case 'u':
 				param.fill_partial_upward = true;
 				break;



More information about the coreboot-gerrit mailing list