Files
PX4-Autopilot/Kconfig
Julian Oes cc976e150a feat(posix): separate the filesystem root from the storage directory (#28582)
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>
2026-09-08 17:01:55 -06:00

273 lines
7.2 KiB
Plaintext

# PX4 Firmware Configuration
mainmenu "PX4 Firmware Configuration"
comment "Vendor: $(VENDOR)"
comment "Model: $(MODEL)"
comment "Label: $(LABEL)"
menu "Toolchain"
choice
prompt "Platform"
default PLATFORM_NUTTX
config PLATFORM_NUTTX
bool "nuttx"
config PLATFORM_POSIX
bool "posix"
config PLATFORM_QURT
bool "qurt"
config PLATFORM_ROS2
bool "ros2"
endchoice
config BOARD_PLATFORM
string
default "nuttx" if PLATFORM_NUTTX
default "posix" if PLATFORM_POSIX
default "qurt" if PLATFORM_QURT
default "ros2" if PLATFORM_ROS2
config BOARD_LOCKSTEP
bool "Force enable lockstep"
depends on PLATFORM_POSIX
help
forces lockstep behaviour, despite REPLAY env variable
config BOARD_NOLOCKSTEP
bool "Force disable lockstep"
depends on PLATFORM_POSIX
help
forces nolockstep behaviour, despite REPLAY env variable
config BOARD_LINUX_TARGET
bool "Linux OS Target"
depends on PLATFORM_POSIX
help
Board Platform is running the Linux operating system
config BOARD_TOOLCHAIN
string "Toolchain"
default ""
config BOARD_ARCHITECTURE
string "Architecture"
default ""
config BOARD_LTO
bool "(EXPERIMENTAL) Link Time Optimization (LTO)"
default n
help
Enables LTO flag in linker
Note: Highly EXPERIMENTAL, furthermore make sure you're using a modern compiler GCC 9 or later
config BOARD_FULL_OPTIMIZATION
bool "Full optmization (O3)"
default n
help
Enables Cmake Release for -O3 optimization
config BOARD_SUPPORT_FORTIFIED_TOOLCHAIN
bool "Fortified toolchain support"
default n
help
Enable compatibility with toolchains that define
_FORTIFY_SOURCE.
This switches PX4_DEBUG_OPT_LEVEL from -O0 to -Og. Keep this
disabled unless the fortified toolchain requires optimization.
config BOARD_ROMFSROOT
string "ROMFSROOT"
default "px4fmu_common"
help
relative path to the ROMFS root directory
config BOARD_ADDITIONAL_INIT
string "Additional init file"
help
additional configurable init file to include in the ROMFS
config BOARD_IO
string "IO board name"
default "px4_io-v2_default"
depends on DRIVERS_PX4IO
help
name of IO board to be built and included in the ROMFS (requires a valid ROMFSROOT)
config BOARD_CONSTRAINED_FLASH
bool "Contrained flash"
help
flag to enable constrained flash options (eg limit init script status text)
config BOARD_NO_HELP
bool "No help"
help
optional condition flag to disable help text on constrained flash systems
config BOARD_CONSTRAINED_MEMORY
bool "Contrained memory"
help
flag to enable constrained memory options (eg limit maximum number of uORB publications)
config BOARD_EXTERNAL_METADATA
bool "External metadata"
help
flag to exclude metadata to reduce flash
config BOARD_LINKER_PREFIX
string "linker prefix"
help
optional to prefix on the Linker script.
config BOARD_COMPILE_DEFINITIONS
string "add custom compile definitions"
help
add custom compile defitions to this specific target
endmenu #Toolchain
config BOARD_TESTING
bool "Testing"
select SYSTEMCMDS_TESTS
help
flag to enable automatic inclusion of PX4 testing modules
config BOARD_ETHERNET
bool "Ethernet"
help
flag to indicate that ethernet is enabled
config BOARD_CRYPTO
bool "Crypto support"
help
Enable PX4 Crypto Support. Select the implementation under drivers
config BOARD_SECUREBOOT
bool "Sign firmware image for secure boot"
default n
help
Run Tools/secure_bootloader/sign_firmware.py over the built .bin
to append an ed25519 signature, and mark the resulting .px4 as
image_signed: true so the uploader runs the bootloader's
VERIFY_SIG step before reboot. The matching public key must be
baked into the bootloader via CONFIG_PUBLIC_KEY0 in the
bootloader's .px4board file.
config BOARD_SECUREBOOT_KEY
string "Path to JSON private key (absolute or relative to repo root)"
depends on BOARD_SECUREBOOT
default "Tools/test_keys/test_keys.json"
help
Private key used by sign_firmware.py to sign the firmware
image. The default points at the upstream development test
key, which is pre-paired with Tools/test_keys/key0.pub. For
production builds, generate a new keypair with
Tools/secure_bootloader/generate_signing_keys.py and update
both this option and the bootloader's CONFIG_PUBLIC_KEY0.
The environment variable BOARD_SECUREBOOT_KEY overrides this
value at build time.
config BOARD_PROTECTED
bool "Memory protection"
help
Enable memory protection via MPU/MMU
menu "Serial ports"
config BOARD_SERIAL_URT6
string "URT6 tty port"
config BOARD_SERIAL_GPS1
string "GPS1 tty port"
config BOARD_SERIAL_GPS2
string "GPS2 tty port"
config BOARD_SERIAL_GPS3
string "GPS3 tty port"
config BOARD_SERIAL_GPS4
string "GPS4 tty port"
config BOARD_SERIAL_GPS5
string "GPS5 tty port"
config BOARD_SERIAL_TEL1
string "TEL1 tty port"
config BOARD_SERIAL_TEL2
string "TEL2 tty port"
config BOARD_SERIAL_TEL3
string "TEL3 tty port"
config BOARD_SERIAL_TEL4
string "TEL4 tty port"
config BOARD_SERIAL_TEL5
string "TEL5 tty port"
config BOARD_SERIAL_RC
string "RC tty port"
config BOARD_SERIAL_WIFI
string "WIFI tty port"
config BOARD_SERIAL_EXT2
string "EXT2 tty port"
endmenu
menu "File paths"
config BOARD_ROOT_PATH
string "PX4 storage path (writable: logs, parameters, dataman)"
default "/fs/microsd"
config BOARD_FS_ROOT_PATH
string "PX4 filesystem root that MAVLink FTP serves"
default BOARD_ROOT_PATH
help
The directory MAVLink FTP treats as its root. Defaults to the storage path,
which keeps FTP confined to it. Set it to a parent of the storage path to
expose read-only data alongside, as NuttX does by serving / with the SD card
mounted under it.
config BOARD_PARAM_FILE
string "Parameter file"
default "/fs/mtd_params"
config BOARD_NO_SDCARD
bool "Board has no SD card"
default n
help
Disable the SD card arming check for boards without an SD card slot.
endmenu
menu "drivers"
source "src/drivers/Kconfig"
endmenu
menu "modules"
source "src/modules/Kconfig"
endmenu
menu "systemcmds"
source "src/systemcmds/Kconfig"
endmenu
menu "examples"
source "src/examples/Kconfig"
endmenu
menu "templates"
source "src/templates/Kconfig"
endmenu
menu "platforms"
depends on PLATFORM_QURT || PLATFORM_POSIX || PLATFORM_NUTTX
source "platforms/Kconfig"
endmenu
source "src/lib/*/Kconfig"