forked from Archive/PX4-Autopilot
cmake px4_add_board: add EMBEDDED_METADATA
Allowing to put additional metadata into the ROMFS, the first is parameters.json.gz.
This commit is contained in:
parent
d5b8f6cdf9
commit
0a061160f7
|
@ -137,15 +137,6 @@ add_custom_command(
|
|||
# copy extras into ROMFS
|
||||
set(extras_dependencies)
|
||||
|
||||
if(config_bl_file)
|
||||
file(MAKE_DIRECTORY ${PX4_BINARY_DIR}/romfs_extras)
|
||||
configure_file(${config_bl_file} ${PX4_BINARY_DIR}/romfs_extras COPYONLY)
|
||||
|
||||
list(APPEND extras_dependencies
|
||||
${config_bl_file}
|
||||
)
|
||||
endif()
|
||||
|
||||
# copy px4io binary if configured
|
||||
if(config_io_board)
|
||||
list(APPEND extras_dependencies
|
||||
|
@ -193,13 +184,24 @@ foreach(board_rc_file ${OPTIONAL_BOARD_RC})
|
|||
|
||||
endforeach()
|
||||
|
||||
list(APPEND extras_dependencies
|
||||
${config_romfs_extra_dependencies}
|
||||
)
|
||||
|
||||
if (config_romfs_extra_files)
|
||||
set(extras_copy_cmd COMMAND ${CMAKE_COMMAND} -E copy_if_different ${config_romfs_extra_files} ${romfs_gen_root_dir}/extras/)
|
||||
else()
|
||||
set(extras_copy_cmd "")
|
||||
endif()
|
||||
add_custom_command(OUTPUT romfs_extras.stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${romfs_gen_root_dir}/extras/
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/romfs_extras/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PX4_BINARY_DIR}/romfs_extras/ ${romfs_gen_root_dir}/extras/
|
||||
${extras_copy_cmd}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch romfs_extras.stamp
|
||||
DEPENDS
|
||||
romfs_copy.stamp
|
||||
${config_romfs_extra_files}
|
||||
${extras_dependencies}
|
||||
COMMENT "ROMFS: copying extras"
|
||||
)
|
||||
|
|
|
@ -83,6 +83,7 @@ def main():
|
|||
|
||||
# only prune text files
|
||||
if ".zip" in file or ".bin" in file or ".swp" in file \
|
||||
or ".gz" in file or ".bz2" in file \
|
||||
or ".data" in file or ".DS_Store" in file:
|
||||
continue
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
# [ CONSTRAINED_FLASH ]
|
||||
# [ TESTING ]
|
||||
# [ LINKER_PREFIX <string> ]
|
||||
# [ EMBEDDED_METADATA <string> ]
|
||||
# )
|
||||
#
|
||||
# Input:
|
||||
|
@ -77,6 +78,7 @@
|
|||
# SYSTEMCMDS : list of system commands to build for this board (relative to src/systemcmds)
|
||||
# EXAMPLES : list of example modules to build for this board (relative to src/examples)
|
||||
# SERIAL_PORTS : mapping of user configurable serial ports and param facing name
|
||||
# EMBEDDED_METADATA : list of metadata to embed to ROMFS
|
||||
# CONSTRAINED_FLASH : flag to enable constrained flash options (eg limit init script status text)
|
||||
# TESTING : flag to enable automatic inclusion of PX4 testing modules
|
||||
# LINKER_PREFIX : optional to prefix on the Linker script.
|
||||
|
@ -150,6 +152,7 @@ function(px4_add_board)
|
|||
SYSTEMCMDS
|
||||
EXAMPLES
|
||||
SERIAL_PORTS
|
||||
EMBEDDED_METADATA
|
||||
OPTIONS
|
||||
BUILD_BOOTLOADER
|
||||
CONSTRAINED_FLASH
|
||||
|
@ -196,9 +199,21 @@ function(px4_add_board)
|
|||
set(CMAKE_TOOLCHAIN_FILE Toolchain-${TOOLCHAIN} CACHE INTERNAL "toolchain file" FORCE)
|
||||
endif()
|
||||
|
||||
set(romfs_extra_files)
|
||||
set(config_romfs_extra_dependencies)
|
||||
if(BOOTLOADER)
|
||||
set(config_bl_file ${BOOTLOADER} CACHE INTERNAL "bootloader" FORCE)
|
||||
list(APPEND romfs_extra_files ${BOOTLOADER})
|
||||
endif()
|
||||
foreach(metadata ${EMBEDDED_METADATA})
|
||||
if(${metadata} STREQUAL "parameters")
|
||||
list(APPEND romfs_extra_files ${PX4_BINARY_DIR}/parameters.json.gz)
|
||||
list(APPEND romfs_extra_dependencies parameters_xml)
|
||||
else()
|
||||
message(FATAL_ERROR "invalid value for EMBEDDED_METADATA: ${metadata}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(config_romfs_extra_files ${romfs_extra_files} CACHE INTERNAL "extra ROMFS files" FORCE)
|
||||
set(config_romfs_extra_dependencies ${romfs_extra_dependencies} CACHE INTERNAL "extra ROMFS deps" FORCE)
|
||||
|
||||
if(SERIAL_PORTS)
|
||||
set(board_serial_ports ${SERIAL_PORTS} PARENT_SCOPE)
|
||||
|
|
Loading…
Reference in New Issue