Building ArduPilot on Windows with waf and Bash¶
This build method is ONLY for Windows10 x64 and does not describe building for deprecated Arduino based flight controllers (APM1.x, 2.x). It supports most users, however you may need or prefer to use the alternate windows build process here: http://ardupilot.org/dev/docs/building-px4-with-make.html
Microsoft has introduced WSL - the Windows Subsystem for Linux - into Windows 10. This tutorial describes “Bash on Ubuntu on Windows”, as it is currently the only released distribution supported by WSL. Other Linux distributions, such as Fedora, are likely to be available in the future however will require slightly different setup to compile Ardupilot.
This tutorial is intended to be a “copy & paste” guide. Just follow the process step by step and be patient with yourself!
To install “Bash on Ubuntu on Windows” there are many tutorials on the web. An example is here: <http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/>`__.
Setup Ardupilot Dev Enviromment for Ubuntu bash on Windows 10¶
First, you have to insert your local host to the /etc/hosts file:
sudo nano /etc/hosts
Insert this below first line:
(where “hostname” is your PC name)
Then, take root control over the terminal:
sudo passwd root su root
Back to main directory:
sudo apt-get install git
Make a new folder for future reference (optional):
mkdir GitHub cd GitHub
Clone ardupilot git:
git clone https://github.com/ArduPilot/ardupilot.git
Run the install-prereqs-ubuntu.sh script:
We also need to install some extra tools, so we can compile for the various Ardupilot targets:
cd sudo add-apt-repository ppa:george-edison55/cmake-3.x -y sudo apt-get update sudo apt-get install cmake sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install g++-4.9 sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded sudo apt-get update sudo apt-get install gcc-arm-none-eabi=220.127.116.115q3-1trusty1 sudo apt-get update sudo apt-get upgrade
Compile ArduPilot Code¶
“Waf” is the preferred build tool for Ardupilot, and works well in Windows with Ubuntu Bash. Go to git ardupilot software:
cd cd GitHub/ardupilot/
It’s possible to get a list of supported boards on ArduPilot with the command below:
Configure your board:
./waf configure --board target
(where “target” can be px4-v2, navio, pxf,... choose from supported boards as mentioned above)
Compile for your target:
(where “vehicle” can be copter, plane, rover,...)
And here you are! You have compiled your code!
The released WSL does not have access to USB serial peripherals, so the –upload option in waf will not work over USB. The compiled binary must be uploaded to your flight controller using another tool, such as MissionPlanner as a “Custom Firmware”. If you wish to upload via waf, at time of writing USB serial access is only available in the Windows Insider releases of Windows Subsystem for Linux (WSL), which requires you to join the Windows Insider program. https://insider.windows.com/GettingStarted For network connected flight controllers, such as linux targets, –upload does function as described here: https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md
if you want to unhide Ubuntu system folder on Windows, open a command prompt as administrator, navigate to Ubuntu system path (C:UsersusernameAppDataLocal) and change the folder attributes. So (where “username” is your user name):
cd C:\Users\username\AppData\Local attrib -s -h lxss
You can make a direct access to “lxss” folder on your desktop for a quick navigation.