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@chromium.org>
Reviewed-on: http://review.coreboot.org/11671
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Aaron Durbin 2015-09-15 21:30:58 -05:00
parent 294ce85424
commit 9b9d4b3a47
2 changed files with 5 additions and 35 deletions

View File

@ -562,8 +562,7 @@ cbfs-add-cmd = \
ifneq ($(CONFIG_UPDATE_IMAGE),y) ifneq ($(CONFIG_UPDATE_IMAGE),y)
prebuild-files = \ prebuild-files = \
$(foreach file,$(cbfs-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 \ $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&, \
$(cbfs-add-cmd) -b {} &&,\
$(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(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))) prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
@ -580,8 +579,7 @@ prebuild-files = \
$(foreach file,$(cbfs-files), \ $(foreach file,$(cbfs-files), \
$(if $(filter $(call strip_quotes, $(CONFIG_CBFS_PREFIX))/%,\ $(if $(filter $(call strip_quotes, $(CONFIG_CBFS_PREFIX))/%,\
$(call extract_nth,2,$(file))), \ $(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 \ $(if $(call extract_nth,6,$(file)),$(cbfs-add-cmd) -a $(call extract_nth,6,$(file)) &&,\
$(cbfs-add-cmd) -b {} &&,\
$(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&))) $(cbfs-add-cmd) $(if $(call extract_nth,5,$(file)),-b $(call extract_nth,5,$(file))) &&)))
.PHONY: $(obj)/coreboot.pre1 .PHONY: $(obj)/coreboot.pre1

View File

@ -70,7 +70,6 @@ static struct param {
uint32_t cbfsoffset; uint32_t cbfsoffset;
uint32_t cbfsoffset_assigned; uint32_t cbfsoffset_assigned;
uint32_t arch; uint32_t arch;
bool top_aligned;
bool fill_partial_upward; bool fill_partial_upward;
bool fill_partial_downward; bool fill_partial_downward;
bool show_immutable; bool show_immutable;
@ -155,10 +154,6 @@ static int do_cbfs_locate(int32_t *cbfs_addr, size_t metadata_size)
return 1; return 1;
} }
if (param.top_aligned)
address = -convert_to_from_top_aligned(param.image_region,
address);
*cbfs_addr = address; *cbfs_addr = address;
return 0; return 0;
} }
@ -394,16 +389,6 @@ static int cbfstool_convert_mkflatpayload(struct buffer *buffer,
return 0; 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) static int cbfs_add(void)
{ {
int32_t address; int32_t address;
@ -414,7 +399,9 @@ static int cbfs_add(void)
} }
if (param.alignment) { 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; return 1;
param.baseaddress = address; param.baseaddress = address;
} }
@ -593,17 +580,6 @@ static int cbfs_create(void)
return ret; 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) static int cbfs_layout(void)
{ {
const struct fmap *fmap = partitioned_file_get_fmap(param.image_file); 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}, {"copy", "H:D:s:h?", cbfs_copy, true, true},
{"create", "M:r:s:B:b:H:o:m:vh?", cbfs_create, 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}, {"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}, {"layout", "wvh?", cbfs_layout, false, false},
{"print", "H:r:vh?", cbfs_print, true, false}, {"print", "H:r:vh?", cbfs_print, true, false},
{"read", "r:f:vh?", cbfs_read, true, false}, {"read", "r:f:vh?", cbfs_read, true, false},
@ -1153,9 +1128,6 @@ int main(int argc, char **argv)
case 'i': case 'i':
param.u64val = strtoull(optarg, NULL, 0); param.u64val = strtoull(optarg, NULL, 0);
break; break;
case 'T':
param.top_aligned = true;
break;
case 'u': case 'u':
param.fill_partial_upward = true; param.fill_partial_upward = true;
break; break;