mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-23 10:18:30 +08:00
On NuttX these are two things: / is the filesystem root, and /fs/microsd is the SD card mounted under it. MAVLink FTP serves the root and confines writes to the SD card, so the read-only ROMFS at /etc is visible but cannot be written. On POSIX they were the same directory. PX4_ROOTFSDIR and PX4_STORAGEDIR both resolved to CONFIG_BOARD_ROOT_PATH, which on SITL is ".", so the working directory was simultaneously the FTP root and the only writable area. The consequences were that the ROMFS symlink sat inside the FTP root, and that _validatePathIsWritable() had nothing meaningful to check against and so was compiled out on POSIX entirely, leaving no write restriction at all. Give POSIX the same split. CONFIG_BOARD_ROOT_PATH keeps its meaning as the storage directory, and a new CONFIG_BOARD_FS_ROOT_PATH names the root FTP serves, defaulting to the storage path so every existing board is unchanged. SITL sets the root to "." and storage to "./fs", which mirrors NuttX: logs, parameters, dataman and eeprom move under ./fs, and etc/ stays in the root as read-only data. With storage distinct from the root, the write restriction now applies on every platform rather than NuttX only, and no longer compares against a hardcoded prefix length that was wrong for any board not using /fs/microsd. Assisted-by: Claude:claude-opus-5[1m] Signed-off-by: Julian Oes <julian@oes.ch>