scripts: west sign: move hex and bin default locations
When signing binaries from multiple build directories, it is
inconvenient to have to specify the output file locations by hand each
time. It's also a little weird that they're not next to zephyr.bin and
zephyr.hex.
Move them to the build directory, next to their unsigned variants.
Suggested by Piotr Mienkowski.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
diff --git a/scripts/west_commands/sign.py b/scripts/west_commands/sign.py
index a3e621a..b022e9a 100644
--- a/scripts/west_commands/sign.py
+++ b/scripts/west_commands/sign.py
@@ -102,9 +102,9 @@
help='''produce a signed .bin file?
(default: yes, if supported)''')
group.add_argument('-B', '--sbin', metavar='BIN',
- default='zephyr.signed.bin',
help='''signed .bin file name
- (default: zephyr.signed.bin)''')
+ (default: zephyr.signed.bin in the build
+ directory, next to zephyr.bin)''')
# hex file options
group = parser.add_argument_group('Intel HEX (.hex) file options')
@@ -113,9 +113,9 @@
help='''produce a signed .hex file?
(default: yes, if supported)''')
group.add_argument('-H', '--shex', metavar='HEX',
- default='zephyr.signed.hex',
help='''signed .hex file name
- (default: zephyr.signed.hex)''')
+ (default: zephyr.signed.hex in the build
+ directory, next to zephyr.hex)''')
# defaults for hex/bin generation
parser.set_defaults(gen_bin=True, gen_hex=True)
@@ -171,15 +171,19 @@
# Build a signed .bin
if args.gen_bin and runner_config.bin_file:
+ sbin = args.sbin or os.path.join(build_dir, 'zephyr',
+ 'zephyr.signed.bin')
sign_bin = self.sign_cmd(command, bcfg, runner_config.bin_file,
- args.sbin)
+ sbin)
log.dbg(quote_sh_list(sign_bin))
subprocess.check_call(sign_bin)
# Build a signed .hex
if args.gen_hex and runner_config.hex_file:
+ shex = args.shex or os.path.join(build_dir, 'zephyr',
+ 'zephyr.signed.hex')
sign_hex = self.sign_cmd(command, bcfg, runner_config.hex_file,
- args.shex)
+ shex)
log.dbg(quote_sh_list(sign_hex))
subprocess.check_call(sign_hex)