Compare commits

...

7 Commits

Author SHA1 Message Date
Eric Katzfey 05dedde993 Dependency fix 2026-03-16 12:55:53 -07:00
Eric Katzfey bbb2e709da Various fixes 2026-03-16 11:20:13 -07:00
Ramon Roche 14a8636cb0 fix(boards/modalai/voxl2): remove obsolete build-deps.sh from README
The script was previously removed but the reference in the build
instructions remained.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-03-14 08:41:21 -07:00
Ramon Roche e219637d5d feat(boards/modalai/voxl2): add Debian packaging framework
Add a scalable .deb packaging framework for VOXL2, built on the
existing cmake/package.cmake CPack infrastructure. The framework
handles multi-processor boards by having the POSIX (_default) build
own the .deb and pull in the companion SLPI build's artifacts.

Board-specific files:
- cmake/package.cmake: CPack variable overrides (name, deps, version)
- cmake/install.cmake: install() rules for all .deb contents
- debian/postinst: px4-* symlinks, DSP signature, directory setup
- debian/prerm: service stop, symlink cleanup
- debian/voxl-px4.service: systemd unit (after sscrpcd)

Infrastructure changes:
- cmake/package.cmake: hook for board-specific CPack overrides
- platforms/posix/CMakeLists.txt: hook for board install.cmake
- Makefile: %_deb pattern rule (build _default, then cpack -G DEB)
- CI: auto-discover _deb targets, collect .deb artifacts, upload
  to GitHub Releases

Future boards: add cmake/package.cmake + cmake/install.cmake and
CI discovers it automatically. No new file formats or tools needed.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-03-14 08:41:21 -07:00
Ramon Roche 9077f55f85 ci(boards): filter companion targets from CI build groups
Read companion_targets files from board directories and exclude those
targets from CI grouped builds. The parent target builds them via
Make prerequisite, avoiding redundant CI jobs.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-03-12 10:52:30 -07:00
Ramon Roche 2a510671e3 build(boards/modalai/voxl2): chain SLPI build as prerequisite of default target
Add Makefile rules so that both `make modalai_voxl2` and
`make modalai_voxl2_default` build the SLPI DSP firmware first.
Add companion_targets file listing modalai_voxl2_slpi so CI knows
to exclude it from independent build groups.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-03-12 10:52:23 -07:00
Ramon Roche 1e6f028c04 refactor(boards/modalai/voxl2): merge voxl2-slpi into voxl2 as board variant
Consolidate the VOXL2 SLPI (DSP) board from a separate directory into
the existing voxl2 board as a variant. Multi-processor SoCs like the
QRB5165 should use one board directory with multiple .px4board files
rather than separate directories per processor.

Changes:
- Add slpi.px4board (QURT/DSP) alongside default.px4board (POSIX/apps)
- Merge board_config.h with __PX4_QURT / __PX4_POSIX preprocessor guards
- Merge CMakeLists.txt with PX4_PLATFORM conditionals
- Split bus definitions into platform-specific files (i2c/spi_posix/qurt)
- Reorganize drivers into drivers/posix/ and drivers/qurt/ subdirectories
- Guard cmake/init.cmake and cmake/link_libraries.cmake for posix-only
- Update build and install scripts for new target names
- Delete boards/modalai/voxl2-slpi/ entirely

Build targets change:
- modalai_voxl2-slpi_default -> modalai_voxl2_slpi
- modalai_voxl2_default (unchanged)

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-03-12 10:52:10 -07:00
56 changed files with 760 additions and 239 deletions
+3 -1
View File
@@ -265,5 +265,7 @@ jobs:
with:
draft: true
prerelease: ${{ steps.upload-location.outputs.is_prerelease == 'true' }}
files: artifacts/*.px4
files: |
artifacts/*.px4
artifacts/*.deb
name: ${{ steps.upload-location.outputs.uploadlocation }}
+13
View File
@@ -226,9 +226,22 @@ CONFIG_TARGETS_DEFAULT := $(patsubst %_default,%,$(filter %_default,$(ALL_CONFIG
$(CONFIG_TARGETS_DEFAULT):
@$(call cmake-build,$@_default$(BUILD_DIR_SUFFIX))
# Multi-processor boards: build all processor targets together
# VOXL2 apps processor (default) depends on SLPI DSP being built first
modalai_voxl2_default: modalai_voxl2_slpi
modalai_voxl2: modalai_voxl2_slpi
modalai_voxl2_deb: modalai_voxl2_slpi
all_config_targets: $(ALL_CONFIG_TARGETS)
all_default_targets: $(CONFIG_TARGETS_DEFAULT)
# DEB package targets: builds _default config, then runs cpack.
# Multi-processor boards (e.g. VOXL2) chain companion builds automatically
# via existing cmake prerequisites.
%_deb:
@$(call cmake-build,$(subst _deb,_default,$@)$(BUILD_DIR_SUFFIX))
@cd "$(SRC_DIR)/build/$(subst _deb,_default,$@)" && cpack -G DEB
updateconfig:
@./Tools/kconfig/updateconfig.py
+59
View File
@@ -189,6 +189,65 @@ for manufacturer in sorted(os.scandir(os.path.join(source_dir, '../boards')), ke
if target is not None:
build_configs.append(target)
# Remove companion targets from CI groups (parent target builds them via Make prerequisite)
for manufacturer in sorted(os.scandir(os.path.join(source_dir, '../boards')), key=lambda e: e.name):
if not manufacturer.is_dir():
continue
for board in sorted(os.scandir(manufacturer.path), key=lambda e: e.name):
if not board.is_dir():
continue
companion_file = os.path.join(board.path, 'companion_targets')
if os.path.exists(companion_file):
with open(companion_file) as f:
companions = {l.strip() for l in f if l.strip() and not l.startswith('#')}
for arch in grouped_targets:
for man in grouped_targets[arch]['manufacturers']:
grouped_targets[arch]['manufacturers'][man] = [
t for t in grouped_targets[arch]['manufacturers'][man]
if t not in companions
]
# Append _deb targets for boards that have cmake/package.cmake
for manufacturer in sorted(os.scandir(os.path.join(source_dir, '../boards')), key=lambda e: e.name):
if not manufacturer.is_dir():
continue
if manufacturer.name in excluded_manufacturers:
continue
for board in sorted(os.scandir(manufacturer.path), key=lambda e: e.name):
if not board.is_dir():
continue
board_name = manufacturer.name + '_' + board.name
if board_name in excluded_boards:
continue
package_cmake = os.path.join(board.path, 'cmake', 'package.cmake')
if os.path.exists(package_cmake):
deb_target = board_name + '_deb'
if target_filter and not any(deb_target.startswith(f) for f in target_filter):
continue
# Determine the container and group for this board
container = default_container
if board_name in board_container_overrides:
container = board_container_overrides[board_name]
target_entry = {'target': deb_target, 'container': container}
if args.group:
# Find the group where this board's _default target already lives
default_target = board_name + '_default'
group = None
for g in grouped_targets:
targets_in_group = grouped_targets[g].get('manufacturers', {}).get(manufacturer.name, [])
if default_target in targets_in_group:
group = g
break
if group is None:
group = 'base'
target_entry['arch'] = group
if group not in grouped_targets:
grouped_targets[group] = {'container': container, 'manufacturers': {}}
if manufacturer.name not in grouped_targets[group]['manufacturers']:
grouped_targets[group]['manufacturers'][manufacturer.name] = []
grouped_targets[group]['manufacturers'][manufacturer.name].append(deb_target)
build_configs.append(target_entry)
if(verbose):
import pprint
print("============================")
+1
View File
@@ -3,6 +3,7 @@
mkdir artifacts
cp **/**/*.px4 artifacts/ 2>/dev/null || true
cp **/**/*.elf artifacts/ 2>/dev/null || true
cp **/**/*.deb artifacts/ 2>/dev/null || true
for build_dir_path in build/*/ ; do
build_dir_path=${build_dir_path::${#build_dir_path}-1}
build_dir=${build_dir_path#*/}
@@ -1,84 +0,0 @@
############################################################################
#
# Copyright (c) 2022 ModalAI, Inc. 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.
#
############################################################################
# Need to make sure that the DSP processor on VOXL2
# knows about all parameters since some modules need parameters
# from other modules that are not running on the DSP.
set(DISABLE_PARAMS_MODULE_SCOPING TRUE PARENT_SCOPE)
add_library(drivers_board
board_config.h
i2c.cpp
init.c
spi.cpp
)
# Generate MAVLink common headers for SLPI drivers (dsp_hitl, mavlink_rc_in)
# Replicates the generation from src/modules/mavlink/CMakeLists.txt so the
# SLPI build is self-contained and does not depend on voxl2-default.
set(MAVLINK_GIT_DIR "${PX4_SOURCE_DIR}/src/modules/mavlink/mavlink")
set(MAVLINK_LIBRARY_DIR "${CMAKE_BINARY_DIR}/mavlink")
px4_add_git_submodule(TARGET git_mavlink_v2 PATH "${MAVLINK_GIT_DIR}")
add_custom_command(
OUTPUT ${MAVLINK_LIBRARY_DIR}/common/common.h
COMMAND ${PYTHON_EXECUTABLE} ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
--lang C --wire-protocol 2.0
--output ${MAVLINK_LIBRARY_DIR}
${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml
> ${CMAKE_BINARY_DIR}/mavgen_common.log
DEPENDS
git_mavlink_v2
${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml
COMMENT "Generating MAVLink common headers for SLPI"
)
add_custom_target(mavlink_common_generate DEPENDS ${MAVLINK_LIBRARY_DIR}/common/common.h)
add_library(mavlink_common_headers INTERFACE)
add_dependencies(mavlink_common_headers mavlink_common_generate)
target_compile_options(mavlink_common_headers INTERFACE -Wno-address-of-packed-member -Wno-cast-align)
target_include_directories(mavlink_common_headers INTERFACE
${MAVLINK_LIBRARY_DIR}
${MAVLINK_LIBRARY_DIR}/common
)
# Add custom drivers for SLPI
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/rc_controller)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/mavlink_rc_in)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/spektrum_rc)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/ghst_rc)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/dsp_hitl)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/dsp_sbus)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/elrs_led)
@@ -1,82 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2022-2026 ModalAI, Inc. 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.
*
****************************************************************************/
/**
* @file board_config.h
*
* VOXL2 internal definitions
*/
#pragma once
#define CONFIG_BOARDCTL_RESET
#define BOARD_HAS_NO_BOOTLOADER
/*
* I2C buses
*/
#define CONFIG_I2C 1
#define PX4_NUMBER_I2C_BUSES 4
/*
* SPI buses
*/
#define CONFIG_SPI 1
#define BOARD_SPI_BUS_MAX_BUS_ITEMS 1
/*
* Include these last to make use of the definitions above
*/
#include <system_config.h>
#include <px4_platform_common/board_common.h>
/*
* Default port for the ESC
*/
#define VOXL_ESC_DEFAULT_PORT "2"
/*
* Default port for the GHST RC
*/
#define GHST_RC_DEFAULT_PORT "7"
/*
* Default port for M0065
*/
#define VOXL2_IO_DEFAULT_PORT "2"
/*
* M0065 PWM
*/
#define DIRECT_PWM_OUTPUT_CHANNELS 4
#define MAX_IO_TIMERS 3
-35
View File
@@ -1,35 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2022 ModalAI, Inc. 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 "board_config.h"
// Place holder for VOXL2-specific early startup code
+10 -2
View File
@@ -13,6 +13,10 @@ critical applications such as Mavlink, and logging are running on the
ARM CPU cluster (aka apps proc). The DSP and ARM CPU cluster communicate via a
Qualcomm proprietary shared memory interface.
Both processors are built from this single board directory:
- `default.px4board` - POSIX apps processor (ARM64)
- `slpi.px4board` - QURT DSP (Hexagon)
## Build environment
In order to build for this platform both the Qualcomm Hexagon (DSP) toolchain and the Linaro ARM64 toolchain need to be installed. The (nearly) complete setup including the ARM64 toolchain is provided in the base Docker image provided by ModalAI, but since ModalAI is not allowed to redistribute the Qualcomm Hexagon DSP SDK this must be added by the end user.
@@ -22,17 +26,21 @@ The full instructions are available here:
## Build overview
A single `make modalai_voxl2` command builds both the DSP and apps processor
firmware. The Makefile chains the SLPI build as a prerequisite of the default
(apps) build.
- Clone the repo (Don't forget to update and initialize all submodules)
- In the top level directory
```
px4$ boards/modalai/voxl2/scripts/run-docker.sh
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/clean.sh
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-deps.sh
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-apps.sh
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-slpi.sh
root@9373fa1401b8:/usr/local/workspace# exit
```
For DSP-only rebuilds: `make modalai_voxl2_slpi`
## Install and run on VOXL 2
Once the DSP and Linux images have been built they can be installed on a VOXL 2
+4
View File
@@ -31,6 +31,10 @@
#
############################################################################
if(NOT "${PX4_PLATFORM}" STREQUAL "posix")
return()
endif()
# Initialize libfc-sensor-api submodule (fetches from GitLab if not present)
execute_process(
COMMAND Tools/check_submodules.sh boards/modalai/voxl2/libfc-sensor-api
+83
View File
@@ -0,0 +1,83 @@
############################################################################
#
# Copyright (c) 2024 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.
#
############################################################################
# VOXL2 board-specific install rules for .deb packaging
# Included from platforms/posix/CMakeLists.txt where the px4 target exists
# SLPI companion build output directory
set(VOXL2_SLPI_BUILD_DIR "${PX4_SOURCE_DIR}/build/modalai_voxl2_slpi")
# Apps processor binary
install(TARGETS px4 RUNTIME DESTINATION bin)
# px4-alias.sh (generated during build into bin/ subdirectory)
install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/px4-alias.sh DESTINATION bin)
# Startup scripts from board target directory
install(PROGRAMS
${PX4_BOARD_DIR}/target/voxl-px4
${PX4_BOARD_DIR}/target/voxl-px4-start
${PX4_BOARD_DIR}/target/voxl-px4-hitl
${PX4_BOARD_DIR}/target/voxl-px4-hitl-start
DESTINATION bin
)
# DSP firmware blob from companion SLPI build
install(FILES ${VOXL2_SLPI_BUILD_DIR}/platforms/qurt/libpx4.so
DESTINATION lib/rfsa/adsp
)
# Configuration files
install(FILES
${PX4_BOARD_DIR}/target/voxl-px4-fake-imu-calibration.config
${PX4_BOARD_DIR}/target/voxl-px4-hitl-set-default-parameters.config
DESTINATION ../etc/modalai
)
# Systemd service file
install(FILES ${PX4_BOARD_DIR}/debian/voxl-px4.service
DESTINATION ../etc/systemd/system
)
# Component metadata JSON files
install(FILES
${PX4_BINARY_DIR}/actuators.json.xz
${PX4_BINARY_DIR}/component_general.json.xz
${PX4_BINARY_DIR}/parameters.json.xz
DESTINATION ../data/px4/etc/extras
OPTIONAL
)
install(FILES ${PX4_BINARY_DIR}/events/all_events.json.xz
DESTINATION ../data/px4/etc/extras
OPTIONAL
)
@@ -1,3 +1,6 @@
if(NOT "${PX4_PLATFORM}" STREQUAL "posix")
return()
endif()
# Link against the public stub version of the proprietary fc sensor library
target_link_libraries(px4 PRIVATE
+63
View File
@@ -0,0 +1,63 @@
############################################################################
#
# Copyright (c) 2024 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.
#
############################################################################
# VOXL2 board-specific CPack overrides
# Loaded after cmake/package.cmake sets up CPack defaults
# Derive Debian-compatible version from git tag (e.g. v1.17.0-alpha1-42-gabcdef -> 1.17.0~alpha1.42.gabcdef)
string(REGEX REPLACE "^v" "" _deb_ver "${PX4_GIT_TAG}")
string(REGEX REPLACE "-" "~" _deb_ver "${_deb_ver}" )
string(REGEX REPLACE "~([0-9]+)~" ".\\1." _deb_ver "${_deb_ver}")
# VOXL2 is always aarch64 regardless of build host
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
set(CPACK_DEBIAN_PACKAGE_NAME "voxl-px4")
set(CPACK_DEBIAN_FILE_NAME "voxl-px4_${_deb_ver}_arm64.deb")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
set(CPACK_INSTALL_PREFIX "/usr")
set(CPACK_SET_DESTDIR true)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libfc-sensor (>=1.0.10), voxl-px4-params (>=0.3.10), voxl3-system-image(>=0.0.2) | voxl2-system-image(>=1.5.4) | rb5-system-image(>=1.6.2), modalai-slpi(>=1.1.16) | modalai-adsp(>=1.0.2)")
set(CPACK_DEBIAN_PACKAGE_CONFLICTS "px4-rb5-flight")
set(CPACK_DEBIAN_PACKAGE_REPLACES "px4-rb5-flight")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "PX4 Autopilot for ModalAI VOXL2")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "ModalAI <support@modalai.com>")
# Disable shlibdeps for cross-compiled boards
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${PX4_BOARD_DIR}/debian/postinst;${PX4_BOARD_DIR}/debian/prerm")
# Install rules are in boards/modalai/voxl2/cmake/install.cmake,
# included from platforms/posix/CMakeLists.txt where the px4 target exists.
+3
View File
@@ -0,0 +1,3 @@
# Companion processor targets - built automatically by the parent (default) target
# These are excluded from CI target lists to avoid redundant builds
modalai_voxl2_slpi
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
set -e
# Create px4-* symlinks from px4-alias.sh
# The alias format is: alias <module>='px4-<module> --instance $px4_instance'
# We extract the px4-<module> command name and symlink it to the px4 binary
if [ -f /usr/bin/px4-alias.sh ]; then
grep "^alias " /usr/bin/px4-alias.sh | \
sed -n "s/.*'\(px4-[a-zA-Z0-9_]*\).*/\1/p" | while read cmd; do
ln -sf px4 "/usr/bin/${cmd}"
done
fi
# Detect platform and generate DSP test signature if needed
if ! /bin/ls /usr/lib/rfsa/adsp/testsig-*.so &> /dev/null; then
echo "[INFO] Generating DSP test signature..."
if [ -f /share/modalai/qcs6490-slpi-test-sig/generate-test-sig.sh ]; then
/share/modalai/qcs6490-slpi-test-sig/generate-test-sig.sh || true
elif [ -f /share/modalai/qrb5165-slpi-test-sig/generate-test-sig.sh ]; then
/share/modalai/qrb5165-slpi-test-sig/generate-test-sig.sh || true
else
echo "[WARNING] Could not find DSP signature generation script"
fi
fi
# Create required data directories
mkdir -p /data/px4/param
mkdir -p /data/px4/etc/extras
chown -R root:root /data/px4
# Reload systemd if available
if command -v systemctl > /dev/null 2>&1; then
systemctl daemon-reload
fi
echo "voxl-px4 installed successfully"
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
set -e
# Stop voxl-px4 service if running
if command -v systemctl > /dev/null 2>&1; then
systemctl stop voxl-px4 2>/dev/null || true
fi
# Remove px4-* symlinks
for f in /usr/bin/px4-*; do
if [ -L "$f" ] && [ "$(readlink "$f")" = "px4" ]; then
rm -f "$f"
fi
done
@@ -0,0 +1,14 @@
[Unit]
Description=PX4 Autopilot for VOXL2
After=sscrpcd.service
Requires=sscrpcd.service
[Service]
Type=simple
ExecStart=/usr/bin/voxl-px4
ExecStopPost=/usr/bin/voxl-reset-slpi
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash
echo "*** Starting apps processor build ***"
echo "*** Starting unified VOXL2 build (apps + SLPI) ***"
source /home/build-env.sh
@@ -8,4 +8,4 @@ make modalai_voxl2
cat build/modalai_voxl2_default/src/lib/version/build_git_version.h
echo "*** End of apps processor build ***"
echo "*** End of unified VOXL2 build ***"
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
echo "*** Starting unified VOXL2 build (apps + SLPI) ***"
source /home/build-env.sh
make modalai_voxl2_deb
cat build/modalai_voxl2_default/src/lib/version/build_git_version.h
echo "*** End of unified VOXL2 build ***"
+1 -1
View File
@@ -4,6 +4,6 @@ echo "*** Starting qurt slpi build ***"
source /home/build-env.sh
make modalai_voxl2-slpi
make modalai_voxl2_slpi
echo "*** End of qurt slpi build ***"
@@ -1,7 +1,7 @@
#!/bin/bash
# Push slpi image to voxl2
adb push build/modalai_voxl2-slpi_default/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp
adb push build/modalai_voxl2_slpi/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp
# Push apps processor image to voxl2
adb push build/modalai_voxl2_default/bin/px4 /usr/bin
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# Push slpi image to voxl2
adb push build/modalai_voxl2-slpi_default/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp
adb push build/modalai_voxl2_slpi/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp
# Push apps processor image to voxl2
adb push build/modalai_voxl2_default/bin/px4 /usr/bin
@@ -1,5 +1,23 @@
CONFIG_PLATFORM_QURT=y
CONFIG_BOARD_TOOLCHAIN="qurt"
# Disable modules from default.px4board that are apps-only
CONFIG_BOARD_LINUX_TARGET=n
CONFIG_DRIVERS_OSD_MSP_OSD=n
CONFIG_DRIVERS_QSHELL_POSIX=n
CONFIG_DRIVERS_RC_INPUT=n
CONFIG_MODULES_DATAMAN=n
CONFIG_MODULES_LOGGER=n
CONFIG_MODULES_MAVLINK=n
CONFIG_MODULES_MUORB_APPS=n
CONFIG_MODULES_NAVIGATOR=n
CONFIG_MODULES_UXRCE_DDS_CLIENT=n
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=n
CONFIG_SYSTEMCMDS_BSONDUMP=n
CONFIG_SYSTEMCMDS_PERF=n
CONFIG_SYSTEMCMDS_TOPIC_LISTENER=n
CONFIG_SYSTEMCMDS_VER=n
CONFIG_SYSTEMCMDS_REBOOT=n
CONFIG_PARAM_PRIMARY=n
CONFIG_DRIVERS_ACTUATORS_VOXL_ESC=y
CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP101XX=y
CONFIG_DRIVERS_BAROMETER_MS5611=y
+71 -18
View File
@@ -31,28 +31,81 @@
#
############################################################################
# Need to make sure that the Linux processor on VOXL2
# knows about all parameters since it is acting as the
# parameter server for other processors that may define
# parameters that it doesn't normally know about.
# Both processors need to know about all parameters since modules are
# split across processors and may reference parameters from the other side.
set(DISABLE_PARAMS_MODULE_SCOPING TRUE PARENT_SCOPE)
add_library(drivers_board
set(SRCS
board_config.h
i2c.cpp
init.c
boardctl.c
spi.cpp
)
)
# Add custom drivers
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/apps_sbus)
if("${PX4_PLATFORM}" STREQUAL "qurt")
list(APPEND SRCS
i2c_qurt.cpp
spi_qurt.cpp
)
elseif("${PX4_PLATFORM}" STREQUAL "posix")
list(APPEND SRCS
boardctl.c
i2c_posix.cpp
spi_posix.cpp
)
endif()
# Add custom libraries
add_subdirectory(${PX4_BOARD_DIR}/src/lib/mpa)
add_library(drivers_board ${SRCS})
# Add custom modules
add_subdirectory(${PX4_BOARD_DIR}/src/modules/voxl_save_cal_params)
add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_air_data_bridge)
add_subdirectory(${PX4_BOARD_DIR}/src/modules/sensor_baro_bridge)
add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_local_position_bridge)
if("${PX4_PLATFORM}" STREQUAL "qurt")
# Generate MAVLink common headers for SLPI drivers (dsp_hitl, mavlink_rc_in)
# Replicates the generation from src/modules/mavlink/CMakeLists.txt so the
# SLPI build is self-contained and does not depend on voxl2-default.
set(MAVLINK_GIT_DIR "${PX4_SOURCE_DIR}/src/modules/mavlink/mavlink")
set(MAVLINK_LIBRARY_DIR "${CMAKE_BINARY_DIR}/mavlink")
px4_add_git_submodule(TARGET git_mavlink_v2_slpi PATH "${MAVLINK_GIT_DIR}")
add_custom_command(
OUTPUT ${MAVLINK_LIBRARY_DIR}/common/common.h
COMMAND ${PYTHON_EXECUTABLE} ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
--lang C --wire-protocol 2.0
--output ${MAVLINK_LIBRARY_DIR}
${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml
> ${CMAKE_BINARY_DIR}/mavgen_common.log
DEPENDS
git_mavlink_v2_slpi
${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml
COMMENT "Generating MAVLink common headers for SLPI"
)
add_custom_target(mavlink_common_generate DEPENDS ${MAVLINK_LIBRARY_DIR}/common/common.h)
add_library(mavlink_common_headers INTERFACE)
add_dependencies(mavlink_common_headers mavlink_common_generate)
target_compile_options(mavlink_common_headers INTERFACE -Wno-address-of-packed-member -Wno-cast-align)
target_include_directories(mavlink_common_headers INTERFACE
${MAVLINK_LIBRARY_DIR}
${MAVLINK_LIBRARY_DIR}/common
)
# Add custom drivers for SLPI
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/rc_controller rc_controller)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/mavlink_rc_in mavlink_rc_in)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/spektrum_rc spektrum_rc)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/ghst_rc ghst_rc)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/dsp_hitl dsp_hitl)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/dsp_sbus dsp_sbus)
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/elrs_led elrs_led)
elseif("${PX4_PLATFORM}" STREQUAL "posix")
# Add custom drivers
add_subdirectory(${PX4_BOARD_DIR}/src/drivers/posix/apps_sbus apps_sbus)
# Add custom libraries
add_subdirectory(${PX4_BOARD_DIR}/src/lib/mpa mpa)
# Add custom modules
add_subdirectory(${PX4_BOARD_DIR}/src/modules/voxl_save_cal_params voxl_save_cal_params)
add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_air_data_bridge vehicle_air_data_bridge)
add_subdirectory(${PX4_BOARD_DIR}/src/modules/sensor_baro_bridge sensor_baro_bridge)
add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_local_position_bridge vehicle_local_position_bridge)
endif()
+35 -10
View File
@@ -42,21 +42,44 @@
#define CONFIG_BOARDCTL_RESET
#define BOARD_HAS_NO_BOOTLOADER
// Define this as empty since i2c clock init isn't required
#define BOARD_I2C_BUS_CLOCK_INIT
/*
* I2C buses
*/
#define CONFIG_I2C 1
#define PX4_NUMBER_I2C_BUSES 1
/*
* SPI buses
* SPI buses (shared)
*/
#define CONFIG_SPI 1
#define BOARD_SPI_BUS_MAX_BUS_ITEMS 1
#ifdef __PX4_QURT
/*
* QURT (DSP) specific defines
*/
#define CONFIG_I2C 1
#define PX4_NUMBER_I2C_BUSES 4
#include <system_config.h>
#include <px4_platform_common/board_common.h>
#define VOXL_ESC_DEFAULT_PORT "2"
#define GHST_RC_DEFAULT_PORT "7"
#define VOXL2_IO_DEFAULT_PORT "2"
/* M0065 PWM */
#define DIRECT_PWM_OUTPUT_CHANNELS 4
#define MAX_IO_TIMERS 3
#endif /* __PX4_QURT */
#if defined(__PX4_POSIX) && !defined(__PX4_QURT)
/*
* POSIX (apps processor) specific defines
*/
/* I2C clock init not required on Linux */
#define BOARD_I2C_BUS_CLOCK_INIT
#define CONFIG_I2C 1
#define PX4_NUMBER_I2C_BUSES 1
#include <system_config.h>
#include <px4_platform_common/board_common.h>
@@ -65,3 +88,5 @@
#define VOXL_ESC_DEFAULT_PORT "2"
#define VOXL2_IO_DEFAULT_PORT "2"
#endif /* __PX4_POSIX && !__PX4_QURT */
+6 -1
View File
@@ -86,7 +86,7 @@ if("${CMAKE_SYSTEM}" MATCHES "Linux")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "PX4 autopilot")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_SECTION "misc")
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
# autogenerate dependency information
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
@@ -97,4 +97,9 @@ else()
set(CPACK_GENERATOR "ZIP")
endif()
# Board-specific overrides (loaded after defaults are set)
if(EXISTS "${PX4_BOARD_DIR}/cmake/package.cmake")
include(${PX4_BOARD_DIR}/cmake/package.cmake)
endif()
include(CPack)
+1
View File
@@ -476,6 +476,7 @@
- [Flight Controller Porting Guide](hardware/porting_guide.md)
- [PX4 Board Configuration (kconfig)](hardware/porting_guide_config.md)
- [NuttX Board Porting Guide](hardware/porting_guide_nuttx.md)
- [Board Firmware Packaging (.deb)](hardware/board_packaging.md)
- [Serial Port Mapping](hardware/serial_port_mapping.md)
- [Airframes](dev_airframes/index.md)
- [Adding a New Airframe](dev_airframes/adding_a_new_frame.md)
+298
View File
@@ -0,0 +1,298 @@
# Board Firmware Packaging
PX4 supports building distributable firmware packages for Linux-based (POSIX) boards.
While NuttX boards produce `.px4` firmware files that are flashed via QGroundControl, POSIX boards can produce `.deb` (Debian) packages that are installed using standard Linux package management tools (`dpkg`, `apt`).
This page covers how manufacturers can add `.deb` packaging to their boards, with examples for both single-processor and multi-processor architectures.
## Overview
The packaging framework uses [CMake CPack](https://cmake.org/cmake/help/latest/module/CPack.html) with the DEB generator.
It is built on two extension points in the PX4 build system:
- **`boards/<vendor>/<board>/cmake/package.cmake`**: CPack variable overrides (package name, version, dependencies, architecture, maintainer info). Loaded during CMake configure.
- **`boards/<vendor>/<board>/cmake/install.cmake`**: `install()` rules that define what goes into the package (binaries, scripts, config files, service files). Loaded from `platforms/posix/CMakeLists.txt` where build targets are available.
When a board provides these files, CI automatically discovers and builds the `_deb` target alongside the normal firmware build.
## Build Command
For any board with packaging support:
```sh
make <vendor>_<board>_deb
```
For example:
```sh
make modalai_voxl2_deb
```
This builds the `_default` configuration (and any companion builds for multi-processor boards), then runs `cpack -G DEB` in the build directory.
The resulting `.deb` file is placed in `build/<vendor>_<board>_default/`.
## Adding Packaging to a Board
### File Structure
```
boards/<vendor>/<board>/
cmake/
package.cmake # CPack configuration (required)
install.cmake # Install rules (required)
debian/
postinst # Post-install script (optional)
prerm # Pre-remove script (optional)
<name>.service # Systemd unit file (optional)
```
### Step 1: CPack Configuration (package.cmake)
This file sets CPack variables that control the `.deb` metadata.
It is included from `cmake/package.cmake` after the base CPack defaults are configured.
```cmake
# boards/<vendor>/<board>/cmake/package.cmake
# Derive Debian-compatible version from git tag
# v1.17.0-alpha1-42-gabcdef -> 1.17.0~alpha1.42.gabcdef
# v1.17.0 -> 1.17.0
string(REGEX REPLACE "^v" "" _deb_ver "${PX4_GIT_TAG}")
string(REGEX REPLACE "-" "~" _deb_ver "${_deb_ver}")
string(REGEX REPLACE "~([0-9]+)~" ".\\1." _deb_ver "${_deb_ver}")
# Target architecture (use the target arch, not the build host)
set(CPACK_DEBIAN_ARCHITECTURE "arm64")
# Package identity
set(CPACK_DEBIAN_PACKAGE_NAME "my-px4-board")
set(CPACK_DEBIAN_FILE_NAME "my-px4-board_${_deb_ver}_arm64.deb")
# Install prefix
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
set(CPACK_INSTALL_PREFIX "/usr")
set(CPACK_SET_DESTDIR true)
# Package metadata
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "PX4 Autopilot for My Board")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Vendor <support@vendor.com>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "some-dependency (>= 1.0)")
set(CPACK_DEBIAN_PACKAGE_CONFLICTS "")
set(CPACK_DEBIAN_PACKAGE_REPLACES "")
# Disable shlibdeps for cross-compiled boards
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
# Include post-install and pre-remove scripts (optional)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${PX4_BOARD_DIR}/debian/postinst;${PX4_BOARD_DIR}/debian/prerm")
```
**Key variables:**
| Variable | Purpose |
|---|---|
| `CPACK_DEBIAN_ARCHITECTURE` | Target architecture. Set explicitly for cross-compiled boards since `dpkg --print-architecture` reports the build host, not the target. |
| `CPACK_DEBIAN_PACKAGE_NAME` | Package name as it appears in `dpkg -l`. |
| `CPACK_DEBIAN_FILE_NAME` | Output `.deb` filename. |
| `CPACK_DEBIAN_PACKAGE_DEPENDS` | Runtime dependencies (comma-separated, Debian format). |
| `CPACK_DEBIAN_PACKAGE_SHLIBDEPS` | Set to `OFF` for cross-compiled boards where `dpkg-shlibdeps` cannot inspect target binaries. |
### Step 2: Install Rules (install.cmake)
This file defines what files are packaged in the `.deb`.
It is included from `platforms/posix/CMakeLists.txt` where the `px4` build target is available.
All paths are relative to `CPACK_PACKAGING_INSTALL_PREFIX` (typically `/usr`). Use `../` to install outside the prefix (e.g., `../etc/` installs to `/etc/`).
**Minimal example (single-processor board):**
```cmake
# boards/<vendor>/<board>/cmake/install.cmake
# PX4 binary
install(TARGETS px4 RUNTIME DESTINATION bin)
# Module alias script (generated during build)
install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/px4-alias.sh DESTINATION bin)
# Startup scripts
install(PROGRAMS
${PX4_BOARD_DIR}/target/my-px4-start
DESTINATION bin
)
# Configuration files
install(FILES
${PX4_BOARD_DIR}/target/my-config.conf
DESTINATION ../etc/my-board
)
# Systemd service
install(FILES ${PX4_BOARD_DIR}/debian/my-px4.service
DESTINATION ../etc/systemd/system
)
# Component metadata
install(FILES
${PX4_BINARY_DIR}/actuators.json.xz
${PX4_BINARY_DIR}/parameters.json.xz
DESTINATION ../data/px4/etc/extras
OPTIONAL
)
install(FILES ${PX4_BINARY_DIR}/events/all_events.json.xz
DESTINATION ../data/px4/etc/extras
OPTIONAL
)
```
### Step 3: Debian Scripts (optional)
#### postinst
Runs after the package is installed. Common tasks:
- Create `px4-*` module symlinks from `px4-alias.sh`
- Set up required directories with correct ownership
- Run `systemctl daemon-reload` to pick up the service file
- Board-specific setup (e.g., DSP signature generation)
```bash
#!/bin/bash
set -e
# Create px4-* symlinks
if [ -f /usr/bin/px4-alias.sh ]; then
grep "^alias " /usr/bin/px4-alias.sh | \
sed "s/alias \(px4-[a-zA-Z0-9_]*\)=.*/\1/" | while read cmd; do
ln -sf px4 "/usr/bin/${cmd}"
done
fi
# Create data directories
mkdir -p /data/px4/param
mkdir -p /data/px4/etc/extras
# Reload systemd
if command -v systemctl > /dev/null 2>&1; then
systemctl daemon-reload
fi
```
#### prerm
Runs before the package is removed:
```bash
#!/bin/bash
set -e
# Stop the service
if command -v systemctl > /dev/null 2>&1; then
systemctl stop my-px4 2>/dev/null || true
fi
# Remove px4-* symlinks
for f in /usr/bin/px4-*; do
if [ -L "$f" ] && [ "$(readlink "$f")" = "px4" ]; then
rm -f "$f"
fi
done
```
Both scripts must be executable (`chmod +x`).
## Multi-Processor Boards
Some boards run PX4 across multiple processors, for example the ModalAI VOXL2 which has a POSIX apps processor (ARM) and a Hexagon DSP (SLPI).
These produce two separate CMake builds, but the `.deb` must contain artifacts from both.
### How It Works
1. The `_default` build (POSIX/apps processor) owns the `.deb`.
2. The Makefile `%_deb` target builds `_default`, which chains any companion builds as CMake prerequisites.
3. The `install.cmake` pulls companion build artifacts via absolute path to the sibling build directory.
4. CPack runs in the `_default` build tree and produces a single `.deb`.
### Companion Build Artifacts
In `install.cmake`, reference the companion build output by absolute path:
```cmake
# DSP firmware blob from companion SLPI build
set(SLPI_BUILD_DIR "${PX4_SOURCE_DIR}/build/<vendor>_<board>-slpi_default")
install(FILES ${SLPI_BUILD_DIR}/platforms/qurt/libpx4.so
DESTINATION lib/rfsa/adsp
OPTIONAL
)
```
The `OPTIONAL` keyword allows the `.deb` to build even when the companion build hasn't run (useful for development/testing of just the apps-processor side).
### VOXL2 Reference
The VOXL2 board is a complete working example of multi-processor packaging:
```
boards/modalai/voxl2/
cmake/
package.cmake # CPack config: voxl-px4, arm64, deps, shlibdeps off
install.cmake # px4 binary, SLPI libpx4.so, scripts, configs, metadata
debian/
postinst # Symlinks, DSP signature, directory setup
prerm # Stop service, remove symlinks
voxl-px4.service # Systemd unit (after sscrpcd, restart on-failure)
target/
voxl-px4 # Main startup wrapper
voxl-px4-start # PX4 module startup script
```
The resulting `.deb` installs:
| Path | Contents |
|---|---|
| `/usr/bin/px4` | Apps processor PX4 binary |
| `/usr/bin/px4-alias.sh` | Module alias script |
| `/usr/bin/voxl-px4` | Startup wrapper |
| `/usr/bin/voxl-px4-start` | Module startup script |
| `/usr/lib/rfsa/adsp/libpx4.so` | DSP firmware (from SLPI build) |
| `/etc/modalai/*.config` | Board configuration files |
| `/etc/systemd/system/voxl-px4.service` | Systemd service |
| `/data/px4/etc/extras/*.json.xz` | Component metadata |
## CI Integration
### Automatic Discovery
The CI system (`Tools/ci/generate_board_targets_json.py`) automatically discovers boards with `cmake/package.cmake` and adds a `<vendor>_<board>_deb` target to the board's existing CI group.
No manual CI configuration is needed.
### Artifact Collection
The `Tools/ci/package_build_artifacts.sh` script collects `.deb` files alongside `.px4` and `.elf` artifacts.
On tagged releases, `.deb` files are uploaded to both S3 and GitHub Releases.
## Version Format
The `.deb` version is derived from `PX4_GIT_TAG` using Debian-compatible formatting:
| Git Tag | Debian Version | Notes |
|---|---|---|
| `v1.17.0` | `1.17.0` | Stable release |
| `v1.17.0-beta1` | `1.17.0~beta1` | Pre-release (`~` sorts before release) |
| `v1.17.0-alpha1-42-gabcdef` | `1.17.0~alpha1.42.gabcdef` | Development build |
The `~` prefix in Debian versioning ensures pre-releases sort lower than the final release: `1.17.0~beta1 < 1.17.0`.
## Checklist for New Boards
1. Create `boards/<vendor>/<board>/cmake/package.cmake` with CPack variables
2. Create `boards/<vendor>/<board>/cmake/install.cmake` with install rules
3. (Optional) Create `boards/<vendor>/<board>/debian/postinst` and `prerm`
4. (Optional) Create `boards/<vendor>/<board>/debian/<name>.service`
5. Test locally: `make <vendor>_<board>_deb`
6. Verify: `dpkg-deb --info build/<vendor>_<board>_default/<name>_*.deb`
7. Verify: `dpkg-deb --contents build/<vendor>_<board>_default/<name>_*.deb`
8. CI picks it up automatically on the next push
+9 -1
View File
@@ -80,7 +80,8 @@ target_link_libraries(px4 PRIVATE uORB)
# install
#
# TODO: extend to snapdragon
# Generic install rules (skipped when board provides its own install.cmake)
if(NOT EXISTS "${PX4_BOARD_DIR}/cmake/install.cmake")
# px4 dirs
install(
@@ -94,6 +95,8 @@ install(
USE_SOURCE_PERMISSIONS
)
endif() # NOT board install.cmake
# Module Symlinks
px4_posix_generate_symlinks(
MODULE_LIST ${module_libraries}
@@ -112,6 +115,11 @@ if(EXISTS "${PX4_BOARD_DIR}/cmake/upload.cmake")
include(${PX4_BOARD_DIR}/cmake/upload.cmake)
endif()
# board defined install rules for .deb packaging
if(EXISTS "${PX4_BOARD_DIR}/cmake/install.cmake")
include(${PX4_BOARD_DIR}/cmake/install.cmake)
endif()
# board defined link libraries
if(EXISTS "${PX4_BOARD_DIR}/cmake/link_libraries.cmake")
include(${PX4_BOARD_DIR}/cmake/link_libraries.cmake)