[OpenAirInterface实战-7] :OAI编译环境的架构、搭建、目标代码的编译

作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客

本文网址:https://blog.csdn.net/HiWangWenBing/article/details/120556060


目录

第1章 概述

1.1 信息来源

1.2 代码补充说明

1.3 开发环境的架构

1.4 OAI RAN软件的安装启动步骤

第2章 步骤1:Linux编译服务器的选择

2.1 官方指南

第3章 步骤2:Linux编译服务器的内核配置

3.1 官方指南

第4章 步骤3:源代码软件工程的github下载

4.1 官方指南

4.2 手工下载源文件的压缩文件(只适合本地看代码,不适合编译源代码)

4.3 Linux下通过git clone获取(适合编译源代码)

第5章 步骤4:构建X86可执行文件

5.1 官方指南:

5.2 主要的二进制可执行文件输出

5.3 辅助文件输出

5.4 重要的编译功能选项

5.5 多用户环境下,编译前的准备

5.6 构建外部依赖文件

5.7 构建LTE UE, LTE eNodeB , NR UE, NR gNodeB,RF USRP可执行文件

5.8 Build LTE UE and eNB with RF Simulators

5.9 build NR UE and gNB with RF Simulators

5.10 单独构建PHY Simulators

5.11 构建可选的库,如telnet或其他

第6章 build_oai所有选项解读

第7章 构建成功的验证

7.1 静态验证

7.2 动态运行验证(运行程序)



第1章 概述

1.1 信息来源

(1)OAI主页

oai / openairinterface5G · GitLabhttps://gitlab.eurecom.fr/oai/openairinterface5g(2)OAI build 5G的主页

doc/BUILD.md · develop · oai / openairinterface5G · GitLabhttps://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/BUILD.md注意:

目前为止,5G NR的代码还在develop分支上,而不master分支。

1.2 代码补充说明

(1)4G LTE核心网EPC是一个独立的项目,不是OAI RAN的一部分Home · OPENAIRINTERFACE/openair-epc-fed Wiki · GitHub

(2)5G NR核心网5GC是一个独立项目:

这里只包括4G/5G UE和4G/5G基站的代码。

1.3 开发环境的架构

[OpenAirInterface实战-7] :OAI编译环境的架构、搭建、目标代码的编译_第1张图片

(1)Windows:MobaXterm:

用于远程登录到Linux build server,在编译时,也可以使用SecureCRT替代,但运行目标代码时,最好能够使用MobaXterm,MobaXterm支持远程图形化显示,目标代码运行时,可以动态的图形化显示星座图。

(2)Linux:源文件编译路径:

xxx/oai/…     =》源文件按照路径

xxx/oai/openairinterface5g/cmake_targets/    =》编译路径

xxx/oai/openairinterface5g/cmake_targets/ran_build/build   =》编译后的目标代码路径

(3)github:OAI源代码开源项目

(4)第三方库服务器

在编译的过程中,需要在线下载第三方库,因此需要预先配置Linux服务器,确保Linux编译服务器能够从远程下载到相应的文件。

1.4 OAI RAN软件的安装启动步骤

步骤1:Linux编译服务器的选择

步骤2:Linux编译服务器的内核配置

步骤3:源代码软件工程的github下载

步骤4:构建目标可执行文件

步骤5:Linux运行服务器的选择

步骤6:Linux运行服务器的内核配置

步骤7:部署和运行目标程序

步骤8:功能测试

本文重点关注步骤1-4

第2章 步骤1:Linux编译服务器的选择

2.1 官方指南

OpenAirSystemRequirements · Wiki · oai / openairinterface5G · GitLab

第3章 步骤2:Linux编译服务器的内核配置

3.1 官方指南

第4章 步骤3:源代码软件工程的github下载

4.1 官方指南

doc/GET_SOURCES.md · develop · oai / openairinterface5G · GitLabhttps://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/GET_SOURCES.md

4.2 手工下载源文件的压缩文件(只适合本地看代码,不适合编译源代码)

(1)通过windows IE 登录到如下的主页

Files · develop · oai / openairinterface5G · GitLabOpenairinterface 5G Wireless Implementationhttps://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/develop

(2)选择源文件的压缩文件的格式

[OpenAirInterface实战-7] :OAI编译环境的架构、搭建、目标代码的编译_第2张图片

获得压缩文件:openairinterface5g-develop.tar.gz

(3)通过windows解压工具解压源代码

(4)通过FTP把下载的压缩文件传输到Linux 编译服务器指定的oai工作目录中

例如:

/home/username/oai

(5)解压openairinterface5g-develop.tar.gz到当前目录

 tar -zxvf openairinterface5g-develop.tar.gz

解压后得到:openairinterface5g-develop目录。

为了简化名称,可以修改为:openairinterface5g

mv openairinterface5g-develop openairinterface5g
~/oai/openairinterface5g$ ls
CHANGELOG.md  cmake_targets  CONTRIBUTING.md  executables  nfapi      openair1  openshift   targets
charts        common         doc              LICENSE      NOTICE.md  openair2  pre-commit
ci-scripts    configuration  docker           maketags     oaienv     openair3  README.md

4.3 Linux下通过git clone获取(适合编译源代码)

(1)配置git

git config --global user.name "Your Name"
git config --global user.email "Your email address"

如果是OAI社区的开发者,这个是必须的。

如果是OAI社区的使用者,这个不是必须,但最好能够提供

备注:只需要执行一次。

(2)在你的Ubuntu编译服务器上安装访问git服务器的安全证书

echo -n | openssl s_client -showcerts -connect gitlab.eurecom.fr:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt

备注:只需要执行一次。

(3)disable证书检查

如果你没有权限访问/etc/ssl,则需要disalbe本地的证书检查。

Disable certificate check completely if you do not have root access to /etc/ssl directory

git config --global http.sslverify false

备注:只需要执行一次。

(4)获取所有分支的源代码,包括主分支和各种开发分支(耗时10分钟左右)

/home/username/oai

git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git

(5)检查当前的分支

cd openairinterface5g

git branch

master

备注:默认当前分支为master主分支。

(6)切换到develop分支

cd openairinterface5g

git checkout develop

Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.

备注:

The tag naming conventions are :

  • On master branch: v1.x.y where
    • x is the minor release number, incremented every 2-3 months when we are merging develop into master branch.
    • y is the maintenance number, starting at 0 when we do a minor release and being incremented when a bug fix is incorporated into master branch.
  • On develop branch yyyy.wxx
    • yyyy is the calendar year
    • xx the week number within the year

(7)更新代码

//更新当前分支
git pull

//把xxxx分支合并到自己分支
git merger xxx

至此,代码已经准备好,可以进行编译了。
 

第5章 步骤4:构建X86可执行文件

5.1 官方指南:

doc/BUILD.md · develop · oai / openairinterface5G · GitLab

5.2 主要的二进制可执行文件输出

(1)LTE

  • The LTE UE: lte-uesoftmodem
  • The LTE eNodeB: lte-softmodem
  • The LTE PHY simulators: dlsim and ulsim  (LTE上下行PHY的模拟器)

(2)NR

  • The 5G UE: nr-uesoftmodem  => gnb可执行文件(X86)
  • The 5G gNodeB: nr-softmodem -》ue可执行文件 (X86)
  • The 5G PHY simulators: nr_dlschsim nr_dlsim nr_pbchsim nr_pucchsim nr_ulschsim nr_ulsim polartest smallblocktest ulsim ldpctest(5Gd的PHY模拟器)

5.3 辅助文件输出

  • conf2uedata: a binary used to build the UE data from a configuration file. The created file emulates the sim card of a 3GPP compliant phone.
  • nvram: a binary used to build UE (IMEI...) and EMM (IMSI, registered PLMN) non volatile data.
  • rb_tool: radio bearer utility
  • genids T Tracer utility, used at build time to generate T_IDs.h include file.

5.4 重要的编译功能选项

OAI软件支持很多的业务场景,比如是否支持S1接口,是否使用PHY或RF模拟器。

不同的场景,需要编译的软件模块不同,内部的接口不同,这些业务场景选项,可以通过配置文件或命令行选项来实现。

这些选择对编译的输出文件的功能有很大的影响,因此需要根据自身的需要进行选择。

(1)是否支持S1接口

  • --s1       =》支持真实的S1接口
  • --noS1  =》不支持真实的S1接口,采用S1模拟器器

(2)底层硬件模拟器

  • RF模拟器
  • PHY模拟器
  • L2模拟器

5.5 多用户环境下,编译前的准备

在OAI编译的过程中个,会在/tmp等目录中下载和生产中间文件,因此编译脚本会先清除给目录中的内容,这些文件为多用户共享。

在多用户环境中,其他用户的用户也会在此目录下生成文件,用户A,无法删除用户B在此目录中创建的文件,导致编译出错。

因此,在编译前需要预先进行手工处理:

(1)清空/tmp目录下的内容(这里有潜在的风险,注意避免错误删除其他)

cd /tmp


/tmp>ls
asn1c  protobuf-3.3.0  protobuf-c  protobuf-cpp-3.3.0.tar.gz


/tmp>sudo rm -rf *

5.6 构建外部依赖文件

外部依赖文件与目标文件的场景无关,都需要预先编译,否则会出现运行时的依赖库缺乏的问题。

cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -I

5.7 构建LTE UE, LTE eNodeB , NR UE, NR gNodeB,RF USRP可执行文件

cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -I -w USRP --eNB --UE --nrUE --gNB
  • The -I option is to install pre-requisites, you only need it the first time you build the softmodem or when some oai dependencies have changed. Note: for Ubuntu 20 use cmake_targets/install_external_packages.ubuntu20 instead! =》该选项提醒编译器,检查并安装相关的依赖性文件。
  • The -w option is to select the radio head support you want to include in your build. Radio head support is provided via a shared library, which is called the "oai device" The build script creates a soft link from liboai_device.so to the true device which will be used at run-time (here the USRP one,liboai_usrpdevif.so . USRP is the only hardware tested today in the Continuous Integration process. The RF simulator RF simulator is implemented as a specific device replacing RF hardware, it can be specifically built using -w SIMU option, but is also built during any softmodem build.
  • --eNB is to build the lte-softmodem executable and all required shared libraries=》LTE基站
  • --UE is to build the lte-uesoftmodem executable and all required shared libraries=》LTE手机
  • --gNB is to build the nr-softmodem executable and all required shared libraries =》NR基站
  • --nrUE is to build the nr-uesoftmodem executable and all required shared libraries =》NR手机

当然,也可以单独构建某个目标文件或LTE目标文件或NR目标文件。

cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -w USRP --nrUE --gNB
cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -w USRP --eNB --UE

5.8 Build LTE UE and eNB with RF Simulators

cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -w SIMU --eNB --UE


Compiling tcp_bridge_oai
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/tcp_bridge_oai.Rel15.txt
tcp_bridge_oai compiled


Building transport protocol libraries
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/oai_eth_transpro.Rel15.txt 

oai_eth_transport compiled


liboai_transpro.so is linked to ETHERNET transport
10. Bypassing the Tests ...
BUILD SHOULD BE SUCCESSFUL

5.9 build NR UE and gNB with RF Simulators

cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -w SIMU --nrUE --gNB

输出结果:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/ran_build/build
Compiling nr-softmodem...
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/nr-softmodem.Rel15.txt

nr-softmodem compiled


Compiling nr-uesoftmodem...
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/nr-uesoftmodem.Rel15.txt
nr-uesoftmodem compiled


Building shared libraries common to UE and gNB
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/params_libconfig.Rel15.txt
params_libconfig compiled
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/coding.Rel15.txt
coding compiled


Compiling rfsimulator
Log file for compilation is being written to: /home/wangwenbing/oai/openairinterface5g/cmake_targets/log/rfsimulator.Rel15.txt
rfsimulator compiled

5.10 单独构建PHY Simulators

(1)方法1

cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai --phy_simulators

(2)方法2:

cd /openairinterface5g/cmake_targets/ran_build/build

make rfsimulator

5.11 构建可选的库,如telnet或其他

(1)伴随性构建

./build_oai -I -w USRP --eNB --UE --build-lib telnetsrv

(2)独立构建

./build_oai  --build-lib telnetsrv

(3)构建其他库

./build_oai  --build-lib all

第6章 build_oai所有选项解读

Option Status Description
-h maintained get help
-c maintained

erase all previously built files for this target before starting the new build. =》针对某个目标架构,清楚先前的文件,全部重新构建。

-C maintained, needs improvement erase all previously built files for any target before starting the new build. =》针对所有目标架构,清楚先前的文件,全部重新构建。
--verbose-compile maintained

get compilation messages, as when running make or gcc directly.

=》显示编译过程

--cflags_processor maintained used to pass options to the compiler. =》传递编译flag
--clean-kernel unknown no code in the script corresponding to this option
--install-system-files maintained

install oai built binaries in linux system files repositories

-w maintained and tested in CI for USRP device

build corresponding oai device and create the soft link to enforce this device usage at run-time =》构建OAI RF设备,并创建相关的软连接,以便使用真实的OAI设备。目前只有一款真实的RF设备USRP 是经过测试过的。

如果没有使用USRP设备,可以不使用该选项。

--phy_simulators maintained, tested in CI

build all PHY simulators, a set of executables allowing unitary tests of LTE and 5G channel implementation within oai. =》构建所有的物理层simulators,包括LTE和NR.

--core_simulators
-s start选项,编译后,根据测试脚本的定义,自动启动持续集成CI测试。
--run-group
-I maintained, tested in CI install external dependencies before starting the build =>是否需要安装外部依然性文件。
--install-optional-packages maintained install optional packages, useful for developing and testing. look at the check_install_additional_tools function in cmake_targets/tools/build_helper script to get the list =》编译时,先安装可选包。
-g maintained

Specifies the level of debugging options used to build the binaries. Available levels are Release, RelWithDebInfo, MinSizeRe and Debug. If -g is not specified, Release is used, if -g is used without any level, Debug is used.

=》打开编译的debug信息。

-G maintained Display Cmake debugging messages =》显示cmake debug消息
--eNB maintained and tested in CI build lte-softmodem the LTE eNodeB =》构建LTE eNB可执行文件。
--UE maintained and tested in CI build lte-uesoftmodem the LTE UE =》构建LTE UE可执行文件
--gNB maintained and tested in CI build nr-softmodem the 5G gNodeB =》构建NR gNB可执行文件
--nrUE maintained and tested in CI build nr-uesoftmodem the 5G UE =》构建5G UE 可执行文件
--usrp-recplay deprecated use the USRP configuration parameters to use the record player.
--build-lib maintained build optional shared library(ies), which can then be loaded at run time via command line option. Use the --help option to get the list of supported optional libraries. all can be used to build all available optional libraries. =》是不需要构建可选的共享库so库
--UE-conf-nvram maintained Specifies the path to the input file used by the conf2uedata utility. defaults to openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
--UE-gen-nvram maintained Specifies the path where the output file created by the conf2uedata utility will be placed. Defaults to target/bin
-V deprecated Used to build with support for synchronization diagram utility. This is now available via the T-Tracer and is included if T-Tracer is not disabled.
--build-doxygen unknown build doxygen documentation, many oai source files do not include doxygen comments
--disable-deadline --enable-deadline --disable-cpu-affinity deprecated These options were used to activate or de-activate specific code depending on the choice of a specific linux scheduling mode. This has not been tested for a while and should be implemented as configuration options
--disable-T-Tracer maintained, to be tested Remove T_Tracer and console LOG messages except error messages.
--ue-autotest-trace --ue-timing --ue-trace deprecated Were used to enable conditional code implementing debugging messages or debugging statistics. These functionalities are now either available from run-time options or not maintained.
--build-eclipse unknown

第7章 构建成功的验证

7.1 静态验证

(1)build路径的生成

xxx/oai/openairinterface5g/cmake_targets/ran_build/build

(2)可执行文件生成

xxx/oai/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem

xxx/oai/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem

xxx/oai/openairinterface5g/cmake_targets/ran_build/build/librfsimulator.so

7.2 动态运行验证(运行程序)

待续。。。。。


作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客

本文网址:https://blog.csdn.net/HiWangWenBing/article/details/120556060

你可能感兴趣的:(OAI,(Open,Air,Interface),ORAN,OAI,编译,RAN)