Home

Better Android Support!

One of the harder things about GNU Radio on a new system is building the dependencies. That was a large part of my task when getting GNU Radio for Android working. All of the required dependencies needed to build rebuilt using the Android toolchain, which meant that for each dependency, I had to figure out how to set up and call the NDK properly. That was hard, and good thing that there were quite a few hints on the Internet for various programs like Boost and LibUSB. For a while now, I've had information on how to build all of the dependencies for Android on our Android support page. This includes a page dedicated to building the basic libraries and dependencies as well as a page discussing how to build VOLK, GNU Radio, GRAnd, and gr-osomosdr.

It seemed like very few people could follow this through and successfully rebuild all of these packages themselves. And that's fair because I had only ever done this on my machines which are both running the same version of Ubuntu Linux (15.10) and everything else. It's hard to say how any deviations from these versions might affect things. So to help with this issue, I just published two new tools to help people get started.

Tarball of Dependencies

The first tool, which should be the go-to for anyone wanting to get up and running immediately, is a tarball of all of the pre-built dependencies as well as all of the GNU Radio support packages. You just download this, untar/uncompress it (into /opt/grandroid, generally, since that's where I tell everyone to look for this stuff), and now you're ready to start building Android apps and linking to GNU Radio. Bam. Done. The GNU Radio team also has a GPG key for signing, so you can get the public key, download the signature for the tarball and verify your download.

The tarball contains a MANIFEST.txt file that describes what's been built and packaged into this tarball. As of writing this, it looks like:

Boost: 1.58.0
FFTW: 3.3.4
OpenSSL: 1.0.2
Thrift: 0.9.3
ZeroMQ: 3.2.4
LibUSB: v1.0.19-and5
RTL-SDR: b829664e85ae67a35c06f09ffbc16207f4001324
UHD: 4e64eb4888ecbe159af290482615b518ca835682
VOLK: 9b3c79afe34ea6a9dbf20e5c25afa7b5038119bd
gr-omsosdr: 8c01b772ef20bb718902a4e613554bd705010131
GNU Radio: b7870d6cc1b984e44044fa60240e4ad77c8ccd45

For versioned packages, that version is given. For the other packages, these are generally projects that we had to hack to get to work under Android, so these are the git refs for my android branches of these projects.

Do-It-Yourself Script

Some people are (justifiably) paranoid about taking pre-built binaries, even if they are signed. To help them, I've also published the script that I used to build the tarball of binaries. This basically takes the instructions that I made on the wiki pages and puts it into a much better package and slightly more robust way of building things yourself.

Speaking of paranoia, the script will ask you to enter your admin password because it will run sudo to create the directory ($PREFIX). If you look at the script, you see these three lines:

sudo mkdir -p ${PREFIX}
sudo chown $USER:$USER -R ${PREFIX}
sudo -K # invalidates credentials for anyone paranoid

It creates the directory $PREFIX, assigns it over to the user that called this script, and then uses the -K to invalidate the sudo credentials so it won't be able to do anything else as the superuser after this.

The script is only tested on Ubuntu 15.10 (64-bit).

Available GNU Radio Components

When we build GNU Radio, we turn off a lot of extraneous components that aren't necessary or even useful on Android, like GRC or the QT and WX widgets. What is built includes:

  • gnuradio-runtime
  • gr-blocks
  • gr-fft
  • gr-filter
  • gr-analog
  • gr-digital
  • gr-channels
  • gr-zeromq
  • gr-uhd
  • gr-ctrlport (with Thrift support)
  • Static libraries for each component

And also VOLK and gr-osmosdr separately. The GRAnd package provides audio sources and sinks for use under Android.

The one final GNU Radio component that I feel should be added here is gr-fec. However, right now, that requires GSL, which we have not yet built for Android.

GNU Radio for Android

I have been slowly pushing out information here and there on my work on Android. I've been able to show it off at various conferences and workshops that I've attended over the past few months. It gets a lot of very positive feedback, and we know there are many, many exciting things we as a community of developers and wireless experts can do with this kind of a system.

It's time to start really pushing this project. I spent so much time getting things to work under the hood that I've completely lost track of any of the cool applications that I wanted to work on with it! But the more people that get access to this and know how to work with it, the more interesting the application space and possibilities will become. Because of that, I had been waiting for two things to finish before writing this post. First, I wanted to be able to use a bus-powered Ettus Research USRP with and Android device. And second, I wanted the process documented from the start of building the dependencies to the end of a working (if overly simple) app. Both of those are done.

To help get things started, I've created an Android support page on the gnuradio.org wiki:

  • http://gnuradio.org/redmine/projects/gnuradio/wiki/Android

This page is designed to walk a developer through all of the stages from building the dependencies to GNU Radio itself, GRAnd, UHD, RTL-SDR, and gr-omsosdr. This should be pretty much copy-and-paste to get everything built and ready. The final part was finished just today: a walk-through for how to build a basic Android application that launches a GNU Radio flowgraph. This is done using Android Studio, which is the latest development environment for building Android apps. The project can be downloaded from it's Github page to provide a template to set up your own project and verify a working installation:

  • https://github.com/trondeau/GrTemplate

Hopefully, we will continue to evolve the process to make setup and building apps easier in the future. The next step is walking through and providing the annoying boilerplate stuff for hardware access so you can start using USRPs and RTL-SDRs with your devices. But for right now, I want to make sure people who are excited about this stuff have a way to get in and start playing.

List of what we support on Android

So where do we stand with our GNU Radio support on Android?

  • GNU Radio components:
    • Runtime, VOLK, Blocks, FFT, Filter, Analog, Digital, UHD
    • ControlPort
  • Extras
    • gr-osmosdr including RTL-SDR and UHD support
      • HackRF support should be trivial but not done, yet
    • gr-grand: GRAnd (GNU Radio for Android) to support Android-specific I/O and capabilities such as:
      • audio input and output
      • shared buffers between app and flowgraph
      • sensors (e.g., accelerometer and luminosity)
  • Tested hardware
    • RTL-SDRs
    • USRP B200 and B210 (the latter required external power on a Nexus 7)
  • Android Version
    • Android Lollipop 5.0 or greater. Tested on 5.1.1
      • some complex support in previous versions is lacking in the ndk; we think we can get around it, just not out-of-the-box.

In Case You Missed It... v3.6.0 Release

I've been remiss in updating my blog with the latest 3.6.0 release of GNU Radio. This continues our efforts to constantly move forward and focus more on making sure updated, stable releases are available that people can rely on.

There were a number of updates that you can find on the changelog page in the above link to the release. The most important one is that, finally, our long national nightmare of hosting and supporting two build systems is at an end! We have remove the autotools build in favor of cmake. Not only have we worked hard enough to make sure cmake satisfied all of our build needs, but we really started focusing our energies there, often leaving behind the old autotools way of compiling the code. No longer. We have moved over to cmake. In most ways, this is a positive move. People familiar with cmake, I'm sure, love it. Those unfamiliar may have a bit of growing pains, but I think you'll soon find that as a user, it is very simple to work with. Our build guide shows you the steps to using it to build GNU Radio from scratch (hint: basically replace configure with cmake).

In another major advancement, GNU Radio users might have noticed that our website has been a bit slow and groggy. In a way, this was a really positive thing for the project because it meant that we receive a ton of traffic. It was, however, annoying and needed to be fixed. This past week, Johnathan Corgan and I updated the server machine to a faster system. The change in the responsiveness of the website was immediate, and I think all of our users will be pleased.

 

Ubuntu 11.10 Troubles

After upgrading to Ubuntu 11.10, I noticed some serious issues compiling and building GNU Radio. I spent the weekend working these out, and I'm happy to report that as of Sunday night, the git maint/master/next branches can all be built on Ubuntu 11.10 (and all previous builds, too, of course).

The work isn't quite done, yet, I'm afraid. There are still some bootstrap issues as the autotools guys have becomes a bit more restrictive/careful. The warnings that are generated are annoying but appear harmless. I worked out what I could, but there's one or two more that are alluding me right now. I'd appreciate any assistance in tracking this down that anyone wants to give me.

The other error was that we didn't explicitly link against the Boost filesystem library in a couple of places. That was another easy one to fix.

But the big issue came because of Ubuntu's change to using Qwt 6. We had been using version 5.2 since we build gr-qtgui. The change to the new API was not trivial, especially when trying to maintain backwards compatibility with 5.2. I'm happy to say that this has been achieved. The code's a lot uglier because of the Qwt version checks, and while I could have probably done it a bit more cleanly, this is still the right way to do things.

While the update to Qwt 6 was pretty painful, the new API and changes that they made have created a much better system. In particular, the waterfall plot has been greatly simplified from version 5.2. Once version 6 starts to take hold in all of our other OSes, I'll go through and clean out the old stuff required in 5.2. This probably won't be for a few years, though, but it will be nice when we can move on and create more simplified implementation.

New Server, New Service

We have recently updated the GNU Radio server to a new platform with updated versions of all of our services. There were a few hiccups along the way as proxies and other caching sites had to be refreshed for everyone to get to the new site properly, but I haven't heard any complaints in a while, so hopefully those initial jitters have gone away.

Among the new versions of our software is an updated Redmine. The new Redmine fixes some issues we had with registration, but it will also allow us to support multiple projects and other nice features like that. Keep an eye out for expanding information on the website as we integrate these new features.

Mostly, I hope this change hasn't effected anyone, and it should only serve to make the website more stable and nicer to use. The new server in the background has already saved us a ton of work.

One new change that has come about is an update from running Hudson to Jeknins. This will serve as our new continuous integration tool and I hope to start making good use of it in our project development cycle.

Initially, the most important change is that every time Jenkins builds GNU Radio, on a weekly basis, the resulting packaged tarball for the most recent master development branch will be published on our website. This means that people who don't want to or can't use git to access the software can get a new snapshot of the code weekly. The links to the tarball and the SHA1 sum of the tarball are found on the Downloads page of gnuradio.org.

Jenkins Interface: http://gnuradio.org/jenkins/

Download Page: http://gnuradio.org/redmine/projects/gnuradio/wiki/Download

 

UHD Examples

I recently added a couple of GNU Radio examples that use the UHD interface to the USRP devices. We have been lacking any examples of using the UHD interface, and these new apps are two of the more commonly used apps we have, so I wanted to provide some support as people migrate to UHD-only GNU Radio programs.

You can find these new apps in the source tree under gr-uhd/apps. They are:

 

  • uhd_fft.py: a simple spectrum analyzer program to display a received signal in a WX GUI. You can set the frequency, bandwidth, gain, and antenna, and you can display an FFT, waterfall, or time domain (oscilloscope) plot, where the FFT is the default.
  • uhd_rx_cfile.py: this is a simple script that stores all received samples to a file. Again, you can set parameters like the frequency, bandwidth, gain, and antenna port. You can also save samples as complex shorts (16 bit I&Q). You have to provide the name of the file to save the samples to, and you can either let it run until you stop it or provide a maximum number of samples to capture.

 

These should help us with a few things. First, it will give people who want to write programs with UHD a few examples of what to do, especially if they want to convert another program that we have to using the UHD interface. It will also help us reduce our dependency on the other "legacy" interfaces to USRPs and USRP2s.

Right now, gr-utils depends on gr-usrp, and we want to remove this dependency. Instead, I would rather see each gr-<interface> have an "apps" directory that contain applications using that particular interface. Doing this is going to mean a lot of duplication of code, but that's unavoidable until we construct some kind of hardware abstraction layer.

As a side note, one of the reasons we have been putting off making these kinds of apps is that we had envisioned re-imagining of some of them into full-blown programs. Instead of a uhd_fft.py, we wanted something like a gr_spectrum_analyzer that would provide all sorts of neat bells and whistles and look and feel more like a digital implementation of a spectrum analyzer. However, this is going to take time that no one really has right now. So I just made the decision to go and do these simple applications to get the ball rolling.

One-step installation script

I have just posted a link on our gnuraido.org Build Guide webpage to a one-step installation script for GNU Radio on Ubuntu and Fedora. The script was built by Marcus Leech and is hosted from his website, so thanks Marcus!

http://gnuradio.org/redmine/wiki/gnuradio/BuildGuide

This scrpt is designd for Fedora and Ubuntu. Specifically, Fedora 12 to 15 and Ubuntu 9.04 to 10.10. I have made it work under Ubuntu 11.04, and expect the script to be udated shortly for that OS version.

Marcus feels, and I concur, that the majority of GNU Radio users use Fedora or Ubuntu, so this script can make it easy for a large portion of our user base to quickly and easily install GNU Radio and all of its dependencies.