# Build the TerraHawk flight controller firmware in ArduPilot's Docker image. # ARDUPILOT must be a checkout with submodules that nothing else is using (never the SITL tree). ARDUPILOT ?= # Pinned by digest (Ryan, 2026-10-03: tracked builds). This is the image :latest named on 2026-06-25; a tag # can move to a new compiler without notice. SITL uses the same digest through mcardupilot. IMAGE ?= ardupilot/ardupilot-dev-chibios@sha256:8bb0f850fb3fe1c170cb12dd577ab64f3708be8a828f9eafd28d73559766e81f BOARD := TerraHawkFC HERE := $(abspath .) .PHONY: hwdef firmware lux-firmware clean hwdef: ## Regenerate the hwdef from the Pixhawk6C hwdef in $(ARDUPILOT) @test -n "$(ARDUPILOT)" || { echo "set ARDUPILOT="; exit 1; } uv run --no-project python make_hwdef.py "$(ARDUPILOT)" firmware: hwdef ## Build bootloader and ArduPlane, outputs in build/ rm -rf "$(ARDUPILOT)/libraries/AP_HAL_ChibiOS/hwdef/$(BOARD)" cp -r hwdef/$(BOARD) "$(ARDUPILOT)/libraries/AP_HAL_ChibiOS/hwdef/" docker run --rm -v "$(ARDUPILOT)":"$(ARDUPILOT)" -w "$(ARDUPILOT)" -u "$$(id -u):$$(id -g)" -e HOME=/tmp $(IMAGE) \ bash -c 'git config --global --add safe.directory "*" && Tools/scripts/build_bootloaders.py $(BOARD) && ./waf configure --board $(BOARD) && ./waf plane' mkdir -p build cp "$(ARDUPILOT)/build/$(BOARD)/bin/arduplane.apj" "$(ARDUPILOT)/build/$(BOARD)/bin/arduplane_with_bl.hex" build/ cp "$(ARDUPILOT)/Tools/bootloaders/$(BOARD)_bl.bin" build/ @ls -la build/ lux-firmware: ## ArduPlane for the stock LUX F765 NDAA with QAUTOTUNE on (lux-qautotune.hwdef); outputs in build/lux/ @test -n "$(ARDUPILOT)" || { echo "set ARDUPILOT="; exit 1; } docker run --rm -v "$(ARDUPILOT)":"$(ARDUPILOT)" -v "$(HERE)":"$(HERE)":ro -w "$(ARDUPILOT)" -u "$$(id -u):$$(id -g)" -e HOME=/tmp $(IMAGE) \ bash -c 'git config --global --add safe.directory "*" && ./waf configure --board LumenierLUXF765-NDAA --extra-hwdef="$(HERE)/lux-qautotune.hwdef" && ./waf plane' mkdir -p build/lux cp "$(ARDUPILOT)/build/LumenierLUXF765-NDAA/bin/arduplane.apj" "$(ARDUPILOT)/build/LumenierLUXF765-NDAA/bin/arduplane_with_bl.hex" build/lux/ @ls -la build/lux/ clean: rm -rf build