diff --git a/.github/workflows/build_all_targets.yml b/.github/workflows/build_all_targets.yml index 7c30d8bf244..dcaf4014f76 100644 --- a/.github/workflows/build_all_targets.yml +++ b/.github/workflows/build_all_targets.yml @@ -201,6 +201,14 @@ jobs: ccache -s ccache -z + - name: Install pynacl for secure-boot signing + # TODO: drop once the build container ships with pynacl preinstalled + # (currently pinned to v1.17.0-rc2 in Tools/ci/build_all_config.yml). + # Modern containers enforce PEP 668 and need --break-system-packages; + # older ones (e.g. voxl2) ship a pip that doesn't know the flag and + # don't need it either, so fall back to plain pip install. + run: pip install pynacl --break-system-packages || pip install pynacl + - name: Building Artifacts for [${{ matrix.targets }}] run: | ./Tools/ci/build_all_runner.sh ${{matrix.targets}} ${{matrix.arch}} diff --git a/Kconfig b/Kconfig index 4bc076893a0..ef5975132c5 100644 --- a/Kconfig +++ b/Kconfig @@ -143,6 +143,31 @@ config BOARD_CRYPTO 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 diff --git a/Makefile b/Makefile index f880ec91294..563b8d2f0ed 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,10 @@ endif # -------------------------------------------------------------------- # describe how to build a cmake config define cmake-build - $(eval override CMAKE_ARGS += -DCONFIG=$(1)) + # Strip BUILD_DIR_SUFFIX (e.g. _replay, _failsafe_web) from CONFIG so the + # board lookup in cmake/px4_config.cmake sees the bare __