summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfstool.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r--util/cbfstool/cbfstool.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 66db379d02..a09e75b1f1 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 2009 coresystems GmbH
* written by Patrick Georgi <patrick.georgi@coresystems.de>
+ * Copyright (C) 2012 Google, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -372,6 +373,11 @@ static int cbfs_create(void)
return 1;
}
+ if (arch == CBFS_ARCHITECTURE_UNKNOWN) {
+ fprintf(stderr, "E: You need to specify -m/--machine arch\n");
+ return 1;
+ }
+
return create_cbfs_image(cbfs_name, rom_size, rom_bootblock,
rom_alignment, rom_offset);
}
@@ -450,7 +456,7 @@ static const struct command commands[] = {
{"add-stage", "f:n:t:c:b:h?", cbfs_add_stage},
{"add-flat-binary", "f:n:l:e:c:b:h?", cbfs_add_flat_binary},
{"remove", "n:h?", cbfs_remove},
- {"create", "s:B:a:o:h?", cbfs_create},
+ {"create", "s:B:a:o:m:h?", cbfs_create},
{"locate", "f:n:a:h?", cbfs_locate},
{"print", "h?", cbfs_print},
{"extract", "n:f:h?", cbfs_extract},
@@ -468,6 +474,7 @@ static struct option long_options[] = {
{"alignment", required_argument, 0, 'a' },
{"offset", required_argument, 0, 'o' },
{"file", required_argument, 0, 'f' },
+ {"arch", required_argument, 0, 'm' },
{"verbose", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
{NULL, 0, 0, 0 }
@@ -481,26 +488,28 @@ static void usage(char *name)
" %s FILE COMMAND [PARAMETERS]...\n\n" "OPTIONs:\n"
" -h Display this help message\n\n"
"COMMANDs:\n"
- " add -f FILE -n NAME -t TYPE [-b base-address] "
+ " add -f FILE -n NAME -t TYPE [-b base-address] "
"Add a component\n"
- " add-payload -f FILE -n NAME [-c compression] [-b base] "
+ " add-payload -f FILE -n NAME [-c compression] [-b base] "
"Add a payload to the ROM\n"
- " add-stage -f FILE -n NAME [-c compression] [-b base] "
+ " add-stage -f FILE -n NAME [-c compression] [-b base] "
"Add a stage to the ROM\n"
" add-flat-binary -f FILE -n NAME -l load-address \\\n"
- " -e entry-point [-c compression] [-b base] "
+ " -e entry-point [-c compression] [-b base] "
"Add a 32bit flat mode binary\n"
- " remove -n NAME "
+ " remove -n NAME "
"Remove a component\n"
- " create -s size -B bootblock [-a align] [-o offset] "
+ " create -s size -B bootblock -m ARCH [-a align] [-o offset] "
"Create a ROM file\n"
- " locate -f FILE -n NAME -a align "
+ " locate -f FILE -n NAME -a align "
"Find a place for a file of that size\n"
- " print "
+ " print "
"Show the contents of the ROM\n"
- " extract -n NAME -f FILE "
+ " extract -n NAME -f FILE "
"Extracts a raw payload from ROM\n"
"\n"
+ "ARCHes:\n"
+ " armv7, x86\n"
"TYPEs:\n", name, name
);
print_supported_filetypes();
@@ -610,6 +619,9 @@ int main(int argc, char **argv)
case 'v':
verbose++;
break;
+ case 'm':
+ arch = string_to_arch(optarg);
+ break;
case 'h':
case '?':
usage(argv[0]);