From a88edf1abe9355d78d27ffe89a139e72a030a56b Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 18 Nov 2026 13:10:05 +1300 Subject: [PATCH] ci(px4io): keep one IO firmware binary per IO board and check it in CI The px4io firmware was committed as a copy in the extras of each of the 30 boards using it. "make px4io_update" only knew about 15 of them, so the copies drifted into 5 different versions, and none had been regenerated since 2024-03 despite changes to px4iofirmware, lib/rc and NuttX. Keep a single binary per IO board in boards///extras and let the ROMFS pick it via the existing CONFIG_BOARD_IO option, which every board with the px4io driver already sets (cubepilot boards override it). This also replaces the outdated per-board copies on boards that were missed by "make px4io_update". The IO build is reproducible with a fixed toolchain (verified across checkout paths and container vs host with the same GCC), so CI can rebuild it and compare. "make check_px4io" does that, and a new CI job turns a mismatch into a warning. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes --- .github/workflows/checks.yml | 40 ++++++++++++++++++ Makefile | 34 +++++++-------- ROMFS/CMakeLists.txt | 23 +++++++--- .../ga1/extras/px4_io-v2_default.bin | Bin 39796 -> 0 bytes .../fmu-v6xrt/extras/px4_io-v2_default.bin | Bin 39924 -> 0 bytes .../ark/fmu-v6x/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../fmu-v6xrt/extras/px4_io-v2_default.bin | Bin 39924 -> 0 bytes .../fmu-v6x/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../cuav/fmu-v6x/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../extras/cubepilot_io-v2_default.bin | Bin 39704 -> 0 bytes .../extras/cubepilot_io-v2_default.bin | Bin 39940 -> 0 bytes .../extras/cubepilot_io-v2_default.bin | Bin .../durandal-v1/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../pix32v5/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../mro/x21-777/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes boards/mro/x21/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../px4/fmu-v2/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../px4/fmu-v3/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../fmu-v4pro/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../px4/fmu-v5/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../px4/fmu-v5x/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../px4/fmu-v6c/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../px4/fmu-v6x/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../fmu-v6xrt/extras/px4_io-v2_default.bin | Bin 39924 -> 0 bytes .../io-v2}/extras/px4_io-v2_default.bin | Bin .../PIX6/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes boards/siyi/n7/extras/px4_io-v2_default.bin | Bin 40140 -> 0 bytes .../extras/px4_io-v2_default.bin | Bin 39952 -> 0 bytes .../svehicle/e2/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../thepeach/k1/extras/px4_io-v2_default.bin | Bin 40140 -> 0 bytes .../thepeach/r1/extras/px4_io-v2_default.bin | Bin 40140 -> 0 bytes .../ap-h743r1/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes .../zeroone/x6/extras/px4_io-v2_default.bin | Bin 40160 -> 0 bytes src/drivers/px4io/CMakeLists.txt | 27 +----------- 34 files changed, 73 insertions(+), 51 deletions(-) delete mode 100755 boards/accton-godwit/ga1/extras/px4_io-v2_default.bin delete mode 100755 boards/agam/fmu-v6xrt/extras/px4_io-v2_default.bin delete mode 100755 boards/ark/fmu-v6x/extras/px4_io-v2_default.bin delete mode 100755 boards/ark/fmu-v6xrt/extras/px4_io-v2_default.bin delete mode 100755 boards/auterion/fmu-v6x/extras/px4_io-v2_default.bin delete mode 100755 boards/cuav/fmu-v6x/extras/px4_io-v2_default.bin delete mode 100755 boards/cubepilot/cubeorangeplus/extras/cubepilot_io-v2_default.bin delete mode 100755 boards/cubepilot/cubeyellow/extras/cubepilot_io-v2_default.bin rename boards/cubepilot/{cubeorange => io-v2}/extras/cubepilot_io-v2_default.bin (100%) delete mode 100755 boards/holybro/durandal-v1/extras/px4_io-v2_default.bin delete mode 100755 boards/holybro/pix32v5/extras/px4_io-v2_default.bin delete mode 100755 boards/mro/x21-777/extras/px4_io-v2_default.bin delete mode 100755 boards/mro/x21/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v2/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v3/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v4pro/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v5/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v5x/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v6c/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v6x/extras/px4_io-v2_default.bin delete mode 100755 boards/px4/fmu-v6xrt/extras/px4_io-v2_default.bin rename boards/{ark/fmu-v6s => px4/io-v2}/extras/px4_io-v2_default.bin (100%) delete mode 100755 boards/radiolink/PIX6/extras/px4_io-v2_default.bin delete mode 100755 boards/siyi/n7/extras/px4_io-v2_default.bin delete mode 100755 boards/sky-drones/smartap-airlink/extras/px4_io-v2_default.bin delete mode 100644 boards/svehicle/e2/extras/px4_io-v2_default.bin delete mode 100755 boards/thepeach/k1/extras/px4_io-v2_default.bin delete mode 100755 boards/thepeach/r1/extras/px4_io-v2_default.bin delete mode 100644 boards/x-mav/ap-h743r1/extras/px4_io-v2_default.bin delete mode 100644 boards/zeroone/x6/extras/px4_io-v2_default.bin diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d2098cb06f6..3583325ce5d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -48,6 +48,46 @@ 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". This only warns, it does not fail the job. + 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: + # keep in sync with the image named in the warning below + 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 px4io firmware + env: + PX4_SBOM_DISABLE: 1 + run: make px4io_update + + - name: Compare with committed binaries + env: + PX4_SBOM_DISABLE: 1 + run: | + if ! make check_px4io; then + image="ghcr.io/px4/px4-dev:v1.17.0-rc2" + echo "::warning title=px4io firmware out of date::The committed px4io firmware does not match the current sources. Regenerate it with: PX4_DOCKER_REPO=${image} ./Tools/docker_run.sh 'make px4io_update'" + { + echo "### px4io firmware out of date" + echo + echo "The committed px4io firmware does not match what the current sources build to. Regenerate and commit it:" + echo + echo '```' + echo "PX4_DOCKER_REPO=${image} ./Tools/docker_run.sh 'make px4io_update'" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + fi + 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 e87790c93fd..c5d03b9cfba 100644 --- a/Makefile +++ b/Makefile @@ -335,27 +335,25 @@ 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_update check_px4io +PX4IO_FIRMWARE_BINS := \ + boards/px4/io-v2/extras/px4_io-v2_default.bin \ + boards/cubepilot/io-v2/extras/cubepilot_io-v2_default.bin + px4io_update: @$(MAKE) --no-print-directory px4_io-v2_default @$(MAKE) --no-print-directory cubepilot_io-v2_default - # px4_io-v2_default - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/ark/fmu-v6x/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/holybro/durandal-v1/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/holybro/pix32v5/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/mro/x21/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/mro/x21-777/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v2/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v3/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v4pro/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v5/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v5x/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v6x/extras/px4_io-v2_default.bin - cp build/px4_io-v2_default/px4_io-v2_default.bin boards/px4/fmu-v6c/extras/px4_io-v2_default.bin - # cubepilot_io-v2_default - cp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/cubeorange/extras/cubepilot_io-v2_default.bin - cp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/cubeorangeplus/extras/cubepilot_io-v2_default.bin - cp build/cubepilot_io-v2_default/cubepilot_io-v2_default.bin boards/cubepilot/cubeyellow/extras/cubepilot_io-v2_default.bin - git status + 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/ + +check_px4io: px4io_update + @git diff --exit-code --stat -- $(PX4IO_FIRMWARE_BINS) \ + || { echo "px4io firmware is out of date, regenerate it with 'make px4io_update' (see Makefile)"; exit 1; } bootloaders_update: \ 3dr_ctrl-n1_bootloader \ diff --git a/ROMFS/CMakeLists.txt b/ROMFS/CMakeLists.txt index 5401d548b49..0a2a870a77c 100644 --- a/ROMFS/CMakeLists.txt +++ b/ROMFS/CMakeLists.txt @@ -296,18 +296,27 @@ foreach(board_extra_file ${OPTIONAL_BOARD_EXTRAS}) # remove bootloader from 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: only the px4io driver can use it - if(NOT CONFIG_DRIVERS_PX4IO) - list(REMOVE_ITEM OPTIONAL_BOARD_EXTRAS ${board_extra_file}) - endif() 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" +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 __