ROMFS handle bl_update generically

- include all available legacy bootloaders
This commit is contained in:
Daniel Agar
2021-03-10 09:40:49 -05:00
committed by Lorenz Meier
parent 3ad0da51c4
commit f8eaa6e46b
42 changed files with 84 additions and 213 deletions

View File

@@ -31,11 +31,12 @@
#
############################################################################
message(STATUS "ROMFS: ${config_romfs_root}")
set(romfs_src_dir ${PX4_SOURCE_DIR}/ROMFS/${config_romfs_root})
set(romfs_gen_root_dir ${PX4_BINARY_DIR}/etc)
file(RELATIVE_PATH romfs_path_relative ${PX4_SOURCE_DIR} ${romfs_src_dir})
message(STATUS "ROMFS: ${romfs_path_relative}")
set_property(GLOBAL PROPERTY PX4_ROMFS_FILES)
set_property(GLOBAL PROPERTY PX4_ROMFS_CMAKE_FILES)
@@ -149,9 +150,22 @@ if(config_io_board)
copy_px4io_bin
${fw_io_bin}
)
file(RELATIVE_PATH iofw_file_relative ${PX4_SOURCE_DIR} ${fw_io_bin})
message(STATUS "ROMFS: Adding ${iofw_file_relative} -> /etc/extras/${config_io_board}.bin")
endif()
if(config_build_bootloader)
# board bootloader (built or included)
if(TARGET copy_bootloader_bin)
if(board_bootloader_firmware)
file(RELATIVE_PATH bl_file_relative ${PX4_SOURCE_DIR} ${board_bootloader_firmware})
message(STATUS "ROMFS: Adding ${bl_file_relative} -> /etc/extras/bootloader.bin")
else()
file(RELATIVE_PATH bl_file_relative ${PX4_SOURCE_DIR} ${bootloader_bin})
message(STATUS "ROMFS: Adding ${bl_file_relative} -> /etc/extras/bootloader.bin")
endif()
list(APPEND extras_dependencies
copy_bootloader_bin
${bootloader_bin}
@@ -162,7 +176,8 @@ endif()
# optional board architecture defaults
set(board_arch_rc_file "rc.board_arch_defaults")
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/init/${CONFIG_ARCH_CHIP}/${board_arch_rc_file}")
message(STATUS "ROMFS: Adding ${board_arch_rc_file}")
file(RELATIVE_PATH rc_file_relative ${PX4_SOURCE_DIR} ${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/init/${CONFIG_ARCH_CHIP}/${board_arch_rc_file})
message(STATUS "ROMFS: Adding ${rc_file_relative} -> /etc/init.d/${board_arch_rc_file}")
add_custom_command(
OUTPUT
@@ -193,7 +208,8 @@ list(APPEND OPTIONAL_BOARD_RC
foreach(board_rc_file ${OPTIONAL_BOARD_RC})
if(EXISTS "${PX4_BOARD_DIR}/init/${board_rc_file}")
message(STATUS "ROMFS: Adding ${board_rc_file}")
file(RELATIVE_PATH rc_file_relative ${PX4_SOURCE_DIR} ${PX4_BOARD_DIR}/init/${board_rc_file})
message(STATUS "ROMFS: Adding ${rc_file_relative} -> /etc/init.d/${board_rc_file}")
add_custom_command(
OUTPUT
@@ -221,7 +237,7 @@ if(config_uavcan_peripheral_firmware)
foreach(uavcan_peripheral_config ${config_uavcan_peripheral_firmware})
# include the px4io binary in ROMFS
message(STATUS "ROMFS: Building and including UAVCAN peripheral ${uavcan_peripheral_config}")
message(STATUS "ROMFS: Adding UAVCAN peripheral ${uavcan_peripheral_config} -> /etc/uavcan/fw/")
ExternalProject_Add(build_${uavcan_peripheral_config}
SOURCE_DIR ${CMAKE_SOURCE_DIR}
DOWNLOAD_COMMAND ""

View File

@@ -1,5 +0,0 @@
px4fmuv3_bl.bin: Bootloader binary of the PX4 Bootloader
(https://github.com/PX4/Bootloader)
based on commit 184b813699a9cfd6f43a5a21556a06b4372baf5f
for the target px4fmuv3_bl

View File

@@ -549,6 +549,22 @@ else
. ${R}etc/init.d/rc.autostart.post
fi
#
# Bootloader upgrade
#
if param compare -s SYS_BL_UPDATE 1
then
if [ -f "/etc/extras/bootloader.bin" ]
then
param set SYS_BL_UPDATE 0
param save
echo "bootloader update..."
bl_update "/etc/extras/bootloader.bin"
echo "bootloader update done, rebooting"
reboot
fi
fi
if ! param compare SYS_PARAM_VER ${PARAM_DEFAULTS_VER}
then
echo "Switched to different parameter version. Resetting parameters."