InstallingGRFromSource on Raspberry Pi: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(add UHD instructions)
(Major revision with references to other document pages.)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<!-- InstallingGRFromSource_on_Raspberry_Pi -->
<!-- InstallingGRFromSource_on_Raspberry_Pi -->
These instructions have been tested with the <q>Raspbian Buster with desktop and recommended software</q> Operating System on a Raspberry Pi 3B+. A 32GB microSD card is recommended.
Note that there is a pre-built 32-bit SDR flavored Raspberry Pi OS distro, [https://github.com/luigifcruz/pisdr-image PiSDR] that includes GNU Radio and other SDR utilities.  Alternatively, you can install from source using the steps in the remainder of this page.


<p>If you want to use GNU Radio with a USRP, install the UHD package from source using the following instructions.
These instructions have been tested with the <q>Raspberry Pi OS (previously called Raspbian) (32-bit) with desktop and recommended software</q> on a Raspberry Pi 3B+. A 32GB microSD card is recommended.
UHD sits at the same level as GNU Radio as an independent driver, which gr-uhd references.  So if you want gr-uhd enabled, you <b>FIRST</b> must clone and install UHD.</p>


== Install UHD from source ==
== Set up a swap file ==
 
For this example, we will start in the home directory to parallel the steps in [[InstallingGR#To_install_system_wide]].
 
* <code>cd</code>
 
The following command line script will install all the required dependencies for UHD:
* <code>sudo apt-get install libboost-all-dev libusb-1.0-0-dev python-mako doxygen python-docutils cmake build-essential</code>


Clone the code into your home directory:
A swap file will improve the compile time greatly.
* <code>git clone git://github.com/EttusResearch/uhd.git</code>
* <code>cd ~/uhd</code>


<b>Note:</b> By default, you have the <code>master</code> branch after you have cloned from git. To get a list of available branches, enter <code>git branch</code>. To get a list of available tags, enter <code>git tag -l</code> (that's a lower case L). Use the following command to change to another branch or tag if you want to build a different version.
* <code>git checkout <your branch or tag></code>
<b>Note:</b> Unlike most build processes, UHD builds under the <code>host</code> directory.
* <code>cd host</code>
* <code>mkdir build</code>
* <code>cd build</code>
<b>Note:</b> In the following command, we will use <code>-DCMAKE_INSTALL_PREFIX=/usr/local</code> to install UHD into the same prefix as GNU Radio. When compiling for ARM platforms, the assumption is made that NEON extensions are available if the arm_neon.h header is found. However, for platforms such as Raspberry Pi, one must specify <code>-DNEON_SIMD_ENABLE=OFF</code> in the following command.
* <code>cmake -DNEON_SIMD_ENABLE=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ../</code>
<b>Note:</b> In the following command, if your computer's CPU has multiple cores, you can use the argument <code>-j#</code> to speed compilation; <br> e.g., <code>make -j3</code> will use 3 threads in the build. Specify at least one less than the number of CPU cores so the system does not appear to 'freeze' during the build. If not specified, then a single thread is used for the build; this is not necessarily a bad thing, but it will take roughly 2 times as long to build as using 2 threads, and roughly 3 times as long to build as using 3 threads.<br>
* <code>make -j3</code>
* <code>make test</code>
* <code>sudo make install</code>
If you're running Linux, then always do the following command after installing any library:
* <code>sudo ldconfig</code>
== Install GNU Radio ==
=== Load prerequisites ===
<p>You may have some of these prerequisites already, but it doesn't hurt to get them again and check for the latest versions.</p>
<pre>
sudo apt update --allow-releaseinfo-change
sudo apt upgrade
sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy \
python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev \
libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 \
liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins \
python3-zmq python3-scipy libpthread-stubs0-dev
</pre>
=== Set up a swap file ===
<p>A swap file will improve the compile time greatly.</p>
<pre>
<pre>
sudo fallocate -l 2G /swapfile
sudo fallocate -l 2G /swapfile
Line 65: Line 19:
</pre>
</pre>


=== Build ===
== Load prerequisites ==
<p>The next steps will take two or more hours. Be patient. The terminal does show the progress.</p>
 
Before building UHD and GNU Radio, you need to make sure that all the dependencies are installed. For Ubuntu 20.04 [[UbuntuInstall#Install_Dependencies|use this page]].
 
== Install UHD from source ==
 
<b>If you want to use GNU Radio with a USRP, you FIRST must clone and install UHD</b>.<br> Follow the instructions in [[Draft-AN-445#Building_and_installing_UHD_from_source_code|Install UHD from source]].
 
== Install GNU Radio ==


Click [[InstallingGR#To_install_system_wide]] to go to the install instructions.
* For GNU Radio 3.9, 3.10, and the Main branch, click [https://wiki.gnuradio.org/index.php?title=LinuxInstall#Installing_Volk here].
* For GNU Radio 3.8, click [https://wiki.gnuradio.org/index.php?title=LinuxInstall#Installing_GNU_Radio_2 here].

Latest revision as of 02:02, 22 April 2023

Note that there is a pre-built 32-bit SDR flavored Raspberry Pi OS distro, PiSDR that includes GNU Radio and other SDR utilities. Alternatively, you can install from source using the steps in the remainder of this page.

These instructions have been tested with the Raspberry Pi OS (previously called Raspbian) (32-bit) with desktop and recommended software on a Raspberry Pi 3B+. A 32GB microSD card is recommended.

Set up a swap file

A swap file will improve the compile time greatly.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

To make the swap file permanent, add this line to /etc/fstab

/swapfile  none  swap  sw  0  0

Load prerequisites

Before building UHD and GNU Radio, you need to make sure that all the dependencies are installed. For Ubuntu 20.04 use this page.

Install UHD from source

If you want to use GNU Radio with a USRP, you FIRST must clone and install UHD.
Follow the instructions in Install UHD from source.

Install GNU Radio

  • For GNU Radio 3.9, 3.10, and the Main branch, click here.
  • For GNU Radio 3.8, click here.