Building ArduPilot for Pixhawk/PX4 on Windows with Make

This article shows how to build ArduPilot for Pixhawk 2, Pixhawk and PX4 on Windows with Make.


The commands for building Pixhawk and Pixhawk2 are identical (make px4-v2). Building for Pixracer is the same except make px4-v4 is used. For the older (obsolete) PX4 use make px4-v1.

Build instructions

  1. Install GitHub for Windows

  2. Ensure your github settings are set to leave line endings untouched.

    • The “Git Shell (or Bash)” terminal was also installed when you installed Git. Click on your new “Git Shell (or Bash)” Icon and type in the following in the Git “MINGW32” Terminal window:

      git config --global core.autocrlf false
  3. Clone the ardupilot repository onto your machine:

    • Go to the GitHub/ArduPilot/ardupilot web page and click the Clone in Desktop button
    • Warning: be careful that the directory path is less than about 50 characters. For example “C:\Users\rmackay9\Documents\GitHub\ardupilot” is short enough but “C:\Users\rmackay9\Documents\GitHub\rmackay9-ardupilot” is too long. This limit is because during compiling temporary files are created with much much longer paths which can exceed Windows’ 260 character path limit.

Initialise and update submodules

git submodule update --init --recursive

Download and install the PX4 toolchain by running the pixhawk_toolchain_installer_latest.exe

Open the PX4Console and navigate to the target vehicle directory:

  • Start the PX4Console. This can be found under Start | All Programs | PX4 Toolchain (Windows 7 machine) or you can directly run C:\px4\toolchain\msys\1.0\px4_console.bat

  • Navigate to the vehicle-specific ArduPilot directory in the PX4Console. For example, to build Copter, navigate to:

    cd /c/Users/<username>/Documents/GitHub/ardupilot/ArduCopter

Build the firmware by entering one of the following commands:

make px4-v2 Build the Pixhawk/Pixhawk2 firmware (identical) for a quad
make px4-v4 Build the PixRacer firmware for quad
make px4-v2-hexa

Build the Pixhawk firmware for a hexacopter.

# Other supported suffixes include “octa”, “octa-quad, “tri”, “single” and “heli”.

# More can be found in “mk/” under FRAMES

make px4 Build both PX4 (obsolete) and PixHawk firmware for a quadcopter
make clean “clean” the ardupilot directory
make px4-clean “clean” the PX4Firmware and PX4NuttX directories so the next build will completely rebuild them
make px4-cleandep “clean” .d and .o files from the PX4Firmware and PX4NuttX directories. faster but less complete rebuild compared to “px4-clean”
make px4-v2-upload Build and upload the Pixhawk firmware for a quad (i.e. no need to upload using a ground station)

The firmware will be created in the ArduCopter directory with the .px4 file extension.

  • Upload the firmware using the Mission Planner Initial Setup | Install Firmware screen’s Load custom firmware link


ArduPilot imports addition projects (PX4Firmware, PX4NuttX, uavcan) as git submodules when you build the project. If you built the project before the change to submodules you may get errors. See Git Submodules for troubleshooting information.


You can ignore any mesages regarding PX4Firmware and PX4Nuttx hashes. Those are useful labels for developers but optional and sometimes the build system can’t find them on your system. As long as it says “Firmware is in..” followed by a .px4 file then you have a successful build which you can safely load onto your aircraft.

Hints for speeding up compile time

Anti virus protection is likely to slow the compile times especially for PX4 so it is recommended that the folders containing the ArduPilot source code is excluded from your virus protections real-time scan.

The first scan after a make px4-clean will be very slow as it rebuilds everything