From 000765e9f02d04ce41df02cff3c013e196b87dce Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 25 Aug 2021 20:00:14 -0400 Subject: [PATCH] NuttX mount procfs and binfs in px4 init --- .ci/Jenkinsfile-hardware | 1 + ROMFS/cannode/init.d/rcS | 4 ---- ROMFS/px4fmu_common/init.d/rcS | 5 ----- platforms/nuttx/src/px4/common/px4_init.cpp | 23 ++++++++++++++++++++- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.ci/Jenkinsfile-hardware b/.ci/Jenkinsfile-hardware index 8f223b52d0..6cd7430787 100644 --- a/.ci/Jenkinsfile-hardware +++ b/.ci/Jenkinsfile-hardware @@ -862,6 +862,7 @@ void checkStatus() { sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "listener cpuload; top once; listener cpuload"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "logger status" || true' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "ls /"' + sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "ls /bin"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "ls /dev"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "ls /etc"' sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "ls /obj"' diff --git a/ROMFS/cannode/init.d/rcS b/ROMFS/cannode/init.d/rcS index fea50019df..50ad4ff15b 100644 --- a/ROMFS/cannode/init.d/rcS +++ b/ROMFS/cannode/init.d/rcS @@ -15,10 +15,6 @@ set +e # #------------------------------------------------------------------------------ set R / -# -# Mount the procfs. -# -mount -t procfs /proc # # Start CDC/ACM serial driver. diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index d58c78c2fa..c11307d616 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -51,11 +51,6 @@ set STARTUP_TUNE 1 set USE_IO no set VEHICLE_TYPE none -# -# Mount the procfs. -# -mount -t procfs /proc - # # Start CDC/ACM serial driver. # diff --git a/platforms/nuttx/src/px4/common/px4_init.cpp b/platforms/nuttx/src/px4/common/px4_init.cpp index a8fdc83c06..ef0538bdb7 100644 --- a/platforms/nuttx/src/px4/common/px4_init.cpp +++ b/platforms/nuttx/src/px4/common/px4_init.cpp @@ -44,12 +44,15 @@ #include +#include +#include + #if defined(CONFIG_I2C) # include # include #endif // CONFIG_I2C -int px4_platform_init(void) +int px4_platform_init() { int ret = px4_console_buffer_init(); @@ -104,6 +107,24 @@ int px4_platform_init(void) #endif // CONFIG_I2C +#if defined(CONFIG_FS_PROCFS) + int ret_mount_procfs = mount(nullptr, "/proc", "procfs", 0, nullptr); + + if (ret < 0) { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret_mount_procfs); + } + +#endif // CONFIG_FS_PROCFS + +#if defined(CONFIG_FS_BINFS) + int ret_mount_binfs = nx_mount(nullptr, "/bin", "binfs", 0, nullptr); + + if (ret_mount_binfs < 0) { + syslog(LOG_ERR, "ERROR: Failed to mount binfs at /bin: %d\n", ret_mount_binfs); + } + +#endif // CONFIG_FS_BINFS + px4::WorkQueueManagerStart();