OpenTX 2.2 Linux Build Instructions - stodev-com-br/opentx GitHub Wiki
See also Companion 2.1 Linux Build Instructions
And/Or OpenTX 2.2 Build With QtCreator (Win Linux OSX)
The document below is meant to help you develop or test changes to OpenTx on your PC, not to build flight/radio safe version of binaries. Given the nature of arm/avr gcc compilers, the binary results are not always consistent depending on the version used. The only version that can be considered field tested are the ones used by the compilation server, which can be found here : https://github.com/opentx/opentx/blob/2.2/radio/util/Dockerfile
OpenTX 2.2 uses cmake for all parts of the project (radio firmware and Companion).
gcc-arm-none-eabi has been updated to version 6.3.1 and seems to be incompatible with opentx (compilation ok but radio not turn on after flash firmware). You need to revert to version 4.7.2. You can use instruction in topic OpenTX 2.1 Linux Build Instructions to install older gcc-arm-none-eabi.
The command listed here will install all packages that are needed to build OpenTX Companion and firmware for all radios. You can run this command from the fresh Ubuntu 16.04 or Linux Mint 18.x installation or any other already used system based on Ubuntu 16.04.
sudo apt-get install cmake gcc gcc-avr avr-libc build-essential \
libfox-1.6-dev libsdl1.2-dev python-pyqt5 \
qt5-default qttools5-dev-tools qtmultimedia5-dev qttools5-dev libqt5svg5-dev \
gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
From 2.2.2 on, python-pyqt5
is not needed anymore, but the package python-pil
is needed instead. This installs the PIL fork called Pillow, which is used now for image manipulations during firmware build.
So here is the new command to be used:
sudo apt-get install cmake gcc gcc-avr avr-libc build-essential \
libfox-1.6-dev libsdl1.2-dev \
qt5-default qttools5-dev-tools qtmultimedia5-dev qttools5-dev libqt5svg5-dev \
gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib \
python-pil
Optionally install also these packages to get ability to make Google tests and use OpenTX Git repository:
sudo apt-get install git libgtest-dev
For flashing firmware OpenTX needs dfu-util version 0.9 which is not available in Ubuntu 16.04 or older versions. To build dfu-util use these commands:
sudo apt-get install libusb-1.0-0-dev
wget http://dfu-util.sourceforge.net/releases/dfu-util-0.9.tar.gz
tar xzvf dfu-util-0.9.tar.gz
cd dfu-util-0.9/
./configure
make
src/dfu-util
sudo make install
Test:
dfu-util --version
should output:
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
sudo apt-get install qt5-default qttools5-dev-tools qtmultimedia5-dev qttools5-dev
sudo apt-get install python3-pyside.qtwebkit
sudo pacman -S qt5 fox gtest
dnf install git gcc svn qt qt-devel cmake patch xsd gcc-c++ SDL-devel \
phonon phonon-devel avr-gcc-c++ avr-gcc avr-binutils arm-none-eabi-binutils-cs \
arm-none-eabi-gcc-cs arm-none-eabi-gcc-cs-c++ arm-none-eabi-newlib.noarch \
avr-binutils avr-gcc avr-gcc-c++ avr-libc.noarch PyQt4 fox-devel qt5 \
qt5-qtmultimedia-devel qt5-devel.noarch qt5-qtsvg-devel qt5-qttools-devel dfu-util
git clone --recursive -b 2.2 https://github.com/opentx/opentx.git
- create a new folder inside
opentx
folder (which contains folderscompanion
,radio
) - move into that folder and execute cmake configuration command with appropriate options
- run make, optionally defining which target(s) to build
Short example for Taranis Plus radio:
$ cd opentx
opentx $ mkdir build-taranis-debug && cd $_
opentx/build-taranis-debug $ cmake -DPCB=X9D+ -DGVARS=YES -DLUA=YES -DDEBUG=YES -DCMAKE_BUILD_TYPE=Debug ../
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- OpenTX 2.2.0
-- Looking for SDL
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
SDL Include Path: /usr/include/SDL
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
USING -std=gnu++11
WARNING: can't find gtests source, gtest target will not be available!
-- Looking for QT lupdate
-- /usr/bin/lupdate
QT lupdate: /usr/bin/lupdate
-- Configuring done
-- Generating done
-- Build files have been written to: opentx/build-taranis-debug
Build firmware for the radio:
opentx/build-taranis-debug $ make firmware
Build Companion and simulator:
opentx/build-taranis-debug $ make libsimulator && make companion22
Flash the radio with dfu-util (and build firmware if necessary):
opentx/build-taranis-debug $ make flash
To see the actual commands that are executed by make use VERBOSE=1
parameter with make
command:
opentx/build-taranis-debug $ make firmware VERBOSE=1
CMake remembers (caches) all options, therefore this:
$ cmake -DPCB=X9D ../
$ cmake -DLUA=YES ../
$ cmake -DLUA=NO ../
is equivalent to:
cmake -DPCB=X9D -DLUA=NO
To see all available CMake options use:
$ cmake -LH ../
If you have problems building - try a fresh checkout. compiling 2.1 leaves files that mess 2.2 build.