From d89eeb6ec8cef355cd5c493c43b71c8dab1930f2 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Tue, 30 May 2017 14:39:01 -0700 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/517678 Commit-Ready: Vadim Bendebury Tested-by: Vadim Bendebury Reviewed-by: Marius Schilder Reviewed-by: Mary Ruthven --- Makefile.rules | 2 +- util/signer/codesigner.cc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index e1606496c7..8765a05776 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -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 $< $@ diff --git a/util/signer/codesigner.cc b/util/signer/codesigner.cc index a2a840509b..f489851ee0 100644 --- a/util/signer/codesigner.cc +++ b/util/signer/codesigner.cc @@ -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;