diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c5610066..e9fbddef56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,11 @@ endforeach() # other modules enable_testing() +#============================================================================= +# programs +# +find_package(PythonInterp REQUIRED) + #============================================================================= # parameters # diff --git a/cmake/px4_impl_nuttx.cmake b/cmake/px4_impl_nuttx.cmake index ec7019a231..d9a450b15f 100644 --- a/cmake/px4_impl_nuttx.cmake +++ b/cmake/px4_impl_nuttx.cmake @@ -324,14 +324,30 @@ function(px4_nuttx_generate_romfs) set(romfs_temp_dir ${CMAKE_BINARY_DIR}/${ROOT}) set(romfs_src_dir ${CMAKE_SOURCE_DIR}/${ROOT}) + set(romfs_autostart ${CMAKE_SOURCE_DIR}/Tools/px_process_airframes.py) + set(romfs_pruner ${CMAKE_SOURCE_DIR}/Tools/px_romfs_pruner.py) + + + #message(STATUS "temp_dir: ${romfs_temp_dir}") + #message(STATUS "src_dir: ${romfs_src_dir}") + + add_custom_command(OUTPUT rc.autostart + COMMAND ${PYTHON_EXECUTABLE} ${romfs_autostart} + -a ${ROMFS_ROOT}/init.d + -s rc.autostart + ) + add_custom_command(OUTPUT romfs.bin COMMAND cmake -E remove_directory ${romfs_temp_dir} COMMAND cmake -E copy_directory ${romfs_src_dir} ${romfs_temp_dir} + COMMAND cmake -E copy rc.autostart ${romfs_temp_dir}/init.d #TODO add romfs cleanup and pruning + COMMAND ${PYTHON_EXECUTABLE} ${romfs_pruner} + --folder ${romfs_temp_dir} COMMAND ${GENROMFS} -f ${CMAKE_CURRENT_BINARY_DIR}/romfs.bin -d ${romfs_temp_dir} -V "NSHInitVol" - DEPENDS ${romfs_files} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${romfs_files} rc.autostart + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) px4_bin_to_obj(OBJ ${OUT} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 55be37483d..25af787ed2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,7 @@ if (${OS} STREQUAL "nuttx") MODULE_LIST ${module_list}) px4_nuttx_generate_romfs(OUT romfs.o - ROOT ${CMAKE_SOURCE_DIR}/ROMFS/px4fmu_common) + ROOT ROMFS/px4fmu_common) # add executable add_executable(main builtin_commands.c romfs.o)