Building ArduPilot

    Because building ArduPilot is a bit complicated, I've written a short script that uses Docker to build AP in a controlled environment.

    Copy it from here, save it to a file called in the root of the ArduPilot repo, and run it with <your board>. Output files will be stored in build/<yourboard>/bin/, and you can flash them with the INAV configurator by putting your board in DFU mode and uploading the arduplane_with_bl.hex file.

    Here's the script:

    #!/usr/bin/env bash
    set -euox pipefail
    if [ $# -ne 1 ]
        echo "No board supplied, run as ./ <board name> or ./ list"
        exit 1
    cd "$(git rev-parse --show-toplevel)"
    git submodule update --init --recursive
    git checkout Dockerfile
    echo "RUN pip install intelhex" >> Dockerfile
    echo 'ENV PATH="/home/ardupilot/.local/bin:/usr/lib/ccache:/ardupilot/Tools/autotest:${PATH}"' >> Dockerfile
    cat Dockerfile
    docker build . -t ardupilot
    git checkout Dockerfile
    # We need to update the PATH with the location of the ARM EABI inside the Docker
    # container, so we write a script that handles this and the actual building.
    cat <<EOF >
    #!/usr/bin/env bash
    set -euox pipefail
    export ARM_EABI=/opt/\$(ls -1 /opt/ | grep gcc-arm-none-eabi)/bin/
    export PATH=\$ARM_EABI:\$PATH
    ./waf configure --board="\$1"
    ./waf build
    chmod +x ./
    docker run --rm -it -v "$(pwd)":/ardupilot ardupilot ./ "$BOARD"

    Last updated on September 07, 2021. For any questions/feedback, email me at