codesigner: accept the new command line option

The upcoming "real" signer update will introduce a version which is
not backwards compatible with the existing one wrt the command line
flags: the command line flag '-b' will have to be present.

To keep the default "dummy" signer in sync let's make it accept and
ignore the '-b' command line flag.

BRANCH=none
BUG=none
TEST=verified that the updated signer and the dummy signer both work.

Change-Id: Ia8ab6d7ae01d249046f267608b5971a7a7c95e29
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/517678
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
This commit is contained in:
Vadim Bendebury
2017-05-30 14:39:01 -07:00
committed by chrome-bot
parent 9f4ba5940a
commit d89eeb6ec8
2 changed files with 6 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ cmd_flat_to_obj = $(CC) -T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \
cmd_ec_elf_to_flat ?= $(OBJCOPY) --set-section-flags .roshared=share \
-O binary $< $@
cmd_elf_to_signed ?= sudo $(SIGNER) --key=util/signer/$(3) \
--input=$< --format=bin --output=$@.signed $(SIGNER_EXTRAS) \
--b --input=$< --format=bin --output=$@.signed $(SIGNER_EXTRAS) \
&& sudo chown $(shell whoami) $@.signed && mv $@.signed $@
cmd_elf_to_dis = $(OBJDUMP) -D $< > $@
cmd_elf_to_hex = $(OBJCOPY) -O ihex $< $@

View File

@@ -297,6 +297,7 @@ void usage(int argc, char* argv[]) {
"--input=$elf-filename\n"
"--output=output-filename\n"
"--key=$pem-filename\n"
"[--b] ignored option, could be included for forward compatibility\n"
"[--cros] to sign for the ChromeOS realm w/o manifest\n"
"[--xml=$xml-filename] typically 'havenTop.xml'\n"
"[--json=$json-filename] the signing manifest\n"
@@ -313,6 +314,7 @@ void usage(int argc, char* argv[]) {
int getOptions(int argc, char* argv[]) {
static struct option long_options[] = {
// name, has_arg
{"b", no_argument, NULL, 'b'},
{"cros", no_argument, NULL, 'c'},
{"format", required_argument, NULL, 'f'},
{"help", no_argument, NULL, 'h'},
@@ -330,7 +332,7 @@ int getOptions(int argc, char* argv[]) {
{0, 0, 0, 0}};
int c, option_index = 0;
outputFormat.assign("hex");
while ((c = getopt_long(argc, argv, "i:o:p:k:x:j:f:s:H:chvr", long_options,
while ((c = getopt_long(argc, argv, "i:o:p:k:x:j:f:s:H:bchvr", long_options,
&option_index)) != -1) {
switch (c) {
case 0:
@@ -338,6 +340,8 @@ int getOptions(int argc, char* argv[]) {
if (optarg) fprintf(stderr, " with arg %s", optarg);
fprintf(stderr, "\n");
break;
case 'b':
break;
case 'c':
FLAGS_cros = true;
break;