romfs: allow target level airframe selection (#25677)

This commit is contained in:
Jacob Dahl
2025-10-10 09:29:27 -08:00
committed by GitHub
parent b95784e804
commit 12f6005c5c
2 changed files with 24 additions and 0 deletions

View File

@@ -85,10 +85,32 @@ endif()
if(PX4_ETHERNET)
set(added_arguments ${added_arguments} --ethernet)
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
set(romfs_copy_files_relative)
foreach(romfs_file IN LISTS romfs_copy_files)
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})
endforeach()
# copy the ROMFS files by creating a tar and extracting it to the build

View File

@@ -0,0 +1,2 @@
4001_quad_x
4601_droneblocks_dexi_5