Commit 11315ef6 authored by Raphael Defosseux's avatar Raphael Defosseux

fix(build): automatically applying UHD TDD patch for LTE

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 474cde3b
......@@ -346,11 +346,31 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git
cd uhd
# For our legacy TDD eNB running with a B2xx RF board
# the following patch has to be applied
if [[ -v UHD_VERSION ]]; then
git checkout tags/v${UHD_VERSION}
# We recommend to use not older than 3.15.0.0
if [[ "$UHD_VERSION" == "3.15.0.0" ]]; then
# Tested that patch for the following versions:
# - 3.15.0.0
git apply $OPENAIR_DIR/cmake_targets/tools/uhd-3.15-tdd-patch.diff
else
# Tested that patch for the following versions:
# - 4.0.0.0
# - 4.1.0.0
# - 4.1.0.5
# - 4.2.0.0
# - 4.2.0.1
# - 4.3.0.0-rc1
git apply $OPENAIR_DIR/cmake_targets/tools/uhd-4.x-tdd-patch.diff
fi
else
git checkout tags/v4.0.0.0
git apply $OPENAIR_DIR/cmake_targets/tools/uhd-4.x-tdd-patch.diff
fi
# Printing out the results of the patch to make sure it was properly applied
git diff
mkdir -p host/build
cd host/build || true
$CMAKE ../ -GNinja
......
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 1be8c263b..f64546914 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -1269,10 +1269,10 @@ void b200_impl::update_atrs(void)
if (enb_rx and not enb_tx) fd = rxonly;
if (not enb_rx and enb_tx) fd = txonly;
gpio_atr_3000::sptr atr = perif.atr;
- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF);
- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly);
- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly);
- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd);
+ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7));
+ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7));
}
if (_radio_perifs.size() > _fe2 and _radio_perifs[_fe2].atr)
{
@@ -1287,10 +1287,10 @@ void b200_impl::update_atrs(void)
if (enb_rx and not enb_tx) fd = rxonly;
if (not enb_rx and enb_tx) fd = txonly;
gpio_atr_3000::sptr atr = perif.atr;
- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF);
- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly);
- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly);
- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd);
+ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7));
+ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7));
}
}
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 6de161e87..432af5784 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -1410,10 +1410,10 @@ void b200_impl::update_atrs(void)
if (not enb_rx and enb_tx)
fd = txonly;
gpio_atr_3000::sptr atr = perif.atr;
- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF);
- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly);
- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly);
- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd);
+ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7));
+ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7));
}
if (_radio_perifs.size() > _fe2 and _radio_perifs[_fe2].atr) {
radio_perifs_t& perif = _radio_perifs[_fe2];
@@ -1431,10 +1431,10 @@ void b200_impl::update_atrs(void)
if (not enb_rx and enb_tx)
fd = txonly;
gpio_atr_3000::sptr atr = perif.atr;
- atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF);
- atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly);
- atr->set_atr_reg(ATR_REG_TX_ONLY, txonly);
- atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd);
+ atr->set_atr_reg(ATR_REG_IDLE, STATE_OFF | (1<<7));
+ atr->set_atr_reg(ATR_REG_RX_ONLY, rxonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_TX_ONLY, txonly | (1<<7));
+ atr->set_atr_reg(ATR_REG_FULL_DUPLEX, fd | (1<<7));
}
}
......@@ -88,12 +88,15 @@ You can build any oai softmodem executable separately, you may not need all of t
After completing the build, the binaries are available in the `cmake_targets/ran_build/build` directory. A copy is also available in the `target/bin` directory, with all binaries suffixed by the 3GPP release number, today .Rel15.
## Installing UHD from source
When installing the pre-requisites, especially the `UHD` driver, you can now specify if you want to install from source or not.
- For `fedora`-based OS, it was already the case all the time. But now you can specify which version to install.
- For `ubuntu` OS, the Ettus PPA currently installs the following versions:
* `Ubuntu16.04`: --> version `3.15.0.0`
* `Ubuntu18.04`: --> version `4.1.0.0`
* `Ubuntu20.04`: --> version `4.2.0.1`
```bash
export BUILD_UHD_FROM_SOURCE=True
......@@ -103,49 +106,15 @@ export UHD_VERSION=3.15.0.0
The `UHD_VERSION` env variable `SHALL` be a valid tag (minus `v`) from the `https://github.com/EttusResearch/uhd.git` repository.
## Issue when building `nasmeh` module ##
A lot of users and contributors have faced the issue: `nasmesh` module does not build.
The reason is that the linux headers are not properly installed. For example:
```bash
$ uname -r
4.4.0-145-lowlatency
$ dpkg --list | grep 4.4.0-145-lowlatency | grep headers
ii linux-headers-4.4.0-145-lowlatency 4.4.0-145.171
```
In my example it is properly installed.
Check on your environment:
```bash
$ uname -r
your-version
$ dpkg --list | grep your-version | grep headers
$
```
Install it:
**CAUTION: Note that if you are using the OAI eNB in TDD mode with B2xx boards, a patch is mandatory.**
```bash
$ sudo apt-get install --yes linux-headers-your-version
```
On CentOS or RedHat Entreprise Linux:
```bash
$ uname -r
3.10.0-1062.9.1.rt56.1033.el7.x86_64
$ yum list installed | grep kernel | grep devel
kernel-devel.x86_64 3.10.0-1062.9.1.el7 @rhel-7-server-rpms
kernel-rt-devel.x86_64 3.10.0-1062.9.1.rt56.1033.el7
```
Starting this commit, the patch is applied automatically in our automated builds.
If your kernel is generic, install `kernel-devel` package: `sudo yum install kernel-devel`
See:
In most case, your kernel is real-time. Install `kernel-rt-devel` package: `sudo yum install kernel-rt-devel`
* `cmake_targets/tools/uhd-3.15-tdd-patch.diff`
* `cmake_targets/tools/uhd-4.x-tdd-patch.diff`
* `cmake_targets/tools/build_helper` --> function `install_usrp_uhd_driver_from_source`
# Building Optional Binaries
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment