@@ -137,11 +137,6 @@ add_custom_command(
137
137
COMMENT "ROMFS: copying, generating airframes"
138
138
)
139
139
140
- if (EXISTS ${PX4_BOARD_DIR} /extras/${PX4_BOARD_VENDOR} _${PX4_BOARD_MODEL} _bootloader.bin)
141
- set (BOARD_FIRMWARE_BIN "${PX4_BOARD_VENDOR} _${PX4_BOARD_MODEL} _bootloader.bin" )
142
- configure_file (${PX4_SOURCE_DIR} /platforms/nuttx/init/rc.board_bootloader_upgrade.in ${romfs_gen_root_dir} /init.d/rc.board_bootloader_upgrade @ONLY)
143
- endif ()
144
-
145
140
# copy extras into ROMFS
146
141
set (extras_dependencies)
147
142
@@ -208,6 +203,24 @@ endforeach()
208
203
set (OPTIONAL_BOARD_EXTRAS)
209
204
file (GLOB OPTIONAL_BOARD_EXTRAS ${PX4_BOARD_DIR} /extras/*)
210
205
206
+ # bootloader (optional)
207
+ # - if systemcmds/bl_update included and board bootloader available then generate rc.board_bootloader_upgrade and copy bootloader binary
208
+ # - otherwise remove bootloader binary from extras in final ROMFS
209
+ foreach (board_extra_file ${OPTIONAL_BOARD_EXTRAS} )
210
+ file (RELATIVE_PATH extra_file_base_name ${PX4_BOARD_DIR} /extras/ ${board_extra_file} )
211
+ if (${extra_file_base_name} MATCHES "${PX4_BOARD_VENDOR} _${PX4_BOARD_MODEL} _bootloader.bin" )
212
+ if (CONFIG_SYSTEMCMDS_BL_UPDATE)
213
+ # generate rc.board_bootloader_upgrade
214
+ set (BOARD_FIRMWARE_BIN "${PX4_BOARD_VENDOR} _${PX4_BOARD_MODEL} _bootloader.bin" )
215
+ configure_file (${PX4_SOURCE_DIR} /platforms/nuttx/init/rc.board_bootloader_upgrade.in ${romfs_gen_root_dir} /init.d/rc.board_bootloader_upgrade @ONLY)
216
+ else ()
217
+ # remove bootloader from extras
218
+ list (REMOVE_ITEM OPTIONAL_BOARD_EXTRAS ${board_extra_file} )
219
+ endif ()
220
+
221
+ endif ()
222
+ endforeach ()
223
+
211
224
foreach (board_extra_file ${OPTIONAL_BOARD_EXTRAS} )
212
225
213
226
if (EXISTS "${board_extra_file} " )
0 commit comments