1. 程式人生 > >ubuntu 16.04 LTS 下安裝LimeSDR 的gnuradio執行環境【詳細】

ubuntu 16.04 LTS 下安裝LimeSDR 的gnuradio執行環境【詳細】

本人懶,不喜歡截圖,都是從網上參考的資料整理的,敬請諒解,歡迎交流。

系統提前進行準備工作 如果是用ubntun的官方源的化,速度會很慢,而且需要翻牆,所以我建議使用 阿里雲的源 速度要快,而且穩定。 進入到 /etc/apt/sources.list 檔案 修改為
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted

準備好源後,我們為了保證之前的快取不影響我們接下來的工作,接下來執行
sudo rm -rf /var/lib/apt/lists/*
sudo apt clean
sudo apt update
sudo apt upgrade
如果沒有問題,應該就可以接下來繼續了。 首先安裝limesuite 套件 1.二進位制安裝,可執行
sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update
#安裝limesuite 套件
sudo apt-get -y install limesuite liblimesuite17.06-1 liblimesuite-dev limesuite-udev limesuite-images
#安裝soapysdr 支援 可以使用SoapySDR 介面
sudo apt-get -y install soapysdr soapysdr-module-lms7

2.原始碼構建安裝 先準備好依賴庫
sudo add-apt-repository -y ppa:myriadrf /drivers sudo apt-get update
#install核心庫和構建依賴項
sudo apt-get install git g ++ cmake libsqlite3-dev 
#install硬體支援依賴項
sudo apt-get install libsoapysdr-dev libi2c-dev libusb-1.0-0-dev 
#install 圖形依賴
sudo apt-get install libwxgtk3.0-dev freeglut3-dev

以下命令將克隆LimeSuite儲存庫,使用CMake配置專案,構建專案並進行安裝。cmake命令的輸出將顯示啟用和禁用的元件。在搭建之前要小心注意。注意觀察那些元件是可以用的。
git clone https://github.com/myriadrf/LimeSuite.git 
cd LimeSuite mkdir builddir && cd builddir 
cmake ../ 
make -j4 
sudo make install 
sudo ldconfig
接下來為了保證非root使用者能夠訪問LimeSDR usb裝置. 執行
cd LimeSuite/udev-rules 
sudo ./install.sh
這樣就limeSuite安裝好了 有了limeSuite還要安裝SoapySDR 安裝SoapySDR
先安裝依賴包
sudo apt-get install  cmake g ++  libpython-dev python-numpy swig python-dev
從git首次儲存庫克隆
git clone https://github.com/pothosware/SoapySDR.gitcd SoapySDR
更新可以執行
git pull origin master
開始構建
mkdir buildcd buildcmake ../make -j4sudo make installsudo ldconfig

#看看成功沒有 通常預設在 /usr/local/bing 目錄下 SoapySDRUtil --info 如果想改變安裝路徑 可以採用在cmake 時 cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLIB_INSTALL_DIR:PATH=lib64 -DLIB_SUFFIX=64 -DSOAPY_SDR_ROOT=/usr ../ 到此 LimeSuite 和 SoapySDR安裝完畢 2.要安裝能夠用的gnuradio 1.二進位制軟體包安裝方式 新增ppa
sudo add-apt-repository -y ppa:pothosware/framework
sudo add-apt-repository -y ppa:pothosware/support
sudo add-apt-repository -y ppa:myriadrf/drivers
sudo add-apt-repository -y ppa:bladerf/bladerf
sudo add-apt-repository -y ppa:ettusresearch/uhd
sudo apt-get update
準備依賴安裝包
sudo apt-get install  cmake g ++  libpython-dev python-numpy swig python-dev
sudo apt-get -y install build-essential cmake git-core autoconf automake  libtool g++ python-dev swig pkg-config libfftw3-dev libcppunit-dev libusb-dev sdcc libsdl1.2-dev python-numpy python-cheetah python-lxml doxygen python-qt4 python-qwt5-qt4 libxi-dev libqt4-opengl-dev libqwt5-qt4-dev libfontconfig1-dev libxrender-dev 
新增 Pothos和toolkits的支援
sudo apt-get install pothos-all
sudo apt-get install python-pothos
sudo apt-get install python3-pothos
sudo apt-get install pothos-python-dev
安裝Soapy SDR runtime
sudo apt-get install soapysdr
sudo apt-get install python-soapysdr python-numpy
sudo apt-get install python3-soapysdr python3-numpy
sudo apt-get install soapysdr-module-remote soapysdr-server
安裝Soapy SDR驅動 (全部裝上,防止以後再麻煩)
sudo apt-get install osmo-sdr soapysdr-module-osmosdr
sudo apt-get install rtl-sdr soapysdr-module-rtlsdr
sudo apt-get install bladerf soapysdr-module-bladerf
sudo apt-get install hackrf soapysdr-module-hackrf
sudo apt-get install uhd-host uhd-soapysdr soapysdr-module-uhd
sudo apt-get install umtrx uhd-host uhd-soapysdr soapysdr-module-uhd
sudo apt-get install miri-sdr soapysdr-module-mirisdr
sudo apt-get install soapysdr-module-rfspace
sudo apt-get install airspy soapysdr-module-airspy


好了之後測試下 PothosUtil --system-info SoapySDRUtil --info 沒問題了,就可以裝gnuradio了 再安裝 gnuradio 先準備好依賴包
sudo apt-get -y install git cmake libboost-dev libcppunit-dev libfftw3-dev python-numpy doxygen python-cheetah python-gtk2-dev python-qt4 python-qwt5-qt4 libxi-dev libqt4-opengl-dev libqwt5-qt4-dev python-lxml
安裝gnuradio
sudo apt-get install gnuradio
2.採用原始檔編譯安裝 我們採用一個網上的指令碼來進行安裝比較方便些
wget http://www.sbrac.org/files/build-gnuradio && sudo chmod a + x build-gnuradio && ./build-gnuradio
一路按y 就行了最後安裝好了就可以了 就不在這裡多說了 3.最後安裝gr-osmosdr 我們採用原始碼編譯安裝 首先 安裝gr-osmosdr 的支援包
sudo apt-get install libsoapysdr-dev
sudo apt install gr-fcdproplus
接下來clone原始碼
git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr/
mkdir build
cd build/
cmake ../
make
sudo make install
sudo ldconfig

注意要看看 cmake ../ 打印出的現階段gnuradio的元件支援情況,最好全部支援 最主要是要看到 Soapysdr support在enable裡面就行了 如果出現第一開啟會提示Xterm is missing。  解決辦法:
sudo gedit /etc/gnuradio/conf.d/grc.conf
xterm_executable = 1
這樣就安裝好了,你就可以用grc來測試了 補充: 在網上看到別人寫的一個安裝指令碼,覺得很好,貼在後面 python的
#!/usr/bin/env python
#coding=utf-8

import shlex
import subprocess
aa = ['sudo add-apt-repository -y ppa:myriadrf/drivers', \
 'sudo apt-get update', \
 'sudo apt-get -y install limesuite liblimesuite17.06-1 liblimesuite-dev limesuite-udev limesuite-images', \
 'sudo apt-get -y install soapysdr soapysdr-module-lms7',\
 'sudo add-apt-repository -y ppa:pothosware/framework',\
 'sudo add-apt-repository -y ppa:pothosware/support',\
 'sudo add-apt-repository -y ppa:myriadrf/drivers',\
 'sudo add-apt-repository -y ppa:bladerf/bladerf',\
 'sudo add-apt-repository -y ppa:ettusresearch/uhd',\
 'sudo apt-get update',\
 'sudo apt-get -y install python-dev swig'\
 'sudo apt-get -y install pothos-all',\
 'sudo apt-get -y install python-pothos',\
 'sudo apt-get -y install python3-pothos',\
 'sudo apt-get -y install pothos-python-dev'\
 'sudo apt-get -y install soapysdr',\
 'sudo apt-get -y install python-soapysdr python-numpy',\
 'sudo apt-get -y install python3-soapysdr python3-numpy',\
 'sudo apt-get -y install soapysdr-module-remote soapysdr-server',\
 'sudo apt-get -y install osmo-sdr soapysdr-module-osmosdr',\
 'sudo apt-get -y install rtl-sdr soapysdr-module-rtlsdr',\
 'sudo apt-get -y install bladerf soapysdr-module-bladerf',\
 'sudo apt-get -y install hackrf soapysdr-module-hackrf',\
 'sudo apt-get -y install uhd-host uhd-soapysdr soapysdr-module-uhd',\
 'sudo apt-get -y install umtrx uhd-host uhd-soapysdr soapysdr-module-uhd',\
 'sudo apt-get -y install miri-sdr soapysdr-module-mirisdr',\
 'sudo apt-get -y install soapysdr-module-rfspace',\
 'sudo apt-get -y install airspy soapysdr-module-airspy',\
 'PothosUtil --system-info',\
 'SoapySDRUtil --info',\
 'sudo apt-get -y install git cmake libboost-dev libcppunit-dev libfftw3-dev python-dev swig python-numpy doxygen python-cheetah python-gtk2-dev python-qt4 python-qwt5-qt4 libxi-dev libqt4-opengl-dev libqwt5-qt4-dev python-lxml',\
 'sudo apt-get -y install gnuradio',\
 'sudo apt-get -y install libsoapysdr-dev',\
 'sudo apt-get -y install gr-fcdproplus',
 ]
for i in aa:
	args=shlex.split(i)
	p=subprocess.Popen(args)
	p.wait()

sub = subprocess.call('git clone git://git.osmocom.org/gr-osmosdr && cd gr-osmosdr/ && mkdir build && cd build && cmake .. && make && sudo make install && sudo ldconfig', shell=True)
if sub == 0:
	print 'Sucessfull!'


解除安裝指令碼

#!/usr/bin/env python
#coding=utf-8

import shlex
import subprocess
aa = ['sudo apt-get -y remove pothos-all',\
 'sudo apt-get -y remove python-pothos',\
 'sudo apt-get -y remove python3-pothos',\
 'sudo apt-get -y remove pothos-python-dev'\
 'sudo apt-get -y remove soapysdr',\
 'sudo apt-get -y remove python-soapysdr python-numpy',\
 'sudo apt-get -y remove python3-soapysdr python3-numpy',\
 'sudo apt-get -y remove soapysdr-module-remote soapysdr-server',\
 'sudo apt-get -y remove osmo-sdr soapysdr-module-osmosdr',\
 'sudo apt-get -y remove rtl-sdr soapysdr-module-rtlsdr',\
 'sudo apt-get -y remove bladerf soapysdr-module-bladerf',\
 'sudo apt-get -y remove hackrf soapysdr-module-hackrf',\
 'sudo apt-get -y remove uhd-host uhd-soapysdr soapysdr-module-uhd',\
 'sudo apt-get -y remove umtrx uhd-host uhd-soapysdr soapysdr-module-uhd',\
 'sudo apt-get -y remove miri-sdr soapysdr-module-mirisdr',\
 'sudo apt-get -y remove soapysdr-module-rfspace',\
 'sudo apt-get -y remove airspy soapysdr-module-airspy',\
 'sudo apt-get -y remove libboost-dev libcppunit-dev libfftw3-dev python-dev swig python-numpy doxygen python-cheetah python-gtk2-dev python-qt4 python-qwt5-qt4 libxi-dev libqt4-opengl-dev libqwt5-qt4-dev python-lxml',\
 'sudo apt-get -y remove gnuradio',\
 'sudo apt-get -y remove libsoapysdr-dev',\
 'sudo apt-get -y remove gr-fcdproplus',
 ]
for i in aa:
	args=shlex.split(i)
	p=subprocess.Popen(args)
	p.wait()

sub = subprocess.call('rm -rf gr-osmosdr', shell=True)
if sub == 0:
	print 'Uninstall Sucessfull!'