mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
cmake improve ROMFS dependencies for px4io inclusion (#8860)
- fixes #8858
This commit is contained in:
@@ -28,19 +28,29 @@ list(APPEND romfs_dependencies
|
|||||||
${romfs_temp_dir}/init.d/rc.autostart
|
${romfs_temp_dir}/init.d/rc.autostart
|
||||||
)
|
)
|
||||||
|
|
||||||
# create romfs.bin
|
# copy px4io binary if configured
|
||||||
|
if (config_io_board)
|
||||||
|
list(APPEND romfs_dependencies
|
||||||
|
copy_px4io_bin
|
||||||
|
${fw_io_bin}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# create romfs.img
|
||||||
add_custom_command(OUTPUT romfs.img
|
add_custom_command(OUTPUT romfs.img
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove -f romfs.img romfs.txt
|
||||||
COMMAND ${GENROMFS} -f romfs.img -d ${romfs_temp_dir} -V "NSHInitVol" -v > romfs.txt 2>&1
|
COMMAND ${GENROMFS} -f romfs.img -d ${romfs_temp_dir} -V "NSHInitVol" -v > romfs.txt 2>&1
|
||||||
DEPENDS ${romfs_dependencies}
|
DEPENDS ${romfs_dependencies}
|
||||||
)
|
)
|
||||||
|
|
||||||
# create romfs.o
|
# create nsh_romfsimg.c
|
||||||
add_custom_command(OUTPUT nsh_romfsimg.c
|
add_custom_command(OUTPUT nsh_romfsimg.c
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E remove -f nsh_romfsimg.c
|
||||||
COMMAND xxd -i romfs.img nsh_romfsimg.c
|
COMMAND xxd -i romfs.img nsh_romfsimg.c
|
||||||
COMMAND sed 's/unsigned/const unsigned/g' nsh_romfsimg.c > nsh_romfsimg.c.tmp && mv nsh_romfsimg.c.tmp nsh_romfsimg.c
|
COMMAND sed 's/unsigned/const unsigned/g' nsh_romfsimg.c > nsh_romfsimg.c.tmp && mv nsh_romfsimg.c.tmp nsh_romfsimg.c
|
||||||
DEPENDS romfs.img
|
DEPENDS romfs.img
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(romfs STATIC nsh_romfsimg.c)
|
add_library(romfs STATIC nsh_romfsimg.c)
|
||||||
add_dependencies(romfs platforms__common)
|
add_dependencies(romfs prebuild_targets)
|
||||||
set_target_properties(romfs PROPERTIES LINKER_LANGUAGE C)
|
set_target_properties(romfs PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
|||||||
@@ -94,9 +94,6 @@ target_link_libraries(${FW_NAME}
|
|||||||
if (config_romfs_root)
|
if (config_romfs_root)
|
||||||
add_subdirectory(${PX4_SOURCE_DIR}/ROMFS ${PX4_BINARY_DIR}/ROMFS)
|
add_subdirectory(${PX4_SOURCE_DIR}/ROMFS ${PX4_BINARY_DIR}/ROMFS)
|
||||||
target_link_libraries(${FW_NAME} romfs)
|
target_link_libraries(${FW_NAME} romfs)
|
||||||
if (config_io_board)
|
|
||||||
add_dependencies(romfs copy_px4io_bin)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create px4 file (combined firmware and metadata)
|
# create px4 file (combined firmware and metadata)
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ add_custom_command(OUTPUT ${fw_io_exe}
|
|||||||
|
|
||||||
file(RELATIVE_PATH fw_io_exe_relative ${CMAKE_CURRENT_BINARY_DIR} ${fw_io_exe})
|
file(RELATIVE_PATH fw_io_exe_relative ${CMAKE_CURRENT_BINARY_DIR} ${fw_io_exe})
|
||||||
file(RELATIVE_PATH fw_io_bin_relative ${CMAKE_CURRENT_BINARY_DIR} ${fw_io_bin})
|
file(RELATIVE_PATH fw_io_bin_relative ${CMAKE_CURRENT_BINARY_DIR} ${fw_io_bin})
|
||||||
|
set(fw_io_bin ${fw_io_bin} PARENT_SCOPE)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${fw_io_bin}
|
add_custom_command(OUTPUT ${fw_io_bin}
|
||||||
COMMAND mkdir -p ${PX4_BINARY_DIR}/ROMFS/${config_romfs_root}/extras/
|
COMMAND mkdir -p ${PX4_BINARY_DIR}/ROMFS/${config_romfs_root}/extras/
|
||||||
|
|||||||
Reference in New Issue
Block a user