Browse Source

rcS: Allow startup files to be located on SD card

master
Thomas Debrunner 3 years ago committed by Daniel Agar
parent
commit
f4a85fa951
  1. 12
      ROMFS/px4fmu_common/init.d/rc.autostart_ext
  2. 20
      ROMFS/px4fmu_common/init.d/rcS

12
ROMFS/px4fmu_common/init.d/rc.autostart_ext

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
#!/bin/sh
#
# External airframe startup script (on SD card)
#
set SDCARD_MIXERS_PATH ${SDCARD_EXT_PATH}/mixers
if [ -e ${SDCARD_EXT_PATH}/rc.autostart ]
then
. ${SDCARD_EXT_PATH}/rc.autostart
else
echo "Error: ${SDCARD_EXT_PATH}/rc.autostart does not exist"
fi

20
ROMFS/px4fmu_common/init.d/rcS

@ -44,6 +44,8 @@ set PWM_EXTRA_OUT none @@ -44,6 +44,8 @@ set PWM_EXTRA_OUT none
set PWM_EXTRA_RATE p:PWM_EXTRA_RATE
set EXTRA_MIXER_MODE none
set RC_INPUT_ARGS ""
set SDCARD_AVAILABLE no
set SDCARD_EXT_PATH /fs/microsd/ext_autostart
set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
set STARTUP_TUNE 1
set USE_IO no
@ -57,7 +59,6 @@ ver all @@ -57,7 +59,6 @@ ver all
#
# Try to mount the microSD card.
#
set SDCARD_AVAILABLE no
# REBOOTWORK this needs to start after the flight control loop.
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
@ -104,7 +105,6 @@ then @@ -104,7 +105,6 @@ then
fi
fi
fi
unset SDCARD_AVAILABLE
#
# Look for an init script on the microSD card.
@ -206,10 +206,22 @@ else @@ -206,10 +206,22 @@ else
#
# Set parameters and env variables for selected AUTOSTART.
#
set AUTOSTART_PATH etc/init.d/rc.autostart
if ! param compare SYS_AUTOSTART 0
then
. ${R}etc/init.d/rc.autostart
if param greater SYS_AUTOSTART 1000000
then
# Use external startup file
if [ $SDCARD_AVAILABLE = yes ]
then
set AUTOSTART_PATH etc/init.d/rc.autostart_ext
else
echo "ERROR [init] SD card not mounted - trying to load airframe from ROMFS"
fi
fi
. ${R}$AUTOSTART_PATH
fi
unset AUTOSTART_PATH
#
# Override parameters from user configuration file.
@ -540,6 +552,8 @@ unset PWM_OUT @@ -540,6 +552,8 @@ unset PWM_OUT
unset PWM_EXTRA_OUT
unset PWM_EXTRA_RATE
unset RC_INPUT_ARGS
unset SDCARD_AVAILABLE
unset SDCARD_EXT_PATH
unset SDCARD_MIXERS_PATH
unset STARTUP_TUNE
unset USE_IO

Loading…
Cancel
Save