feat(ufw): enable nfs mounting and flashing

This commit is contained in:
Phil-Engljaehringer authored and GitHub committed 2026-07-28 16:25:42 +02:00
1 parent ec1c6a4901
commit 14b3f44081
18 files changed
+508 -12

No files matched your search

+5
View File
@@ -671,6 +671,11 @@ else
internal_combustion_engine_control start
fi
if param compare -s NFS_EN 1
then
nfs_mount start &
fi
#
# Optional board supplied extras: rc.board_extras
#
+1
View File
@@ -71,6 +71,7 @@ CONFIG_MODE_NAVIGATOR_VTOL_TAKEOFF=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_NFS_MOUNT=y
CONFIG_MODULES_TIME_PERSISTOR=y
CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
@@ -27,6 +27,10 @@ param set-default UXRCE_DDS_PTCFG 2
param set-default UXRCE_DDS_AG_IP 170461697
param set-default UXRCE_DDS_CFG 1000
# Mount NFS export from the SOM (10.41.10.1)
param set-default NFS_EN 1
param set-default NFS_IP 170461697
# Update default IP config if needed
netman update_default -i eth0
@@ -51,6 +51,7 @@
# CONFIG_NSH_DISABLE_USLEEP is not set
# CONFIG_STM32H7_AUTONEG is not set
# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD_CUSTOM=y
CONFIG_ARCH_BOARD_CUSTOM_DIR="../../../../boards/auterion/fmu-v6s/nuttx-config"
@@ -155,6 +156,7 @@ CONFIG_NET_SOLINGER=y
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CHECKSUMS=y
CONFIG_NET_UDP_WRITE_BUFFERS=y
CONFIG_NFS=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_ARGCAT=y
CONFIG_NSH_BUILTIN_APPS=y
+1
View File
@@ -147,6 +147,7 @@ set(msg_files
NavigatorMissionItem.msg
NavigatorStatus.msg
NeuralControl.msg
NfsUp.msg
NormalizedUnsignedSetpoint.msg
ObstacleDistance.msg
OffboardControlMode.msg
+1
View File
@@ -0,0 +1 @@
uint64 timestamp # time since system start (microseconds)
@@ -33,6 +33,7 @@ public:
IFileServerBackend::Path root_path_;
IFileServerBackend::Path alt_root_path_;
IFileServerBackend::Path nfs_root_path_;
/**
* All read operations must return this number of bytes, unless end of file is reached.
@@ -73,6 +74,19 @@ public:
}
}
void setNfsRootPath(const char * path)
{
if (path)
{
nfs_root_path_.clear();
nfs_root_path_ = path;
if (nfs_root_path_.back() != getPathSeparator())
{
nfs_root_path_.push_back(getPathSeparator());
}
}
}
/**
* Get a base path to the files.
*/
@@ -89,6 +103,11 @@ public:
return alt_root_path_;
}
Path& getNfsRootPath()
{
return nfs_root_path_;
}
/**
* Backend for uavcan.protocol.file.GetInfo.
* Refer to uavcan.protocol.file.EntryType for the list of available bit flags.
@@ -74,6 +74,7 @@ protected:
IFileServerBackend::Path &alt_root_path_;
IFileServerBackend::Path &root_path_;
IFileServerBackend::Path &nfs_root_path_;
class FDCacheItem : uavcan::Noncopyable
{
@@ -238,10 +239,12 @@ protected:
}
public:
FDCache(uavcan::INode &node, IFileServerBackend::Path &root_path, IFileServerBackend::Path &alt_root_path) :
FDCache(uavcan::INode &node, IFileServerBackend::Path &root_path, IFileServerBackend::Path &alt_root_path,
IFileServerBackend::Path &nfs_root_path) :
TimerBase(node),
alt_root_path_(alt_root_path),
root_path_(root_path),
nfs_root_path_(nfs_root_path),
head_(UAVCAN_NULLPTR)
{ }
@@ -277,6 +280,12 @@ protected:
fd = FDCacheBase::open(vpath.c_str(), oflags);
}
if (fd < 0 && !nfs_root_path_.empty()) {
vpath = nfs_root_path_.c_str();
vpath += path;
fd = FDCacheBase::open(vpath.c_str(), oflags);
}
if (fd < 0) {
return fd;
}
@@ -330,7 +339,7 @@ protected:
FDCacheBase &getFDCache()
{
if (fdcache_ == UAVCAN_NULLPTR) {
fdcache_ = new FDCache(node_, getRootPath(), getAltRootPath());
fdcache_ = new FDCache(node_, getRootPath(), getAltRootPath(), getNfsRootPath());
if (fdcache_ == UAVCAN_NULLPTR) {
fdcache_ = &fallback_;
@@ -368,6 +377,12 @@ protected:
rv = stat(vpath.c_str(), &sb);
}
if (rv < 0 && !getNfsRootPath().empty()) {
vpath = getNfsRootPath().c_str();
vpath += path;
rv = stat(vpath.c_str(), &sb);
}
if (rv < 0) {
rv = errno;
@@ -54,6 +54,7 @@ class FirmwareVersionChecker : public uavcan::IFirmwareVersionChecker
BasePathString base_path_;
BasePathString alt_base_path_;
BasePathString nfs_base_path_;
static void addSlash(BasePathString &path)
{
@@ -136,6 +137,14 @@ protected:
found = getFileInfo(bin_file_path, descriptor) == 0;
}
if (!found && !nfs_base_path_.empty()) {
snprintf(bin_file_name, sizeof(bin_file_name), "%u.bin", board_id);
snprintf(bin_file_path, sizeof(bin_file_path), "%s/%s",
nfs_base_path_.c_str(), bin_file_name);
found = getFileInfo(bin_file_path, descriptor) == 0;
}
if (found && (node_info.software_version.image_crc == 0 ||
(node_info.software_version.major == 0 && node_info.software_version.minor == 0) ||
descriptor.image_crc != node_info.software_version.image_crc)) {
@@ -251,6 +260,13 @@ out_close:
const BasePathString &getFirmwareAltBasePath() const { return alt_base_path_; }
const BasePathString &getFirmwareNfsBasePath() const { return nfs_base_path_; }
void setFirmwareNfsBasePath(const char *path)
{
nfs_base_path_ = path;
}
static char getPathSeparator()
{
return static_cast<char>(uavcan::protocol::file::Path::SEPARATOR);
+8
View File
@@ -751,6 +751,14 @@ UavcanNode::Run()
_node_info_retriever.invalidateAll();
}
#ifdef CONFIG_MODULES_NFS_MOUNT
if (_servers != nullptr) {
_servers->check_nfs();
}
#endif
_node.spinOnce(); // expected to be non-blocking
publish_can_interface_statuses();
+12 -8
View File
@@ -48,16 +48,20 @@
*/
// firmware paths
#define UAVCAN_MAX_PATH_LENGTH (128 + 40)
#define UAVCAN_SD_ROOT_PATH CONFIG_BOARD_ROOT_PATH "/"
#define UAVCAN_FIRMWARE_PATH UAVCAN_SD_ROOT_PATH"ufw"
#define UAVCAN_SD_STAGING_PATH UAVCAN_SD_ROOT_PATH"ufw_staging/"
#define UAVCAN_ROMFS_FW_PATH "/etc/uavcan/fw"
#define UAVCAN_ROMFS_FW_PREFIX "_"
#define UAVCAN_MAX_PATH_LENGTH (128 + 40)
#define UAVCAN_SD_ROOT_PATH CONFIG_BOARD_ROOT_PATH
#define UAVCAN_FIRMWARE_PATH UAVCAN_SD_ROOT_PATH "/ufw"
#define UAVCAN_SD_STAGING_PATH UAVCAN_SD_ROOT_PATH "/ufw_staging"
#ifdef CONFIG_MODULES_NFS_MOUNT
#define UAVCAN_NFS_PATH CONFIG_NFS_MOUNT_MOUNT_POINT "/ufw"
#define UAVCAN_NFS_STAGING_PATH CONFIG_NFS_MOUNT_MOUNT_POINT "/ufw_staging"
#endif
#define UAVCAN_ROMFS_FW_PATH "/etc/uavcan/fw"
#define UAVCAN_ROMFS_FW_PREFIX "_"
// logging
#define UAVCAN_NODE_DB_PATH UAVCAN_SD_ROOT_PATH"/uavcan.db"
#define UAVCAN_LOG_FILE UAVCAN_NODE_DB_PATH"/trace.log"
#define UAVCAN_NODE_DB_PATH UAVCAN_SD_ROOT_PATH "/uavcan.db"
#define UAVCAN_LOG_FILE UAVCAN_NODE_DB_PATH "/trace.log"
// public prototypes
extern "C" __EXPORT int uavcan_main(int argc, char *argv[]);
+16 -2
View File
@@ -154,6 +154,20 @@ int UavcanServers::init()
return 0;
}
#ifdef CONFIG_MODULES_NFS_MOUNT
void UavcanServers::check_nfs()
{
nfs_up_s nfs_up{};
if (_nfs_up_sub.update(&nfs_up)) {
migrateFWFromRoot(UAVCAN_NFS_PATH, UAVCAN_NFS_STAGING_PATH);
_fw_version_checker.setFirmwareNfsBasePath(UAVCAN_NFS_PATH);
_fileserver_backend.setNfsRootPath(UAVCAN_NFS_PATH);
_node_info_retriever.invalidateAll();
}
}
#endif
void UavcanServers::migrateFWFromRoot(const char *sd_path, const char *sd_root_path)
{
/*
@@ -217,7 +231,7 @@ void UavcanServers::migrateFWFromRoot(const char *sd_path, const char *sd_root_p
for (int i = 0; i < bin_count; i++) {
uavcan_posix::FirmwareVersionChecker::AppDescriptor descriptor{0};
snprintf(srcpath, sizeof(srcpath), "%s%s", sd_root_path, bin_names[i]);
snprintf(srcpath, sizeof(srcpath), "%s/%s", sd_root_path, bin_names[i]);
if (uavcan_posix::FirmwareVersionChecker::getFileInfo(srcpath, descriptor, 1024) != 0) {
continue;
@@ -239,7 +253,7 @@ int UavcanServers::copyFw(const char *dst, const char *src)
{
int rv = 0;
int dfd = open(dst, O_WRONLY | O_CREAT, 0666);
int dfd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (dfd < 0) {
PX4_ERR("copyFw: couldn't open dst");
+9
View File
@@ -46,6 +46,9 @@
#include <uavcan_posix/dynamic_node_id_server/file_storage_backend.hpp>
#include <uavcan_posix/firmware_version_checker.hpp>
#include <uORB/Subscription.hpp>
#include <uORB/topics/nfs_up.h>
#include "uavcan_module.hpp"
/**
@@ -68,6 +71,10 @@ public:
int init();
#ifdef CONFIG_MODULES_NFS_MOUNT
void check_nfs();
#endif
bool guessIfAllDynamicNodesAreAllocated() { return _server_instance.guessIfAllDynamicNodesAreAllocated(); }
private:
@@ -85,4 +92,6 @@ private:
uavcan::BasicFileServer _fw_server;
uavcan::NodeInfoRetriever &_node_info_retriever;
uORB::Subscription _nfs_up_sub{ORB_ID(nfs_up)};
};
+45
View File
@@ -0,0 +1,45 @@
############################################################################
#
# Copyright (c) 2026 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
px4_add_module(
MODULE modules__nfs_mount
MAIN nfs_mount
COMPILE_FLAGS
SRCS
NfsMount.cpp
NfsMount.hpp
MODULE_CONFIG
module.yaml
DEPENDS
px4_platform
)
+19
View File
@@ -0,0 +1,19 @@
menuconfig MODULES_NFS_MOUNT
bool "nfs_mount"
default n
---help---
Enable support for NFS client mounting
config NFS_MOUNT_MOUNT_POINT
string "NFS local mount point"
depends on MODULES_NFS_MOUNT
default "/fs/nfs"
---help---
Local path where the NFS export will be mounted.
config NFS_MOUNT_SERVER_PATH
string "NFS server export path"
depends on MODULES_NFS_MOUNT
default "/persistent/nfs/fmu"
---help---
The exported path on the NFS server to mount at NFS_MOUNT_MOUNT_POINT.
+242
View File
@@ -0,0 +1,242 @@
/****************************************************************************
*
* Copyright (c) 2026 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include "NfsMount.hpp"
#include <px4_platform_common/log.h>
#include <px4_platform_common/time.h>
#include <drivers/drv_hrt.h>
#include <cerrno>
#ifdef __PX4_NUTTX
#include <nuttx/config.h>
#include <arpa/inet.h>
#include <cstring>
#include <netinet/in.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <nuttx/fs/nfs.h>
#endif
using namespace time_literals;
static constexpr const char *NFS_MOUNT_POINT = CONFIG_NFS_MOUNT_MOUNT_POINT;
static constexpr const char *NFS_SERVER_PATH = CONFIG_NFS_MOUNT_SERVER_PATH;
ModuleBase::Descriptor NfsMount::desc{task_spawn, custom_command, print_usage};
NfsMount::NfsMount() : ModuleParams(nullptr) {}
#ifdef __PX4_NUTTX
/* Send a minimal RPC NULL call to portmapper and wait for a reply.
* recv() blocks on the socket semaphore (not net_lock), so no priority
* inheritance occurs while waiting. Returns true when a valid RPC REPLY arrives. */
static bool portmapper_up(in_addr_t ip)
{
/* Minimal RPC CALL for portmapper NULL procedure (RFC 1831 / RFC 1057).
* All multi-byte fields are big-endian (XDR). */
static const uint8_t null_call[] = {
0, 0, 0, 1, /* XID = 1 (arbitrary transaction ID) */
0, 0, 0, 0, /* msg_type = CALL (0) */
0, 0, 0, 2, /* rpcvers = 2 */
0, 1, 0x86, 0xa0, /* prog = 100000 (portmapper) */
0, 0, 0, 2, /* vers = 2 */
0, 0, 0, 0, /* proc = 0 (NULL) */
0, 0, 0, 0, /* cred: flavor = AUTH_NONE (0) */
0, 0, 0, 0, /* cred: body length = 0 */
0, 0, 0, 0, /* verf: flavor = AUTH_NONE (0) */
0, 0, 0, 0, /* verf: body length = 0 */
};
struct sockaddr_in dst {};
dst.sin_family = AF_INET;
dst.sin_port = htons(NFS_PMAPPORT);
dst.sin_addr.s_addr = ip;
int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) { return false; }
const struct timeval tv = {0, 200000}; /* 200 ms */
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
sendto(s, null_call, sizeof(null_call), 0,
reinterpret_cast<const struct sockaddr *>(&dst), sizeof(dst));
uint8_t reply[32];
struct sockaddr_in src {};
socklen_t src_len = sizeof(src);
const ssize_t n = recvfrom(s, reply, sizeof(reply), 0,
reinterpret_cast<struct sockaddr *>(&src), &src_len);
/* Verify the reply is from the expected host and is an RPC REPLY to our
* request (not DDS or any other service that may use the same port):
* - source address must match the server we queried
* - at least 12 bytes (XID + msg_type + reply_stat)
* - XID echoes back 1 (matches null_call)
* - msg_type == REPLY (1), so a stray CALL on port 111 is rejected */
static const uint8_t expected_hdr[] = {
0, 0, 0, 1, /* XID = 1 */
0, 0, 0, 1, /* msg_type = REPLY */
};
const bool up = (n >= 12) &&
(src.sin_addr.s_addr == ip) &&
(memcmp(reply, expected_hdr, sizeof(expected_hdr)) == 0);
close(s);
return up;
}
#endif /* __PX4_NUTTX */
void NfsMount::run()
{
updateParams();
#ifdef __PX4_NUTTX
const uint32_t ip_int = static_cast<uint32_t>(_param_nfs_ip.get());
char ip_str[16];
snprintf(ip_str, sizeof(ip_str), "%u.%u.%u.%u",
static_cast<uint8_t>(ip_int >> 24),
static_cast<uint8_t>(ip_int >> 16),
static_cast<uint8_t>(ip_int >> 8),
static_cast<uint8_t>(ip_int));
struct sockaddr_in sin {};
sin.sin_family = AF_INET;
sin.sin_port = htons(NFS_PMAPPORT);
inet_pton(AF_INET, ip_str, &sin.sin_addr);
struct nfs_args args {};
memcpy(&args.addr, &sin, sizeof(sin));
args.addrlen = sizeof(sin);
args.sotype = SOCK_DGRAM;
args.flags = NFSMNT_SOFT | NFSMNT_TIMEO | NFSMNT_RETRANS;
args.timeo = 30; /* 3 s per RPC attempt */
args.retrans = 5; /* 5 retries = 15 s total before soft-fail */
args.path = const_cast<char *>(NFS_SERVER_PATH);
bool armed = false;
while (!should_exit()) {
vehicle_status_s vs{};
if (_vehicle_status_sub.update(&vs)) {
armed = (vs.arming_state == vehicle_status_s::ARMING_STATE_ARMED);
}
if (armed) {
PX4_WARN("armed before NFS mount completed, aborting");
request_stop();
break;
}
if (portmapper_up(sin.sin_addr.s_addr)) {
if (mount(nullptr, NFS_MOUNT_POINT, "nfs", 0, &args) == 0) {
PX4_INFO("mounted %s:%s at %s", ip_str, NFS_SERVER_PATH, NFS_MOUNT_POINT);
nfs_up_s msg{};
msg.timestamp = hrt_absolute_time();
// Use orb_advertise instead of publish to ensure the topic remains visible
// after this one-shot module exits.
orb_advertise(ORB_ID(nfs_up), &msg);
return;
} else {
PX4_ERR("NfsMount %s:%s failed, errno %d", ip_str, NFS_SERVER_PATH, errno);
}
}
px4_usleep(5_s);
}
#endif
}
int NfsMount::run_trampoline(int argc, char *argv[])
{
return ModuleBase::run_trampoline_impl(desc, [](int, char **) -> ModuleBase * {
return new NfsMount();
}, argc, argv);
}
int NfsMount::task_spawn(int argc, char *argv[])
{
desc.task_id = px4_task_spawn_cmd("nfs_mount",
SCHED_DEFAULT,
SCHED_PRIORITY_DEFAULT,
PX4_STACK_ADJUSTED(2000),
(px4_main_t)&run_trampoline,
(char *const *)argv);
if (desc.task_id < 0) {
desc.task_id = -1;
return -errno;
}
return 0;
}
int NfsMount::custom_command(int argc, char *argv[])
{
return print_usage("unknown command");
}
int NfsMount::print_usage(const char *reason)
{
if (reason) {
PX4_WARN("%s\n", reason);
}
PRINT_MODULE_DESCRIPTION(
R"DESCR_STR(
### Description
Mounts an NFS filesystem from NFS_IP on NFS_MOUNT_MOUNT_POINT.
Started automatically by rcS when NFS_EN is set.
)DESCR_STR");
PRINT_MODULE_USAGE_NAME("nfs_mount", "system");
PRINT_MODULE_USAGE_COMMAND("start");
PRINT_MODULE_USAGE_DEFAULT_COMMANDS();
return 0;
}
extern "C" __EXPORT int nfs_mount_main(int argc, char *argv[])
{
return ModuleBase::main(NfsMount::desc, argc, argv);
}
+66
View File
@@ -0,0 +1,66 @@
/****************************************************************************
*
* Copyright (c) 2026 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#pragma once
#include <px4_platform_common/module.h>
#include <px4_platform_common/module_params.h>
#include <px4_platform_common/posix.h>
#include <uORB/uORB.h>
#include <uORB/Subscription.hpp>
#include <uORB/topics/nfs_up.h>
#include <uORB/topics/vehicle_status.h>
class NfsMount : public ModuleBase, public ModuleParams
{
public:
NfsMount();
~NfsMount() override = default;
static ModuleBase::Descriptor desc;
static int task_spawn(int argc, char *argv[]);
static int custom_command(int argc, char *argv[]);
static int print_usage(const char *reason = nullptr);
void run() override;
private:
static int run_trampoline(int argc, char *argv[]);
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
DEFINE_PARAMETERS(
(ParamInt<px4::params::NFS_IP>) _param_nfs_ip
)
};
+25
View File
@@ -0,0 +1,25 @@
module_name: NFS Mount
parameters:
- group: NFS
definitions:
NFS_EN:
description:
short: Enable NFS mount
long: |
When enabled, mounts the NFS export at the configured mount point.
Retries every 2 s until the server is reachable or the system is armed.
type: boolean
reboot_required: true
default: false
requires_ethernet: true
NFS_IP:
description:
short: NFS server IP address
long: |
IP address of the NFS server in int32 format.
Same encoding as UXRCE_DDS_AG_IP: 10.41.10.1 maps to 170461697.
type: int32
reboot_required: true
default: 170461697
requires_ethernet: true