zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.04k stars 6.18k forks source link

west: rimage support in `west sign` poorly documented #26596

Closed tejlmand closed 3 years ago

tejlmand commented 4 years ago

Describe the bug With: https://github.com/zephyrproject-rtos/zephyr/commit/d44d986a0326f775a3a4b29bfd209ac58dc62e8a from PR #21241 support for rimage as signing tool were added to west sign.

However, the help text to west sign still describes only imgtool, and was not updated to describe support for rimage.

$ west help sign
...

tool control options:
  -t {imgtool,rimage}, --tool {imgtool,rimage}
                        image signing tool name; imgtool and rimage are
                        currently supported
  -p TOOL_PATH, --tool-path TOOL_PATH
                        path to the tool itself, if needed
  tool_opt              extra option(s) to pass to the signing tool

binary (.bin) file options:
  --bin, --no-bin       produce a signed .bin file? (default: yes, if
                        supported and unsigned bin exists)
  -B BIN, --sbin BIN    signed .bin file name (default: zephyr.signed.bin in
                        the build directory, next to zephyr.bin)

Intel HEX (.hex) file options:
  --hex, --no-hex       produce a signed .hex file? (default: yes, if
                        supported and unsigned hex exists)
  -H HEX, --shex HEX    signed .hex file name (default: zephyr.signed.hex in
                        the build directory, next to zephyr.hex)

imgtool
-------

Currently, MCUboot's 'imgtool' tool is supported. To build a signed
binary you can load with MCUboot using imgtool, run this from your
build directory:

   west sign -t imgtool -- --key YOUR_SIGNING_KEY.pem

For this to work, either imgtool must be installed (e.g. using pip3),
or you must pass the path to imgtool.py using the -p option.

To Reproduce

$ west help sign

Expected behavior Description of rimage similar to imgtool, imgtool is described as:

imgtool
-------

Currently, MCUboot's 'imgtool' tool is supported. To build a signed
binary you can load with MCUboot using imgtool, run this from your
build directory:

   west sign -t imgtool -- --key YOUR_SIGNING_KEY.pem

For this to work, either imgtool must be installed (e.g. using pip3),
or you must pass the path to imgtool.py using the -p option.

as well as updates to:

  -B BIN, --sbin BIN    signed .bin file name (default: zephyr.signed.bin in
                        the build directory, next to zephyr.bin)

  -H HEX, --shex HEX    signed .hex file name (default: zephyr.signed.hex in
                        the build directory, next to zephyr.hex)

to reflect that rimage produces files with different default names.

Impact Bad user experience, as user must look into the source code to understand the behavior of west sign.

tejlmand commented 4 years ago

Also noticed this in the code: https://github.com/zephyrproject-rtos/zephyr/blob/b244dccad693e998cb10c43f8fc820ea48be3370/scripts/west_commands/sign.py#L378-L379

Such limitation should also be part of the help text.