嗯,终于把材料买齐了,首先开始准备(其实这个实验我做了还蛮久的,网上的有一些坑的地方),要注意,本文的是Limesdr Mini,并不是Limesdr
实验器材
- limesdr mini
- 双工器(我问过大佬,大佬说可以不用)
- 馈线两根,内螺内针
- 天线一根,内螺内针,淘宝搜索lte天线就有了
- 一台ubuntu16.04的虚拟机(以下实验我重试了好几次,因为系统问题,故每张截图的机子有所不同,但是操作一样,不影响,切忌一定要用16.04的版本,否则最新的不支持openairinterface5g)
器材照片
虚拟机配置
安装完ubuntu16.04之后先不要装vmtools
首先先更新
- 首先运行software-updater
- 终端执行以下命令,:sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt autoremove -y && sudo apt autoclean -y
然后安装低延时内核
- sudo apt-get install linux-image-`uname -r | cut -d- -f1-2`-lowlatency
- sudo apt-get install linux-headers-`uname -r | cut -d- -f1-2`-lowlatency
- reboot
- 然后手动卸载以前的内核,否则不会使用低延时的,还是会用普通内核的
- 安装vmtools并重启
安装完内核重启之后,就可以开始搭建limesdr的环境了
一,安装依赖
- sudo apt-get install cmake g++ libpython-dev python-numpy swig git libsqlite3-dev libi2c-dev libusb-1.0-0-dev libwxgtk3.0-dev freeglut3-dev
二,安装soapysdr
- cd ~
- git clone https://github.com/pothosware/SoapySDR.git
- cd SoapySDR
- mkdir build && cd build
- cmake ..
- make -j4
- sudo make install
- sudo ldconfig
- SoapySDRUtil –info查看有没有错误
三,安装limesdr开发套件
- cd ~
- git clone https://github.com/myriadrf/LimeSuite.git
- cd LimeSuite
- cd build
- cmake ..
- make -j4
- sudo make install
- sudo ldconfig
- cd ../udev-rules/
- sudo bash install.sh
可选(推介),更新Limesdr固件(有几率变砖)
- 插上Limesdr Mini
- sudo LimeUtil —update
- 等待更新完成
四,安装USRP驱动(这个我也不知道为什么要装,opencell和网上的大佬说要)
- sudo apt-get install libboost-all-dev libusb-1.0-0-dev python-mako doxygen python-docutils python-requests cmake build-essential python-pip
- pip install setuptools
- cd ~
- git clone git://github.com/EttusResearch/uhd.git
- cd uhd; mkdir host/build; cd host/build
- cmake -DCMAKE_INSTALL_PREFIX=/usr ..
- sudo make -j4
- sudo make install
- sudo ldconfig
- sudo /usr/lib/uhd/utils/uhd_images_downloader.py
五,下载opencells的补丁
- cd ~
- wget https://open-cells.com/d5138782a8739209ec5760865b1e53b0/opencells-mods-20170823.tgz
- tar xf opencells-mods-20170823.tgz
六,编译ENB
- cd ~
- git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
- cd openairinterface5g
- git checkout 17b9a9e917ce2a3a8c7004c7b9a221c350ddfe17 -b ubuntu
- git apply ../opencells-mods/eNB.patch
- source oaienv
- sudo ./cmake_targets/build_oai -I
- sudo ./cmake_targets/build_oai -c -w LMSSDR –eNB -x
此时可能会编译出错
排错
- vi targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp,跳到196行
- 把LMS_VCTCXOWrite(lms_device,129)改为LMS_VCTCXOWrite(lms_device,129,true)
保存,重新编译一下
- sudo ./cmake_targets/build_oai -c -w LMSSDR –eNB -x(是两个“-”eNB)
七,编译EPC
- git clone https://github.com/OPENAIRINTERFACE/openair-cn.git
- cd openair-cn
- git checkout 724542d0b59797b010af8c5df15af7f669c1e838 -b ubuntu
- git apply ~/opencells-mods/EPC.patch
- source oaienv; cd scripts
- ./build_hss -i
- 设置mysql密码,我这里设置为123
- 再输入一次
- 问到是否安装freeDiameter,输入y
- 以下二选一,选择(空格)apache或者lighttpd,确定(tab)(我选择了apache)
- 问到是否安装phpmyadmin,可装可不装,我选择不装
7. ./build_mme -i
- 提示安装freeDiameter,不安装
- 提示安装asnic rev 1516补丁,不安装
- 提示安装libgtpnl,安装
- 提示安装wireshark-common,可以装可以不装(我选择了安装)
- 同理,可装可不装(我选择了安装)
8. ./build_spgw -i
- 提示安装libgtpnl,不安装
9. 正式安装
- ./build_hss -c -v
- ./build_mme -v
- ./build_spgw -v
八,配置EPC
- 拷贝配置文件
- cd ~
- sudo mkdir -p /usr/local/etc/oai
- sudo cp -rp opencells-mods/config_epc/* /usr/local/etc/oai
- 生成证书
- cd openair-cn; source oaienv; cd scripts
- ./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter hss.OpenAir5G.Alliance
- ./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter mme.OpenAir5G.Alliance
- 配置网卡(用于访问互联网)
- sudo sed -i “s/PGW_INTERFACE_NAME_FOR_SGI.*/PGW_INTERFACE_NAME_FOR_SGI = \”`ifconfig | grep “Link” | awk ‘{print $1}’ | grep “en”`\”;/g” /usr/local/etc/oai/spgw.conf
- 配置访问MySQL数据库时候的密码,”/usr/local/etc/oai/hss.conf”,此处假定MySQL的密码为”123″(就是刚刚Mysql设置的密码)
- sudo sed -i “s/^MYSQL_pass.*/MYSQL_pass = \”123\”/g” /usr/local/etc/oai/hss.conf
- 导入数据库,建立表结构
- ./hss_db_import 127.0.0.1 root 123 oai_db ~/opencells-mods/opencells_db.sql
九,修改UE使用的配置文件
- cd ~
- cd openairinterface5g; source oaienv
- sed -i “s/mobile_network_code.*/mobile_network_code = \”92\”;/g” ./targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.lmssdr.conf
- vi ./targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.lmssdr.conf
- 把以下内容修改
- 改为,并保存
十,修改hosts以及hostname
- sudo vi /etc/hosts(删除里面的所有东西,并改为以下)
- sudo vi /etc/hostname(删除原有,并修改为)
十一,测试
- 打开四个终端
- 启动hss:
- echo -ne “\033]0;HSS\007”
- cd openair-cn; source oaienv; cd scripts;(清理数据库,否则会不能联网,输入一次就ok了)
- ./hss_db_import 127.0.0.1 root 123 oai_db ~/opencells-mods/opencells_db.sql(我这个图是之前的)
- ./run_hss
3. 启动mme
- echo -ne “\033]0;MME\007”
- cd ~
- cd openair-cn; source oaienv; cd scripts;
- ./run_mme
4. 启动spgw
- echo -ne “\033]0;SPGW\007”
- cd ~
- cd openair-cn; source oaienv; cd scripts;
- sudo -E ./run_spgw
5. 插上limesdr mini
6. 输入LimeUtil –find,看看能不能找到sdr
7. 下载射频文件,因为OAI官方不带limesdr mini的射频文件,注意是mini
8. 剩下一个终端输入
- echo -ne “\033]0;EUE\007”
- cd ~
- cd openairinterface5g; source oaienv
- sudo -E ./cmake_targets/lte_build_oai/build/lte-softmodem -O ./targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.lmssdr.conf –rf-config-file ../trx-lms7002m/config-limeSDR/LimeSDR_Mini_above_1p8GHz.ini -d
- 成功~,接下来就是买lte测试卡了,以及读卡器,由于现在是过年期间,本人还没有买测试卡
- 如果出现以下警告代表采样率不足(大佬说硬件的锅)
一些比较bug的地方
- 如果你没有开启usb3.0模式,然后你用usb2.0模式下的虚拟机去更新LimesdrMini固件,可能会导致LimesdrMini在LimeUtil显示为usb2.0并非3.0,然后LimeSuite有可能会连不上sdr,解决方法是,开启usb3.0模式,并在usb3.0模式里面重新更新一次LimesdrMini的固件,还有就是USB延长线要用usb3.0的,第一张图我用了usb2.0(没发现坑之前)
相关资料
- http://www.aumoc.com/index.php/2018/12/27/ubuntu-18-04-limesdr/
- https://blog.csdn.net/BUPTOctopus/article/details/81560514
- https://gitlab.eurecom.fr/oai/openairinterface5g
- https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/HowToConnectCOTSUEwithOAIeNBNew
- https://github.com/OPENAIRINTERFACE/openair-cn
- https://open-cells.com/index.php/blog/
- https://bastienbaranoff.wordpress.com/2018/10/23/openairinterface-4g-lte-with-limesdr_mini/