Skip to content

Instantly share code, notes, and snippets.

@andrew-ma
Last active January 14, 2022 17:24
Show Gist options
  • Save andrew-ma/4f6ad2fad38ea3c2fe1a2a0d6bb8b9b8 to your computer and use it in GitHub Desktop.
Save andrew-ma/4f6ad2fad38ea3c2fe1a2a0d6bb8b9b8 to your computer and use it in GitHub Desktop.
## Links
> https://www.wime-project.net/insudo allation/
> https://kb.ettus.com/Getting_Started_with_DPDK_and_UHD
---
## Apt dependencies
sudo apt install -y git cmake g++ libboost-all-dev
---
## Installing UHD
## UHD Apt dependencies
sudo apt install -y autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool \
g++ git inetutils-tools libboost-all-dev libncurses5 libncurses5-dev libusb-1.0-0 libusb-1.0-0-dev \
libusb-dev python3-dev python3-mako python3-numpy python3-requests python3-scipy python3-setuptools \
python3-ruamel.yaml
### (Optional) For UHD doxygen, if it says 'dot' not found
sudo apt install -y graphviz
## UHD Python dependencies
sudo apt install -y python3-pip
python3 -m pip install gevent
python3 -m pip install mprpc
python3 -m pip install pyudev
python3 -m pip install pyroute2
## NOTE: had some ld linker errors about -fPIC when building UHD with DPDK
# ### UHD v4.x dependency: DPDK v18.11
# https://doc.dpdk.org/guides-18.11/linux_gsg/build_dpdk.html
# ```
# wget https://fast.dpdk.org/rel/dpdk-18.11.11.tar.xz
# tar xf dpdk-18.11.11.tar.xz
# cd dpdk-stable-18.11.11
#
# # Build files
# # Default install prefix is /usr/local
# make config T=x86_64-native-linuxapp-gcc
# make -j3
# sudo make install
#
## Installing UHD v4.x
```
# https://files.ettus.com/manual/page_build_guide.html
git clone -b UHD-4.1 https://github.com/EttusResearch/uhd.git
cd uhd
cd host
##########################################################################################
## NOTE: to work with DPDK
wget https://fast.dpdk.org/rel/dpdk-18.11.11.tar.xz
tar xvf dpd*
sudo apt install meson
mkdir DPDK_INSTALL
export DPDK_INSTALL_DIR="$(realpath DPDK_INSTALL)"
export DESTDIR="$DPDK_INSTALL_DIR"
meson build --reconfigure
cd build
ninja
ninja install
### Make the symlinks (Note your system's kernel version may be different from 5.11.0-44, so change accordingly)
echo "Installed to: $DPDK_INSTALL_DIR"
sudo ln -s "${DPDK_INSTALL_DIR}/lib/modules/5.11.0-44-generic/extra/dpdk" /lib/modules/5.11.0-44-generic/extra/dpdk
sudo cp -Rs "${DPDK_INSTALL_DIR}/usr/local/bin/"* /usr/local/bin
sudo cp -Rs "${DPDK_INSTALL_DIR}/usr/local/include/"* /usr/local/include
sudo cp -Rs "${DPDK_INSTALL_DIR}/usr/local/lib/"* /usr/local/lib
##########################################################################################
## Our custom install directory
mkdir UHD_INSTALL
export UHD_INSTALL_DIR="$(realpath UHD_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$UHD_INSTALL_DIR -DPYTHON_EXECUTABLE=/usr/bin/python3 -DRUNTIME_PYTHON_EXECUTABLE=/usr/bin/python3 -DENABLE_DPDK=ON ../
# Build and install
make -j6
## only need sudo if installing to default CMAKE_INSTALL_PREFIX /usr/local
# if custom CMAKE_INSTALL_PREFIX, then no sudo needed
make install
## Make symlinks
sudo cp -Rs "${UHD_INSTALL_DIR}/bin/"* /usr/local/bin
sudo cp -Rs "${UHD_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${UHD_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${UHD_INSTALL_DIR}/share/"* /usr/local/share
```
-----------------------------------
## Installing gnuradio
```
# https://wiki.gnuradio.org/index.php/InstallingGR#From_Source
# Dep for ubuntu 20.04: https://wiki.gnuradio.org/index.php/UbuntuInstall#Focal_Fossa_.2820.04.29_through_Impish_Indri_.2821.10.29
sudo apt install -y 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 python3-gi python3-gi-cairo gir1.2-gtk-3.0 \
libcodec2-dev libgsm1-dev
sudo apt install -y pybind11-dev python3-matplotlib libsndfile1-dev \
python3-pip libsoapysdr-dev soapysdr-tools
pip install pygccxml
pip install pyqtgraph
###############################################
# Installing dependency Volk
git clone --recursive https://github.com/gnuradio/volk.git
cd volk
## Our custom install directory
mkdir VOLK_INSTALL
export VOLK_INSTALL_DIR="$(realpath VOLK_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$VOLK_INSTALL_DIR -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j6
make install
## Make symlinks
sudo cp -Rs "${VOLK_INSTALL_DIR}/bin/"* /usr/local/bin
sudo cp -Rs "${VOLK_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${VOLK_INSTALL_DIR}/lib/"* /usr/local/lib
# To run Volk tests
volk_profile
#####################################
# Installing gnuradio cmake dependencies
## MathJax2: /usr/share/javascript/mathjax/MathJax.js
sudo apt install -y libjs-mathjax
## binary 'thrift' 0.9.2
sudo apt install -y libboost-dev libboost-test-dev libboost-program-options-dev libboost-filesystem-dev libboost-thread-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev thrift-compiler
pip install thrift==0.9.2
### NOTE: did not work
##wget http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz
##tar xvf thrift-0.9.2.tar.gz
##cd thrift-0.9.2
##./configure
##make -j6
##sudo make install
# qt packages
sudo apt install -y libqt5svg5 libqt5svg5-dev libqwt-qt5-dev libqwt-qt5-6
# package 'libunwind'
sudo apt install -y libunwind-dev
# module 'jack'
sudo apt install -y libjack-jackd2-dev
# module portaudio-2.0
sudo apt install -y portaudio19-dev
# sdl
sudo apt install -y libsdl2-2.0-0
# pytest
pip install pytest
# refresh libraries
sudo ldconfig
#####################################################
# Clone gnuradio repo
git clone -b maint-3.9 --recursive https://github.com/gnuradio/gnuradio.git
cd gnuradio
## Our custom install directory
mkdir GNURADIO_INSTALL
export GNURADIO_INSTALL_DIR="$(realpath GNURADIO_INSTALL)"
mkdir build
cd build
# Installing gnuradio
cmake -DCMAKE_INSTALL_PREFIX=$GNURADIO_INSTALL_DIR -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j6
make install
# tell loader to index newly created Gnuradio libs
sudo ldconfig
## Make symlinks
sudo cp -Rs "${GNURADIO_INSTALL_DIR}/bin/"* /usr/local/bin
sudo cp -Rs "${GNURADIO_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${GNURADIO_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${GNURADIO_INSTALL_DIR}/share/"* /usr/local/share
sudo cp -Rs "${GNURADIO_INSTALL_DIR}/etc/"* /etc
```
# Run gnuradio
export PYTHONPATH="/usr/local/lib/python3.8/site-packages"
gnuradio-companion
-----------------------------------
## Installing gr-foo
```
git clone -b maint-3.9 https://github.com/bastibl/gr-foo.git
cd gr-foo
## Our custom install directory
mkdir GR_FOO_INSTALL
export GR_FOO_INSTALL_DIR="$(realpath GR_FOO_INSTALL)"
mkdir build
cd build
# Generate build files
# Default install prefix is /usr/local
cmake -DCMAKE_INSTALL_PREFIX=$GR_FOO_INSTALL_DIR -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
# Build and install
make -j6
make install
# Setup library path
sudo ldconfig
## Make symlinks
sudo cp -Rs "${GR_FOO_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${GR_FOO_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${GR_FOO_INSTALL_DIR}/share/"* /usr/local/share
```
---
## Installing gr-ieee802-11
git clone -b maint-3.9 https://github.com/bastibl/gr-ieee802-11
cd gr-ieee802-11
## Our custom install directory
mkdir GR_IEEE80211_INSTALL
export GR_IEEE80211_INSTALL_DIR="$(realpath GR_IEEE80211_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$GR_IEEE80211_INSTALL_DIR -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j6
make install
sudo ldconfig
## Make symlinks
sudo cp -Rs "${GR_IEEE80211_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${GR_IEEE80211_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${GR_IEEE80211_INSTALL_DIR}/share/"* /usr/local/share
```
---
## Installing gr-osmosdr dependencies
### Installing gr-iqbal
git clone --recursive https://github.com/osmocom/gr-iqbal
cd gr-iqbal
## Our custom install directory
mkdir GR_IQBAL_INSTALL
export GR_IQBAL_INSTALL_DIR="$(realpath GR_IQBAL_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$GR_IQBAL_INSTALL_DIR -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j6
make install
## Make symlinks
sudo cp -Rs "${GR_IQBAL_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${GR_IQBAL_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${GR_IQBAL_INSTALL_DIR}/share/"* /usr/local/share
### Installing rtl-sdr
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
## Our custom install directory
mkdir RTL_SDR_INSTALL
export RTL_SDR_INSTALL_DIR="$(realpath RTL_SDR_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$RTL_SDR_INSTALL_DIR ../
make -j6
make install
## Make symlinks
sudo cp -Rs "${RTL_SDR_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${RTL_SDR_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${RTL_SDR_INSTALL_DIR}/bin/"* /usr/local/bin
### Installing libhackrf
git clone https://github.com/greatscottgadgets/hackrf
cd hackrf
cd host
cd libhackrf
## Our custom install directory
mkdir LIBHACKRF_INSTALL
export LIBHACKRF_INSTALL_DIR="$(realpath LIBHACKRF_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$LIBHACKRF_INSTALL_DIR ../
make -j6
sudo make install
## Make symlinks
sudo cp -Rs "${LIBHACKRF_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${LIBHACKRF_INSTALL_DIR}/lib/"* /usr/local/lib
## Installing gr-osmosdr block
git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr
## Our custom install directory
mkdir GR_OSMOSDR_INSTALL
export GR_OSMOSDR_INSTALL_DIR="$(realpath GR_OSMOSDR_INSTALL)"
mkdir build
cd build
### Note: there will be disabled features since we did not install all the gr-osmosdr SDR dependency libraries, but that is ok. If need a different SDR, then install the library, and re-run the steps below starting from 'cmake ../'
cmake -DCMAKE_INSTALL_PREFIX=$GR_OSMOSDR_INSTALL_DIR -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j6
make install
## Make symlinks
sudo cp -Rs "${GR_OSMOSDR_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${GR_OSMOSDR_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${GR_OSMOSDR_INSTALL_DIR}/bin/"* /usr/local/bin
sudo cp -Rs "${GR_OSMOSDR_INSTALL_DIR}/share/"* /usr/local/share
---
You should be able to run Gnu Radio by typing 'gnuradio-companion' in terminal
---
### Installing Fosphor
sudo apt install -y cmake xorg-dev libglu1-mesa-dev
git clone https://github.com/glfw/glfw
cd gifw
mkdir GIFW_INSTALL
export GIFW_INSTALL_DIR="$(realpath GIFW_INSTALL)"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$GIFW_INSTALL_DIR -DBUILD_SHARED_LIBS=true ../
make -j6
make install
## Make symlinks
sudo cp -Rs "${GIFW_INSTALL_DIR}/include/"* /usr/local/include
sudo cp -Rs "${GIFW_INSTALL_DIR}/lib/"* /usr/local/lib
sudo cp -Rs "${GIFW_INSTALL_DIR}/share/"* /usr/local/share
---
## Install Nvidia OpenCL implementation
sudo apt-get install nvidia-opencl-dev opencl-headers
sudo apt install nvidia-modprobe
---
## Install gr-fosphor
git clone git://git.osmocom.org/gr-fosphor
cd gr-fosphor
mkdir build
cd build
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 ../
make -j6
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment