Building OpenTX on Gentoo

I just got a Turnigy 9XR radio for a new quadcopter. I had been thinking about the Parrot Beebop, but I decided that I wanted a grown-up quad, so I got the AeroQuad Cyclone kit instead.

Now, the reason I bought the Turnigy 9XR is that it has an ATmega on board with fully customizable firmware. It even has the standard Atmel ISP port for programming.

I setup my laptop to build one of the major FOSS firmwares out there, OpenTX. Building the firmware itself went fine. The tricky part was building Companion, which is basically a big GUI wrapper around avrdude for burning the firmware. I hit an error that I couldn’t quite figure out:

$ make
[  1%] Generating /path/to/opentx/companion/src/../../radio/src/
Generating a list of Lua exported constants in lua_exports.txt
Parsing and generating C Lua exports in lua_exports.cpp
  File "../util/", line 28
    print "WARNING: Duplicate name %s found for constant %s" % (name, CONSTANT_VALUE)
SyntaxError: invalid syntax

This turned out to be because my Gentoo system was setup with python3.3 to be hit by default, and the code above is still on python2.7. I still had a build of 2.7 available, though, so it was an easy matter of switching:

$ eselect python list
Available Python interpreters:
  [1]   python2.7
  [2]   python3.2
  [3]   python3.3 *
$ sudo eselect python set python2.7

Then follow the rest of the Companion build instructions, and switch it back to python3.3 when you’re done.