From 055fa768d8066dd4d473e8f0de0a61d61746f76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 10 Sep 2020 13:33:29 +0200 Subject: [PATCH] posix: enable ROMFSROOT This will copy the ROMFS into the build directory under etc/, and thus needs a change of the PX4 startup parameters and mixer paths. --- Tools/gazebo_sitl_multiple_run.sh | 2 +- Tools/sitl_multiple_run.sh | 2 +- Tools/sitl_run.sh | 2 +- boards/atlflight/eagle/cmake/upload.cmake | 2 +- boards/atlflight/eagle/default.cmake | 1 + boards/beaglebone/blue/cmake/upload.cmake | 2 +- boards/beaglebone/blue/default.cmake | 1 + boards/emlid/navio2/cmake/upload.cmake | 2 +- boards/emlid/navio2/default.cmake | 1 + boards/px4/raspberrypi/cmake/upload.cmake | 2 +- boards/px4/raspberrypi/default.cmake | 1 + boards/px4/sitl/default.cmake | 1 + boards/px4/sitl/nolockstep.cmake | 1 + boards/px4/sitl/replay.cmake | 1 + boards/px4/sitl/rtps.cmake | 1 + boards/px4/sitl/test.cmake | 1 + launch/posix_sitl.launch | 2 +- launch/px4.launch | 2 +- launch/single_vehicle_spawn.launch | 2 +- launch/single_vehicle_spawn_sdf.launch | 2 +- posix-configs/bbblue/px4.config | 6 +++--- posix-configs/bbblue/px4_fw.config | 6 +++--- posix-configs/ocpoc/px4.config | 2 +- posix-configs/rpi/px4_fw.config | 2 +- posix-configs/rpi/px4_hil.config | 2 +- src/drivers/linux_pwm_out/linux_pwm_out.cpp | 4 ++-- src/drivers/pca9685_pwm_out/main.cpp | 2 +- test/mavsdk_tests/process_helper.py | 2 +- 28 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Tools/gazebo_sitl_multiple_run.sh b/Tools/gazebo_sitl_multiple_run.sh index 150da5e446..bf1ae0530a 100755 --- a/Tools/gazebo_sitl_multiple_run.sh +++ b/Tools/gazebo_sitl_multiple_run.sh @@ -30,7 +30,7 @@ function spawn_model() { pushd "$working_dir" &>/dev/null echo "starting instance $n in $(pwd)" - ../bin/px4 -i $n -d "$src_path/ROMFS/px4fmu_common" -w sitl_${MODEL}_${n} -s etc/init.d-posix/rcS >out.log 2>err.log & + ../bin/px4 -i $n -d "$build_path/etc" -w sitl_${MODEL}_${n} -s etc/init.d-posix/rcS >out.log 2>err.log & python3 ${src_path}/Tools/sitl_gazebo/scripts/xacro.py ${src_path}/Tools/sitl_gazebo/models/rotors_description/urdf/${MODEL}_base.xacro \ rotors_description_dir:=${src_path}/Tools/sitl_gazebo/models/rotors_description mavlink_udp_port:=$(($mavlink_udp_port+$N)) \ mavlink_tcp_port:=$(($mavlink_tcp_port+$N)) -o /tmp/${MODEL}_${N}.urdf diff --git a/Tools/sitl_multiple_run.sh b/Tools/sitl_multiple_run.sh index 07b28bbfb2..1737794866 100755 --- a/Tools/sitl_multiple_run.sh +++ b/Tools/sitl_multiple_run.sh @@ -28,7 +28,7 @@ while [ $n -lt $sitl_num ]; do pushd "$working_dir" &>/dev/null echo "starting instance $n in $(pwd)" - ../bin/px4 -i $n -d "$src_path/ROMFS/px4fmu_common" -s etc/init.d-posix/rcS >out.log 2>err.log & + ../bin/px4 -i $n -d "$build_path/etc" -s etc/init.d-posix/rcS >out.log 2>err.log & popd &>/dev/null n=$(($n + 1)) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index e78a984b68..9c18cb1b75 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -156,7 +156,7 @@ set +e if [[ ${model} == test_* ]] || [[ ${model} == *_generated ]]; then sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_test -s \"${src_path}\"/posix-configs/SITL/init/test/${model} -t \"$src_path\"/test_data" else - sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t \"$src_path\"/test_data" + sitl_command="\"$sitl_bin\" $no_pxh \"$build_path\"/etc -s etc/init.d-posix/rcS -t \"$src_path\"/test_data" fi echo SITL COMMAND: $sitl_command diff --git a/boards/atlflight/eagle/cmake/upload.cmake b/boards/atlflight/eagle/cmake/upload.cmake index f56d3cd3fb..c50f88945d 100644 --- a/boards/atlflight/eagle/cmake/upload.cmake +++ b/boards/atlflight/eagle/cmake/upload.cmake @@ -46,7 +46,7 @@ else() add_custom_target(upload COMMAND ${PX4_BOARD_DIR}/scripts/adb_upload.sh - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config ${PX4_SOURCE_DIR}/ROMFS # source + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/eagle/flight/mainapp.config ${PX4_BINARY_DIR}/etc # source /home/linaro # destination DEPENDS px4 ${PX4_BOARD_DIR}/scripts/adb_upload.sh COMMENT "uploading px4" diff --git a/boards/atlflight/eagle/default.cmake b/boards/atlflight/eagle/default.cmake index ce5be479b5..013df7e60d 100644 --- a/boards/atlflight/eagle/default.cmake +++ b/boards/atlflight/eagle/default.cmake @@ -41,6 +41,7 @@ px4_add_board( LABEL default #TESTING TOOLCHAIN arm-linux-gnueabihf + ROMFSROOT px4fmu_common DRIVERS #barometer # all available barometer drivers batt_smbus diff --git a/boards/beaglebone/blue/cmake/upload.cmake b/boards/beaglebone/blue/cmake/upload.cmake index d7fea26b7d..10a1e16485 100644 --- a/boards/beaglebone/blue/cmake/upload.cmake +++ b/boards/beaglebone/blue/cmake/upload.cmake @@ -33,7 +33,7 @@ add_custom_target(upload COMMAND rsync -arh --progress - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/bbblue/*.config ${PX4_SOURCE_DIR}/ROMFS # source + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/bbblue/*.config ${PX4_BINARY_DIR}/etc # source debian@beaglebone.lan:/home/debian/px4 # destination DEPENDS px4 COMMENT "uploading px4" diff --git a/boards/beaglebone/blue/default.cmake b/boards/beaglebone/blue/default.cmake index 5d0bdceea0..84088229e3 100644 --- a/boards/beaglebone/blue/default.cmake +++ b/boards/beaglebone/blue/default.cmake @@ -10,6 +10,7 @@ px4_add_board( LABEL default PLATFORM posix ARCHITECTURE cortex-a8 + ROMFSROOT px4fmu_common TOOLCHAIN arm-linux-gnueabihf TESTING DRIVERS diff --git a/boards/emlid/navio2/cmake/upload.cmake b/boards/emlid/navio2/cmake/upload.cmake index 94567474a6..a6f824fc33 100644 --- a/boards/emlid/navio2/cmake/upload.cmake +++ b/boards/emlid/navio2/cmake/upload.cmake @@ -39,7 +39,7 @@ endif() add_custom_target(upload COMMAND rsync -arh --progress - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_SOURCE_DIR}/ROMFS # source + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_BINARY_DIR}/etc # source pi@${AUTOPILOT_HOST}:/home/pi/px4 # destination DEPENDS px4 COMMENT "uploading px4" diff --git a/boards/emlid/navio2/default.cmake b/boards/emlid/navio2/default.cmake index dcdd951258..496281d084 100644 --- a/boards/emlid/navio2/default.cmake +++ b/boards/emlid/navio2/default.cmake @@ -8,6 +8,7 @@ px4_add_board( LABEL default PLATFORM posix ARCHITECTURE cortex-a53 + ROMFSROOT px4fmu_common TOOLCHAIN arm-linux-gnueabihf TESTING DRIVERS diff --git a/boards/px4/raspberrypi/cmake/upload.cmake b/boards/px4/raspberrypi/cmake/upload.cmake index ce0472b8a7..c77e80cd2e 100644 --- a/boards/px4/raspberrypi/cmake/upload.cmake +++ b/boards/px4/raspberrypi/cmake/upload.cmake @@ -39,7 +39,7 @@ endif() add_custom_target(upload COMMAND rsync -arh --progress - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_SOURCE_DIR}/ROMFS # source + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${PX4_SOURCE_DIR}/posix-configs/rpi/*.config ${PX4_BINARY_DIR}/etc # source pi@${AUTOPILOT_HOST}:/home/pi/px4 # destination DEPENDS px4 COMMENT "uploading px4" diff --git a/boards/px4/raspberrypi/default.cmake b/boards/px4/raspberrypi/default.cmake index c5241b1a32..061fdd446b 100644 --- a/boards/px4/raspberrypi/default.cmake +++ b/boards/px4/raspberrypi/default.cmake @@ -8,6 +8,7 @@ px4_add_board( LABEL default PLATFORM posix ARCHITECTURE cortex-a53 + ROMFSROOT px4fmu_common TOOLCHAIN arm-linux-gnueabihf TESTING DRIVERS diff --git a/boards/px4/sitl/default.cmake b/boards/px4/sitl/default.cmake index 7e9dbfbc1c..7c24558569 100644 --- a/boards/px4/sitl/default.cmake +++ b/boards/px4/sitl/default.cmake @@ -3,6 +3,7 @@ px4_add_board( PLATFORM posix VENDOR px4 MODEL sitl + ROMFSROOT px4fmu_common LABEL default TESTING DRIVERS diff --git a/boards/px4/sitl/nolockstep.cmake b/boards/px4/sitl/nolockstep.cmake index 4e7398987b..8e0a7695f2 100644 --- a/boards/px4/sitl/nolockstep.cmake +++ b/boards/px4/sitl/nolockstep.cmake @@ -3,6 +3,7 @@ px4_add_board( PLATFORM posix VENDOR px4 MODEL sitl + ROMFSROOT px4fmu_common LABEL nolockstep TESTING DRIVERS diff --git a/boards/px4/sitl/replay.cmake b/boards/px4/sitl/replay.cmake index df2b6e2181..fca852c46c 100644 --- a/boards/px4/sitl/replay.cmake +++ b/boards/px4/sitl/replay.cmake @@ -3,6 +3,7 @@ px4_add_board( PLATFORM posix VENDOR px4 MODEL sitl + ROMFSROOT px4fmu_common LABEL replay MODULES ekf2 diff --git a/boards/px4/sitl/rtps.cmake b/boards/px4/sitl/rtps.cmake index ef2a6a3ec1..83ba01cf31 100644 --- a/boards/px4/sitl/rtps.cmake +++ b/boards/px4/sitl/rtps.cmake @@ -3,6 +3,7 @@ px4_add_board( PLATFORM posix VENDOR px4 MODEL sitl + ROMFSROOT px4fmu_common LABEL rtps TESTING DRIVERS diff --git a/boards/px4/sitl/test.cmake b/boards/px4/sitl/test.cmake index f36effca6b..9c3a015c98 100644 --- a/boards/px4/sitl/test.cmake +++ b/boards/px4/sitl/test.cmake @@ -3,6 +3,7 @@ px4_add_board( PLATFORM posix VENDOR px4 MODEL sitl + ROMFSROOT px4fmu_common LABEL test TESTING DRIVERS diff --git a/launch/posix_sitl.launch b/launch/posix_sitl.launch index 207bd7ca76..d7df048c8e 100644 --- a/launch/posix_sitl.launch +++ b/launch/posix_sitl.launch @@ -29,7 +29,7 @@ + args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS $(arg px4_command_arg1)" required="true"/> diff --git a/launch/px4.launch b/launch/px4.launch index e2fbed86e5..8bb60f2175 100644 --- a/launch/px4.launch +++ b/launch/px4.launch @@ -13,6 +13,6 @@ - + diff --git a/launch/single_vehicle_spawn.launch b/launch/single_vehicle_spawn.launch index 113d74af2b..e01926b33a 100644 --- a/launch/single_vehicle_spawn.launch +++ b/launch/single_vehicle_spawn.launch @@ -25,7 +25,7 @@ - + diff --git a/launch/single_vehicle_spawn_sdf.launch b/launch/single_vehicle_spawn_sdf.launch index b55eef2c1f..f768f0d1a6 100644 --- a/launch/single_vehicle_spawn_sdf.launch +++ b/launch/single_vehicle_spawn_sdf.launch @@ -25,7 +25,7 @@ - + diff --git a/posix-configs/bbblue/px4.config b/posix-configs/bbblue/px4.config index 08856d59d8..049d37db2a 100644 --- a/posix-configs/bbblue/px4.config +++ b/posix-configs/bbblue/px4.config @@ -82,9 +82,9 @@ sleep 1 # RC port is mapped to /dev/ttyS4 (auto-detected) #rc_input start -d /dev/ttyS4 -# default: ROMFS/px4fmu_common/mixers/quad_x.main.mix, 8 output channels -linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/quad_x.main.mix -#linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/AETRFG.main.mix +# default: etc/mixers/quad_x.main.mix, 8 output channels +linux_pwm_out start -p bbblue_rc -m etc/mixers/quad_x.main.mix +#linux_pwm_out start -p bbblue_rc -m etc/mixers/AETRFG.main.mix logger start -t -b 200 diff --git a/posix-configs/bbblue/px4_fw.config b/posix-configs/bbblue/px4_fw.config index 2b4b620fc0..7ddbd2b534 100644 --- a/posix-configs/bbblue/px4_fw.config +++ b/posix-configs/bbblue/px4_fw.config @@ -78,9 +78,9 @@ sleep 1 # RC port is mapped to /dev/ttyS4 (auto-detected) rc_input start -d /dev/ttyS4 -# default: ROMFS/px4fmu_common/mixers/quad_x.main.mix, 8 output channels -#linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/quad_x.main.mix -linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/AETRFG.main.mix +# default: etc/mixers/quad_x.main.mix, 8 output channels +#linux_pwm_out start -p bbblue_rc -m etc/mixers/quad_x.main.mix +linux_pwm_out start -p bbblue_rc -m etc/mixers/AETRFG.main.mix logger start -t -b 200 diff --git a/posix-configs/ocpoc/px4.config b/posix-configs/ocpoc/px4.config index 34f4eb005a..6a6bf140ac 100644 --- a/posix-configs/ocpoc/px4.config +++ b/posix-configs/ocpoc/px4.config @@ -46,6 +46,6 @@ mavlink stream -d /dev/ttyPS1 -s ATTITUDE -r 50 rc_input start -d /dev/ttyS2 -linux_pwm_out start -p ocpoc_mmap -m ROMFS/px4fmu_common/mixers/quad_x.main.mix +linux_pwm_out start -p ocpoc_mmap -m etc/mixers/quad_x.main.mix logger start -t -b 200 mavlink boot_complete diff --git a/posix-configs/rpi/px4_fw.config b/posix-configs/rpi/px4_fw.config index 2b0ce09a4a..1b76850746 100644 --- a/posix-configs/rpi/px4_fw.config +++ b/posix-configs/rpi/px4_fw.config @@ -50,7 +50,7 @@ then fi navio_sysfs_rc_in start -linux_pwm_out start -m ROMFS/px4fmu_common/mixers/AETRFG.main.mix +linux_pwm_out start -m etc/mixers/AETRFG.main.mix logger start -t -b 200 diff --git a/posix-configs/rpi/px4_hil.config b/posix-configs/rpi/px4_hil.config index 64998099c2..90322eed8e 100644 --- a/posix-configs/rpi/px4_hil.config +++ b/posix-configs/rpi/px4_hil.config @@ -36,7 +36,7 @@ mc_rate_control start mavlink start -x -u 14577 -r 1000000 navio_sysfs_rc_in start pwm_out_sim start -mixer load /dev/pwm_output0 ROMFS/px4fmu_common/mixers/quad_x.main.mix +mixer load /dev/pwm_output0 etc/mixers/quad_x.main.mix logger start -t -b 200 diff --git a/src/drivers/linux_pwm_out/linux_pwm_out.cpp b/src/drivers/linux_pwm_out/linux_pwm_out.cpp index 1cbff01a58..c2ec391d43 100644 --- a/src/drivers/linux_pwm_out/linux_pwm_out.cpp +++ b/src/drivers/linux_pwm_out/linux_pwm_out.cpp @@ -72,7 +72,7 @@ static bool _is_running = false; static char _device[64] = "/sys/class/pwm/pwmchip0"; static char _protocol[64] = "navio"; static int _max_num_outputs = 8; ///< maximum number of outputs the driver should use -static char _mixer_filename[64] = "ROMFS/px4fmu_common/mixers/quad_x.main.mix"; +static char _mixer_filename[64] = "etc/mixers/quad_x.main.mix"; // subscriptions int _controls_subs[actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]; @@ -495,7 +495,7 @@ void usage() PX4_INFO(" -d pwmdevice : sysfs device for pwm generation (only for Navio)"); PX4_INFO(" (default /sys/class/pwm/pwmchip0)"); PX4_INFO(" -m mixerfile : path to mixerfile"); - PX4_INFO(" (default ROMFS/px4fmu_common/mixers/quad_x.main.mix)"); + PX4_INFO(" (default etc/mixers/quad_x.main.mix)"); PX4_INFO(" -p protocol : driver output protocol (navio|pca9685|ocpoc_mmap|bbblue_rc)"); PX4_INFO(" (default is navio)"); PX4_INFO(" -n num_outputs : maximum number of outputs the driver should use"); diff --git a/src/drivers/pca9685_pwm_out/main.cpp b/src/drivers/pca9685_pwm_out/main.cpp index cea1f8f5c0..35f5621bfd 100644 --- a/src/drivers/pca9685_pwm_out/main.cpp +++ b/src/drivers/pca9685_pwm_out/main.cpp @@ -516,7 +516,7 @@ It is typically started with: $ pca9685_pwm_out start -a 64 -b 1 Use the `mixer` command to load mixer files. -`mixer load /dev/pca9685 ROMFS/px4fmu_common/mixers/quad_x.main.mix` +`mixer load /dev/pca9685 etc/mixers/quad_x.main.mix` )DESCR_STR"); PRINT_MODULE_USAGE_NAME("pca9685_pwm_out", "driver"); diff --git a/test/mavsdk_tests/process_helper.py b/test/mavsdk_tests/process_helper.py index 826bd6d9cb..b40d642ee9 100644 --- a/test/mavsdk_tests/process_helper.py +++ b/test/mavsdk_tests/process_helper.py @@ -145,7 +145,7 @@ class Px4Runner(Runner): self.cmd = workspace_dir + "/build/px4_sitl_default/bin/px4" self.cwd = workspace_dir + "/build/px4_sitl_default/tmp/rootfs" self.args = [ - workspace_dir + "/ROMFS/px4fmu_common", + workspace_dir + "/build/px4_sitl_default/etc", "-s", "etc/init.d-posix/rcS", "-t",