-
Notifications
You must be signed in to change notification settings - Fork 3
Compiling Stratux on the Raspberry Pi 2
There are probably better ways to do this - cross compiling or running a Pi emulator on a 'real' computer, but this works for me and is faster than trying to figure out how to get a cross-compiling environment set up. If you have suggestions for a cross-compilation or other build environment, please post something.
You can install go from apt-get (the standard Debian / Raspbian package manager) but it installs a rather old version. I've been using a set of precompiled binaries from here: http://dave.cheney.net/unofficial-arm-tarballs
I've been using the ARMv7 multiarch build. To download that to your Pi, connect it to the Internet using the ethernet jack, then:
cd ~/
wget http://dave.cheney.net/paste/go1.4.2.linux-arm~multiarch-armv7-1.tar.gz
Next, extract it into /usr/local as follows:
sudo tar -C /usr/local -xzf go1.4.2.linux-arm~multiarch-armv7-1.tar.gz
Now you'll need to add the directory with the go binaries to your path. Use nano or vim to edit your .profile and add the path directive at the bottom:
cd ~/
nano .profile
Add the following text at the bottom:
export PATH=$PATH:/usr/local/go/bin
Here's a screenshot of the updated profile:
Now reload your profile using the 'source' command:
source ~/.profile
Finally, make sure go is properly installed with a quick test:
go --help
If everything is happy, this should result in some help text explaining how to use the 'go' command.
At this point I've only run into one package that is required but not already installed on the Stratux Raspbian images - a source code management utility called mercurial. To install it:
sudo apt-get install mercurial
This should install the mercurial common package which is later used by Go to install some additional software.
Stratux is hosted on Github (this site) which makes it easy to collaborate on projects. If you want to contribute, you'll want to follow standard git workflow and do things like fork the main stratux repository, create feature branches, and send pull requests with your updates. The details of how to do that are a bit beyond this quick tutorial. For now I'll just explain how to get the source.
This assumes you're using one of the pre-built Stratux images which comes pre-installed with git. If you're using raw Raspbian, you'll need to install git and probably some other tools.
To check out a copy of the Stratux source code:
cd ~/
git clone https://github.com/cyoung/stratux.git
This will create a directory called 'stratux' in your home folder. You're now ready to start building the Stratux application (called gen_gdl90).
Before you can build the main Stratux project, you may want/need to compile the dump978 sub-project. This creates a library that manages the radio and translates 978 MHz signals into UAT messages. The current image comes with an existing copy of this library, but you may need to update it as changes are made to the code base. To do this:
cd ~/stratux/dump978
make lib
This should compile the c-language dump978 code and deposit the resulting library file in the main stratux directory. To check, do this:
cd ..
ls -la
You should see a file called "libdump978.so" in the directory. That's the library. If that's there, everything compiled properly. Now we need to install the library in the main library directory. To do that:
sudo cp -f libdump978.so /usr/lib/
With the library installed, you're ready to compile the main Stratux code base. To do that:
export GOPATH=~/stratux
cd ~/stratux/
make
The first line tells go where to put everything. The second line makes sure you're in the right directory - the root directory of the project. The final 'make' line starts the compilation. You'll see go install a bunch of packages that stratux depends on before it finally complies the gen_gld90 application. Once it finishes compiling, you will need to install the new version of gen_gdl90 by running:
sudo make install
Once that's done, you should have the latest and greatest version of Stratux installed.
All of the source files for Stratux are now installed in your /home/pi/stratux directory. If you want to hack, that's where you'll need to go. If, for example, you want to change the serial port used for the GPS you can do so in /home/pi/stratux/main/ry835ai.go.
Good luck and enjoy!