From 170dfbbfe8fd75cfb6fc6566f561c8169ea3e4b3 Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Mon, 23 Nov 2026 12:13:55 -0800 Subject: [PATCH] build(px4io): build IO firmware from source, drop committed binaries Boards with a px4io took the IO firmware from a binary committed under boards//io-v2/extras/. It had to be regenerated by hand with "make px4io_update" whenever px4iofirmware, lib/rc, the IO board or NuttX changed, and a CI job failed until it was. Build it from source instead. A target with CONFIG_BOARD_IO set now builds that IO target as part of its own build and puts the result in its ROMFS. NuttX builds inside its source tree, so the IO build gets its own copy of the NuttX sources in build/px4io//, shared by every target built in the checkout. The IO build runs on every build of the embedding target, so an IO source change reaches the ROMFS without a clean. PX4_NUTTX_TREE_DIR points a NuttX build at such a copy, and the hardcoded platforms/nuttx/NuttX/{nuttx,apps} paths now go through NUTTX_DIR and NUTTX_APPS_DIR. Remove the two committed binaries, the px4io_update and check_px4io make targets, and the CI job that compared them. Assisted-by: Claude:claude-fable-5-2 --- .github/workflows/checks.yml | 21 --- Makefile | 21 --- ROMFS/CMakeLists.txt | 47 ++++-- Tools/ci/package_build_artifacts.py | 6 +- Tools/ci/test_package_build_artifacts.py | 2 + .../io-v2/extras/cubepilot_io-v2_default.bin | Bin 43268 -> 0 bytes boards/px4/io-v2/extras/px4_io-v2_default.bin | Bin 43488 -> 0 bytes platforms/common/CMakeLists.txt | 4 +- platforms/nuttx/CMakeLists.txt | 8 +- platforms/nuttx/NuttX/CMakeLists.txt | 6 +- platforms/nuttx/cmake/init.cmake | 17 ++- platforms/nuttx/cmake/px4_impl_os.cmake | 14 +- .../nuttx/cmake/px4io_firmware_build.cmake | 142 ++++++++++++++++++ 13 files changed, 217 insertions(+), 71 deletions(-) delete mode 100755 boards/cubepilot/io-v2/extras/cubepilot_io-v2_default.bin delete mode 100755 boards/px4/io-v2/extras/px4_io-v2_default.bin create mode 100644 platforms/nuttx/cmake/px4io_firmware_build.cmake diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 22ed6297ec5..d2098cb06f6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -48,27 +48,6 @@ jobs: PX4_SBOM_DISABLE: 1 run: make ${{ matrix.check }} - # The committed px4io firmware binaries must match what the current sources build to. - # The build is reproducible with a fixed toolchain, so a mismatch means a dependency - # changed without "make px4io_update", and the job fails. - px4io_firmware: - name: IO Firmware Up To Date - runs-on: [runs-on,runner=2cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] - container: - image: ghcr.io/px4/px4-dev:v1.17.0-rc2 - steps: - - uses: runs-on/action@v2 - - uses: actions/checkout@v6 - with: - fetch-depth: 1 - - name: Configure Git Safe Directory - run: git config --system --add safe.directory '*' - - - name: Build and compare px4io firmware - env: - PX4_SBOM_DISABLE: 1 - run: make check_px4io - tests: name: Unit Tests runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false,extras=s3-cache] diff --git a/Makefile b/Makefile index 5f738a4c5f6..38ba2eb9835 100644 --- a/Makefile +++ b/Makefile @@ -335,27 +335,6 @@ uorb_graphs: @$(MAKE) --no-print-directory px4_fmu-v6x_default uorb_graph @$(MAKE) --no-print-directory px4_sitl_default uorb_graph -# The px4io firmware is committed once per IO board and embedded into the ROMFS of every -# board with CONFIG_BOARD_IO set. The build is reproducible, but only with the same -# toolchain, so regenerate it in the px4-dev image used by the check_px4io CI job -# (.github/workflows/checks.yml): -# PX4_DOCKER_REPO= ./Tools/docker_run.sh 'make px4io_update' -.PHONY: px4io_build px4io_update check_px4io - -px4io_build: - @$(MAKE) --no-print-directory px4_io-v2_default - @$(MAKE) --no-print-directory cubepilot_io-v2_default - -px4io_update: px4io_build - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/io-v2/extras/ - cp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/io-v2/extras/ - -# compares without touching the committed binaries -check_px4io: px4io_build - @cmp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/io-v2/extras/px4_io-v2_default.bin \ - && cmp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/io-v2/extras/cubepilot_io-v2_default.bin \ - || { echo "px4io firmware is out of date, regenerate it with 'make px4io_update' (see Makefile)"; exit 1; } - bootloaders_update: \ 3dr_ctrl-n1_bootloader \ 3dr_ctrl-zero-h7-oem-revg_bootloader \ diff --git a/ROMFS/CMakeLists.txt b/ROMFS/CMakeLists.txt index aac70d7e180..4312c3c1bed 100644 --- a/ROMFS/CMakeLists.txt +++ b/ROMFS/CMakeLists.txt @@ -297,25 +297,50 @@ foreach(board_extra_file ${OPTIONAL_BOARD_EXTRAS}) list(REMOVE_ITEM OPTIONAL_BOARD_EXTRAS ${board_extra_file}) endif() elseif(${extra_file_base_name} MATCHES "_io-v[0-9]+_default\\.bin$") - # px4io firmware is no longer kept per board, see CONFIG_BOARD_IO below + # px4io firmware is not kept in the tree, see CONFIG_BOARD_IO below file(RELATIVE_PATH extra_file_relative_source ${PX4_SOURCE_DIR} ${board_extra_file}) - message(FATAL_ERROR "Delete ${extra_file_relative_source}: the px4io firmware is now taken from " - "boards///extras/ via CONFIG_BOARD_IO and must not be kept per board.") + message(FATAL_ERROR "Delete ${extra_file_relative_source}: the px4io firmware is built from source " + "for CONFIG_BOARD_IO and must not be committed.") endif() endforeach() # px4io firmware (optional) -# - the binary is kept once per IO board, in boards///extras/.bin -# - regenerate it with "make px4io_update", CI checks it with "make check_px4io" +# - built from source for CONFIG_BOARD_IO, once per checkout, in build/px4io// +# - the build runs on every build of this target so that IO source changes reach the ROMFS, +# the ROMFS is only regenerated when the IO binary changed if(CONFIG_DRIVERS_PX4IO AND CONFIG_BOARD_IO) if(NOT CONFIG_BOARD_IO MATCHES "^([^_]+)_(.+)_([^_]+)$") message(FATAL_ERROR "BOARD_IO '${CONFIG_BOARD_IO}' is not of the form __