Should you need OpenBTS on your bladeRF

A big thank you to zane93 from the bladeRF forums for helping me debug my tutorial!

This is a tutorial to help you install OpenBTS 5 along with your nuand bladeRF Software Defined Radio. Everything written here is derived from the installation notes on this this amazing post  by the bladeRF community member mambrus based upon discussions he had with rwr in the #bladeRF channel on Freenode. The only thing that I have done is put all together in a single page for two reasons: first, to help people who are trying to get OpenBTS and nuand to work together hopefully saving them a few hours if not days in this cumbersome task and, second, as part of my MA project that involves this technologies I will analyse some of these steps as well. I did this on a machine with Ubuntu 14.04 64-bit, so it is possible that things be somewhat different for your Linux flavour.


NOTE: Before you start with this tutorial, make sure you have installed the bladeRF host libraries and tool, verified the basic operation of your radio and configured it to autoload the fpga.

NOTE 2: I have tried to make every block of code completely copy/paste, that’s why there are semi-colons at the end of some of the commands. If you want to run everything line by line just leave the semi-colon out when copying the commands.

The first thing to do is install all of the dependencies for the project, and it can be done with this very clever piece of code not written by me, which basically fetches all of the dependencies from the build file of the Range Networks repository. You can copy/paste it on your Debian system

sudo apt-get install $(
wget -qO - | \
grep installIfMissing | \
grep -v "{" | \
cut -f2 -d" ")

This is the list of dependencies found in that file, so the long version of the command, which you can also copy/paste, would look something like this

$ sudo apt-get install software-properties-common python-software-properties autoconf automake libtool debhelper sqlite3 libsqlite3-dev libusb-1.0-0 libusb-1.0-0-dev libortp-dev libortp8 libosip2-dev libreadline-dev libncurses5 libncurses5-dev pkg-config cdbs libsqlite0-dev unixodbc unixodbc-dev libssl-dev libsrtp0 libsrtp0-dev libsqliteodbc libzmq3-dev libzmq3 python-zmq uhd

There is a few issues you can run into installing all of this libraries. For example, the libport8 and liposip2 are not part of the Ubuntu 14.04 repository, so you have to add the 12.04 repository to your list of sources. To do this, open your sources file
sudo vim /etc/apt/sources.list

and to the end, add
deb precise main universe

after you have done this, you have to update the sources and install the libraries:
sudo apt-get update;
sudo apt-get install libortp8 libosip2-4

You can probably get into trouble with the zmq libraries so if you do, add the repository and try again
sudo add-apt-repository ppa:chris-lea/zeromq;
sudo apt-get update;
sudo apt-get install libzmq3-dbg libzmq3-dev

The third usual suspect is uhd, but you can usually fetch it following the instructions on the ettus website
sudo bash -c 'echo "deb`lsb_release -cs` `lsb_release -cs` main" > /etc/apt/sources.list.d/ettus.list';
sudo apt-get update;
sudo apt-get install -t `lsb_release -cs` uhd

Should this mehtod fail, there is still the option of building from source following this instructions. Bare in mind that you do not need the FPGA code since you will be using the one for your baldeRF.

So now the prerequisites should be all there, and it is time to get started!

Build a directory for your OpenBTS_5 install and inside it you will have to download the different sources required for the build, with this commands.
git clone;
git clone;
git clone

Then, fetch NodeManager and CommonLibs into each of the directories just created. You can copy/paste the following command:
for D in *; do (
echo $D;
echo "=======";
cd $D;
git clone;
git clone;

And then also fetch libcoredumper and liba53 from git
git clone;
git clone

The next step is to build these two libraries. Again, you can copy paste this commands from inside your OpenBTS_5 directory
cd libcoredumper;
./ && \
sudo dpkg -i *.deb;
cd ../liba53;
make && \
sudo make install;
cd ..

After this, clone YateBTS into your directory as well. According to their instructions you need to do it with svn, so in case you do not have it, run the following command to install it
$ sudo apt-get install subversion

And then clone the directory
$ svn checkout yatebts

To remove the loading of the fpga in YateBTS, in the file bladeRFDevice.cpp in the ./yatebts/mbts/TransceiverRAD1/ directory add #ifdev NEVER to line 108 and #endif to line 129.If you are using vim, you can copy/paste the command
vim ./yatebts/mbts/TransceiverRAD1/bladeRFDevice.cpp "+108s/^/#ifdef NEVER" +129s/^/#endif +wq

NOTE: They have modified the bladeRFDevice.cpp since I wrote this and now lines 112 through 133 should be commented out. Since they most likely will modify it again in the future, look for bladerf_fpga_size bfs; and place the #ifdev NEVER on the line immediately before that and the #endif on the line before switch (bladerf_device_speed(bdev)). Since this placement might also change in the future, remember that you are commenting out the bit that loads the bladeRF FPGA.

Then go inside the YateBTS directory and run autogen
cd yatebts;

Comment out lines 4263 to 4291 of the configure file. Again with vim
vim configure +4263,4291s/^/#/ +wq

And then run

Go to the mbts/Peering directory and run make
cd mbts/Peering/;

Then change to the mbts/TransceiverRAD1 directory and modify the Makefile by appending -lpthread to SQL_LIBS before running the make
cd ../TransceiverRAD1;
vim Makefile "+26s/$/ -lpthread/" +wq

and then run
cd ../../../

Back in your OpenBTS_5 directory, copy the transceiver-bladerf file you just created into the openbts/apps directory and tell openbts to call it when it needs a transceiver
cp ./yatebts/mbts/TransceiverRAD1/transceiver-bladerf openbts/apps/;
cd openbts/apps/;
ln -sf transceiver-bladerf transceiver

After this we are finally ready to build OpenBTS. Go bach to the openbts directory and run and after that configure with the uhd flag
./configure --with-uhd;

Edit the file apps/OpenBTS.example.sql the following way:
In line 181, GSM.Radio.RxGain from 47 to 5 in
In line 176, GSM.Radio.PowerManager.MaxAttenDB from 10 to 35
In line 177, GSM.Radio.PowerManager.MinAttenDB from 0 to 35

(The rest of the tutorial follows from this on, as indicated on the buildRF post. I only include the essential parts, if you want more detail read the information on the link carefully.)

Still in the openbts directory, make a dir for the configuration files and create the database by running
sudo mkdir /etc/OpenBTS;
sudo sqlite3 -init ./apps/OpenBTS.example.sql /etc/OpenBTS/OpenBTS.db ".quit"

Test with
sqlite3 /etc/OpenBTS/OpenBTS.db .dump

If you see a bunch of configuration variables, you have succesfully installed the database.

It is now time to install the Subscriber Registry and Sipauthserve. First, create a directory for the subscriber database if it does not exist
sudo mkdir -p /var/lib/asterisk/sqlite3dir

Change to the subscriber registry directory, build and run the Makefile
cd ../subscriberRegistry/;

In the original post it says that everything is created directly in the subscriberRegistry directory, however when I ran make everything was put inside the apps directory. Change to that directory and initialise the database
cd apps;
sudo sqlite3 -init subscriberRegistry.example.sql /etc/OpenBTS/sipauthserve.db ".quit"

Lastly, you have to install Smqueue. Go to the smqueue directory, from the last step, it would be
cd ../../smqueue/

Before you build the smqueue, you will have to copy some files into the smqueue and SR directories
cp ../subscriberRegistry/{SubscriberRegistry.cpp,SubscriberRegistry.h} smqueue/;
cp ../subscriberRegistry/SubscriberRegistry.cpp SR/

and then run the following
autoreconf -i;

As with OpenBTS, you need to initialise the database, use the following command
sudo sqlite3 -init smqueue/smqueue.example.sql /etc/OpenBTS/smqueue.db ".quit"

During my installation the file for the smqueue log was created automatically, but apparently this is not always the case so you will just have to create the directory along with an empty text file. These commands will not modify the file if it has already been created so, if you are not sure, you can just run these and no harm should come from them.
sudo mkdir -p /var/lib/OpenBTS;
sudo touch /var/lib/OpenBTS/smq.cdr

And that’s it! You have managed to install OpenBTS 5 to be used with your bladeRF SDR. To run it all, from your OpenBTS_5 directory, run each of the following commands on its own terminal window in this order
cd smqueue/smqueue/; sudo ./smqueue
cd subscriberRegistry/apps/; sudo ./sipauthserve
cd openbts/apps; sudo ./OpenBTS
cd openbts/apps; sudo ./OpenBTSCLI

18 thoughts on “Should you need OpenBTS on your bladeRF

  1. Thanks for the tutorial, I thought I was stuck with Yate.

    I get right up to starting OpenBTS (“cd openbts/apps; sudo ./OpenBTS”) and I get the following error:

    EMERG 61969:61977 2015-03-06T09:20:34.2 OpenBTS.cpp:185:startTransceiver: Transceiver quit with status 256. Exiting.

    Do you have any ideas?



    1. Think I’ve found the problem.

      When I call ‘make’ in ‘mbts/TransceiverRAD1’, ‘transceiver-rad1’ is created rather than ‘transceiver-bladerf’. Don’t know why though.


      1. Unfortunately Juan, I can’t respond to your post so I hope you can see this.

        I get this warning, but no error:

        “#warning Using non-portable code (likely wrong other than ILP32)”

        Am going to look into this now. Thanks.


      2. Same here
        It simply ends up with these lines,

        bladeRFDevice.cpp:894:2: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
        if (freq 3800000000)
        bladeRFDevice.cpp:905:2: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
        if (freq 3800000000)
        make: *** [transceiver-bladerf] Error 1


  2. Hello ,
    I got the same errors of CAGRI AKSU and James:
    bytesex.h:16:2: warning: #warning Using non-portable code (likely wrong other than ILP32). [-Wcpp]
    #warning Using non-portable code (likely wrong other than ILP32).
    bladeRFDevice.cpp:108:13: warning: extra tokens at end of #ifdef directive [enabled by default]
    #ifdef NEVER#ifdef NEVER }
    bladeRFDevice.cpp:129:7: warning: extra tokens at end of #endif directive [enabled by default]
    #endif#endif }
    bladeRFDevice.cpp:894:2: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
    if (freq 3800000000)
    bladeRFDevice.cpp:905:2: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
    if (freq 3800000000)
    bladeRFDevice.cpp: In member function ‘virtual bool bladeRFDevice::open(const string&, bool)’:
    bladeRFDevice.cpp:131:41: error: ‘fpgaName’ was not declared in this scope
    LOG(INFO) << "bladeRF FPGA " << fpgaName << " is loaded with version " << ver.major << "." << ver.minor
    bladeRFDevice.cpp:242:1: error: a function-definition is not allowed here before ‘{’ token
    bladeRFDevice.cpp:1024:1: error: expected ‘}’ at end of input
    bladeRFDevice.cpp:1024:1: warning: control reaches end of non-void function [-Wreturn-type]
    make: *** [transceiver-bladerf] Error 1
    and when I run OpenBTS it shows the error :
    EMERG 61969:61977 2015-03-06T09:20:34.2 OpenBTS.cpp:185:startTransceiver: Transceiver quit with status 256. Exiting
    I'm using USB2.0 and I'haven't installed UHD (because I use BladeRF), neither configured it (configured –with-uhd), only configure.
    What could be the solution?


    1. Hi. You have got the following error

      bladeRFDevice.cpp:131:41: error: ‘fpgaName’ was not declared in this scope
      LOG(INFO) << "bladeRF FPGA " << fpgaName << " is loaded with version " << ver.major

      since there is a mistake in this tutorial when author says to add #ifdev NEVER to line 108 and #endif to line 129. in the bladeRFDevice.cpp. after line 129 goes 3 more lines

      LOG(INFO) << "bladeRF FPGA " << fpgaName << " is loaded with version " << ver.major << "." << ver.minor
      << "." << ver.patch << " (" << ver.describe << ")";
      which you need to comment or delete. fpgaName variable in these lines has to be declared in the line 114.


      1. Thanks for pointing that out. They’ve modified the bladeRFDevice.cpp since I wrote this, so you now must comment from lines 112 to 133. I will add this to the tutorial with a warning to check the file before.


  3. in this command :”sudo sqlite3 -init subscriberRegistry.example.sql /etc/OpenBTS/sipauthserve.db “.quit””,subscriberRegistry.example.sql should change to sipauthserve.example.sql ?


  4. I could not find yatebts/mts/TransceiverRAD1 in trunk so Release 5.0.0 instead. Now after doing make in this directory I am not getting transceiver-bladerf but only transeiver-rad1. There are only warnings and no errors. Issue is exactly same as what James faced. Any idea how to solve this ?


    1. Bladerf installation document mentioned gives 2 ways for installing bladerf software – 1) by apt-get install 2) by compiling the code and installing. If we do with apt-get install we face the issue mentioned above. Once we compile and install things work smooth. I feel it will be good if you can mention that also in the instructions


  5. I have installed everything and running it in the same sequence as mentioned above, but cannot authenticate the sim card. How to authenticate the sim card in the phone?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s