Building bladeRF libraries and tools from source

If you already installed the bladeRF software using apt-get above, you can skip this section.

Clone the bladeRF git repository

To obtain the latest source code for the first time, clone the Nuand git repository via:

$ git clone https://github.com/Nuand/bladeRF.git ./bladeRF
$ cd ./bladeRF
$ ls  

The directory contents will look something like this:

CHANGELOG       CONTRIBUTORS  debian           fx3_firmware  host   README.md
CMakeLists.txt  COPYING       firmware_common  hdl           legal

In the future, you can update the repository via:

$ git pull

Configure the build

First enter the directory containing the host source. Then create and enter a directory to perform the build in. By working out of the a ‘build’ directory, it’s easy to later clean up, by simply removing ‘build/’.

$ cd host/
$ mkdir build
$ cd build

Next, configure the build. In the below example, we:

  • Set up a Release build
    • Change to Debug for a debug build, or RelWithDebInfo for a release build with debug symbols
  • Enable the installation of udev rules.
    • By default, this grants members of the plugdev group read-write access to bladeRF devices. This group can can be changed via -DBLADERF_GROUP=desired_group.
  • Specify that files should be installed into /usr/local
    • You can install into a different location via the -DCMAKE_INSTALL_PREFIX=/some/desired/path option. Note that you’ll need to need to configure binary and library search paths if you install elsewhere. If you’re unsure how to do this, simply follow the steps below to use the default install location.
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DINSTALL_UDEV_RULES=ON ../

Ensure that your user is in the group specified by BLADERF_GROUP. Check the output of the groups command:

$ groups
jon adm cdrom sudo dip plugdev lpadmin sambashare

In the above case, the user is already in the plugdev group, so we can skip ahead to the next subsection.

However, on other systems, the user may not already be in the required group. Furthermore, some distributions may not use the plugdev group. In these cases, you can either add a user to a more appropriate group or create a new group (and configure the build with -DBLADERF_GROUP=desired_group. For example, to create a bladerf group and add the user jon to it:

$ groups
jon wheel
$ sudo groupadd bladerf
$ sudo usermod -a -G bladerf jon

# Now log out and log back in...

$ groups
jon wheel bladerf

Perform the build and installation

The following commands:

  1. Perform the build
  2. Install files to /usr/local or the location specified by CMAKE_INSTALL_PREFIX
  3. Updated share library paths, so that libbladeRF can be found
$ make && sudo make install && sudo ldconfig

Uninstalling later

Note that from this same directory, you can run the following to uninstall the files place on your system in the previous step.

sudo make uninstall

The install_manifest.txt file, created after running the install step successfully, lists all the files installed. It is a good idea to back up this file if you plan on removing this build directory later.

Checking basic device operation

Before continuing, see the Getting Started: Verifying Basic Device Operation guide to test basic functionality.

If you encounter any issues or warnings, be sure to check the Troubleshooting guide before continuing on with this article.