ubuntu 16.04系统LimeSDR MINi使用OpenAirInterface搭建LTE实验环境

这个实验也是我做了很长的时间,网上的文章都是各种坑,我做的时候几乎是所有的问题都被我遇上过哈哈哈,如果不懂就在下方留言8.

更新一下ubuntu

  • 首先运行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

操作系统调整

更换4.15的内核:

  1. wget linux-headers-4.15.18-041518_4.15.18-041518.201804190330_all.deb
  2. wget linux-headers-4.15.18-041518-lowlatency_4.15.18-041518.201804190330_amd64.deb
  3. wget linux-image-4.15.18-041518-lowlatency_4.15.18-041518.201804190330_amd64.deb
  4. sudo dpkg -i *.deb
  5. sudo update-grub
  6. sudo reboot

参考ubuntu 16.04低延迟内核安装低延时内核CPU调整为最大性能模式,并且不允许降低频率

  1. sudo apt-get install cpufrequtils
  2. sudo touch /etc/default/cpufrequtils
  3. sudo sed -i “/GOVERNOR.*/d” /etc/default/cpufrequtils
  4. test -s /etc/default/cpufrequtils && sudo sed -i ‘$a\GOVERNOR=\”performance\”‘ /etc/default/cpufrequtils || echo “GOVERNOR=\”performance\”” | sudo tee /etc/default/cpufrequtils
  5. sudo update-rc.d ondemand disable
  6. sudo apt-get install linux-image-`uname -r | cut -d- -f1-2`-lowlatency
  7. sudo apt-get install linux-headers-`uname -r | cut -d- -f1-2`-lowlatency
  8. sudo reboot
内核很重要,一定要选多内核, 不是会不兼容openairinterface5g,导致后面编译报错,我用的内核版本是4.15

开始搭建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:

  1. cd ~
  2. git clone https://github.com/pothosware/SoapySDR.git
  3. cd SoapySDR
  4. mkdir build && cd build
  5. cmake ..
  6. make -j4
  7. sudo make install
  8. sudo ldconfig
  9. SoapySDRUtil –info

编译安装LimeSDR:

  1. cd ~
  2. git clone https://github.com/myriadrf/LimeSuite.git
  3. cd LimeSuite
  4. git checkout v17.06.0
  5. cd build
  6. cmake ..
  7. make -j4
  8. sudo make install
  9. sudo ldconfig
  10. cd ../udev-rules/
  11. sudo bash install.sh
  • 更新Limesdr固件
  1. 插上Limesdr Mini
  2. sudo LimeUtil -update

编译安装USRP驱动:

  1. sudo apt-get install libboost-all-dev libusb-1.0-0-dev python-mako doxygen python-docutils python-requests cmake build-essential python-pip
  2. pip install setuptools
  3. cd ~
  4. git clone git://github.com/EttusResearch/uhd.git
  5. cd uhd; mkdir host/build; cd host/build
  6. cmake -DCMAKE_INSTALL_PREFIX=/usr ..
  7. sudo make -j4
  8. sudo make install
  9. sudo ldconfig
  10. sudo /usr/lib/uhd/utils/uhd_images_downloader.py

下载并解压缩需要的补丁:

  1. cd ~
  2. wget https://open-cells.com/d5138782a8739209ec5760865b1e53b0/opencells-mods-20170823.tgz
  3. tar xf opencells-mods-20170823.tgz

下载并编译eNB :

  1. cd ~
  2. git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
  3. cd openairinterface5g
  4. git checkout 17b9a9e917ce2a3a8c7004c7b9a221c350ddfe17 -b ubuntu
  5. git apply ../opencells-mods/eNB.patch
  6. source oaienv
  7. sudo ./cmake_targets/build_oai -I
  8. sudo ./cmake_targets/build_oai -c -w LMSSDR –eNB -x

这里特别容易报错,因为版本的问题,或者是内核的问题

在编译的过程中报错了一定要看日志,红色箭头的就是日志的地址
  1. nano targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
  2. 把LMS_VCTCXOWrite(lms_device,129)改为LMS_VCTCXOWrite(lms_device,129,true)

这个是我在一个大佬上看到的解决的报错,但是我改了也是解决不了,换了一个openairinterfac5g 的版本就编译通过了。

  • sudo ./cmake_targets/build_oai -c -w LMSSDR –eNB -x

编译EPC

  1. git clone https://github.com/OPENAIRINTERFACE/openair-cn.git
  2. cd openair-cn
  3. git checkout 724542d0b59797b010af8c5df15af7f669c1e838 -b ubuntu
  4. git apply ~/opencells-mods/EPC.patch
  5. source oaienv; cd scripts
  6. ./build_hss -i

设置mysql密码,我设置的是123

然后再输入一次密码

Do you want to install freeDiameter 1.2.0 ?<y/N>: yes

我选择了apache 这个可以自行选择

phpmyadmin 我选择的是不装

  • ./build_mme -i

Do you want to install freeDiameter 1.2.0 ?<y/N>: no

Do you want to install asn1c rev 1516 patched? <y/N>: no

Do you want to install libgtpnl ? <y/N>: yes

我选择安装 也是可装可不装的

  • ./build_spgw -i

Do you want to install libgtpnl ? <y/N>: no

正式进行编译操作 :

  • ./build_hss -c -v
  • ./build_mme -v
  • ./build_spgw -v

配置EPC

拷贝配置文件

  1. cd ~
  2. sudo mkdir -p /usr/local/etc/oai
  3. sudo cp -rp opencells-mods/config_epc/* /usr/local/etc/oai

生成证书文件

  1. cd openair-cn; source oaienv; cd scripts
  2. ./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter hss.OpenAir5G.Alliance
  3. ./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″
  • 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需要使用的配置文件:

  1. cd ~
  2. cd openairinterface5g; source oaienv
  3. sed -i “s/mobile_network_code.*/mobile_network_code = \”92\”;/g”
  4. ./targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.lmssdr.conf
    nano ./targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.lmssdr.conf
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.148";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.150/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.150/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152
};

改成

////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.148";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.150/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.150/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152
};

本来想放图片的 但是用文字会方便一些复制黏贴 hhh

修改hosts以及hostname:

  • sudo nano /etc/hosts
127.0.0.1     localhost     
127.0.1.1 yourhostname.openair5G.eur yourhostname
127.0.1.1 hss.openair5G.eur hss
  • sudo nano /etc/hostname

先当前内容全部删掉,然后输入nano //其实这里你想输入什么就输入什么,我输入的是nano.

测试功能,按照顺序打开四个独立shell(终端)

run_hhs.sh
  • echo -ne “\033]0;HSS\007”
  • cd openair-cn; source oaienv; cd scripts; // 在需要运行之前先清理一下数据库才行,否则可能导致设备无法入网,听大佬说这是个BUG
  • ./hss_db_import 127.0.0.1 root 123 oai_db ~/opencells-mods/opencells_db.sql
  • ./run_hss
run_mme.sh
  • echo -ne “\033]0;MME\007”
  • cd ~
  • cd openair-cn; source oaienv; cd scripts;
  • ./run_mme
run_spgw.sh
  • echo -ne “\033]0;SPGW\007”
  • cd ~
  • cd openair-cn; source oaienv; cd scripts;
  • sudo -E ./run_spgw

因为我用的是LimeSDR mini,所以要下另外的射频文件,因为官方不带mini的SDR文件

  • cd ~
  • git clone https://github.com/myriadrf/trx-lms7002m.git
  • 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 ./targets/ARCH/LMSSDR/LimeSDR_above_1p8GHz_1v4.ini -d
搭建成

因为还没有来得及测试就发了文章,后续我会更新本文章,如果出现任何问题都可以在以下留言。

参考链接:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s