mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
romfs: allow target level airframe selection (#25677)
This commit is contained in:
@@ -85,10 +85,32 @@ endif()
|
|||||||
if(PX4_ETHERNET)
|
if(PX4_ETHERNET)
|
||||||
set(added_arguments ${added_arguments} --ethernet)
|
set(added_arguments ${added_arguments} --ethernet)
|
||||||
endif()
|
endif()
|
||||||
|
# Check if board has an rc.board_airframes file to filter airframes
|
||||||
|
set(board_airframes_file "${PX4_BOARD_DIR}/init/rc.board_airframes")
|
||||||
|
set(airframes_whitelist "")
|
||||||
|
if(EXISTS "${board_airframes_file}")
|
||||||
|
message(STATUS "ROMFS: Using board-specific airframes list: ${board_airframes_file}")
|
||||||
|
file(STRINGS "${board_airframes_file}" airframes_whitelist)
|
||||||
|
# Remove comments and empty lines
|
||||||
|
list(FILTER airframes_whitelist EXCLUDE REGEX "^[ \t]*#")
|
||||||
|
list(FILTER airframes_whitelist EXCLUDE REGEX "^[ \t]*$")
|
||||||
|
endif()
|
||||||
|
|
||||||
# create list of relative romfs file names
|
# create list of relative romfs file names
|
||||||
set(romfs_copy_files_relative)
|
set(romfs_copy_files_relative)
|
||||||
foreach(romfs_file IN LISTS romfs_copy_files)
|
foreach(romfs_file IN LISTS romfs_copy_files)
|
||||||
string(REPLACE "${romfs_src_dir}/" "" romfs_file_rel ${romfs_file})
|
string(REPLACE "${romfs_src_dir}/" "" romfs_file_rel ${romfs_file})
|
||||||
|
|
||||||
|
# If we have an airframes whitelist, filter airframe files
|
||||||
|
if(airframes_whitelist AND romfs_file_rel MATCHES "^init.d/airframes/")
|
||||||
|
# Extract just the filename
|
||||||
|
get_filename_component(airframe_name "${romfs_file_rel}" NAME)
|
||||||
|
# Check if it's in the whitelist
|
||||||
|
if(NOT "${airframe_name}" IN_LIST airframes_whitelist)
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND romfs_copy_files_relative ${romfs_file_rel})
|
list(APPEND romfs_copy_files_relative ${romfs_file_rel})
|
||||||
endforeach()
|
endforeach()
|
||||||
# copy the ROMFS files by creating a tar and extracting it to the build
|
# copy the ROMFS files by creating a tar and extracting it to the build
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
4001_quad_x
|
||||||
|
4601_droneblocks_dexi_5
|
||||||
Reference in New Issue
Block a user