Skip to content

Commit

Permalink
Add signing of px4 binary into makefiles
Browse files Browse the repository at this point in the history
When an environment variable "SIGNING_TOOL" is defined, the make will
call this with two filename arguments: <input> and <output>.

The SIGNING_TOOL will read in the binary from input, and append
signature to the output. For example:

SIGNING_TOOL=${PWD}/Tools/cryptotools.py make px4_fmu-v5_default

Will use the example "cryptotools.py" to sign the px4_fmu-v5.bin

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Jan 26, 2021
1 parent 6204d22 commit d112262
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions platforms/nuttx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,20 @@ if (config_romfs_root)
target_link_libraries(px4 PRIVATE romfs)
endif()

add_custom_command(OUTPUT ${PX4_BINARY_DIR_REL}/${PX4_BOARD}.bin
COMMAND ${CMAKE_OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${PX4_BINARY_DIR_REL}/${PX4_BOARD}.bin
if((DEFINED ENV{SIGNING_TOOL}) AND (NOT NUTTX_DIR MATCHES "external"))
set(PX4_BINARY_OUTPUT ${PX4_BINARY_DIR}/${PX4_BOARD}_unsigned.bin)

add_custom_command(OUTPUT ${PX4_BINARY_DIR_REL}/${PX4_BOARD}.bin
COMMAND $ENV{SIGNING_TOOL} $ENV{SIGNING_ARGS} ${PX4_BINARY_OUTPUT} ${PX4_BINARY_DIR}/${PX4_BOARD}.bin
DEPENDS ${PX4_BINARY_OUTPUT}
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
else()
set(PX4_BINARY_OUTPUT ${PX4_BINARY_DIR_REL}/${PX4_BOARD}.bin)
endif()

add_custom_command(OUTPUT ${PX4_BINARY_OUTPUT}
COMMAND ${CMAKE_OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${PX4_BINARY_OUTPUT}
DEPENDS px4
)

Expand Down

0 comments on commit d112262

Please sign in to comment.