diff --git a/ROMFS/CMakeLists.txt b/ROMFS/CMakeLists.txt index e1b08d078b..9b282339fd 100644 --- a/ROMFS/CMakeLists.txt +++ b/ROMFS/CMakeLists.txt @@ -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 diff --git a/boards/ark/pi6x/init/rc.board_airframes b/boards/ark/pi6x/init/rc.board_airframes new file mode 100644 index 0000000000..4468c66ee4 --- /dev/null +++ b/boards/ark/pi6x/init/rc.board_airframes @@ -0,0 +1,2 @@ +4001_quad_x +4601_droneblocks_dexi_5