From 633fda9a6e6f77ba91178d4bccb8bbd8ddd2f84c Mon Sep 17 00:00:00 2001 From: "Frank A. Zdarsky" <fzdarsky@redhat.com> Date: Fri, 2 Jun 2017 12:31:19 +0200 Subject: [PATCH] minor fixes and add building drivers from source for CentOS7 Signed-off-by: Frank A. Zdarsky <fzdarsky@redhat.com> --- cmake_targets/build_oai | 1 + cmake_targets/tools/build_helper | 81 ++++++++++++++++++++++++++++---- openair2/UTIL/LOG/log.h | 3 ++ 3 files changed, 76 insertions(+), 9 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 790f1474c96..1d70f48277d 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -61,6 +61,7 @@ BUILD_DOXYGEN=0 T_TRACER="False" DISABLE_HARDWARE_DEPENDENCY="False" CMAKE_BUILD_TYPE="" +CMAKE_CMD="$CMAKE" UE_AUTOTEST_TRACE="False" BUILD_ECLIPSE=0 trap handle_ctrl_c INT diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 362dce094c9..29d839b5431 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -31,11 +31,11 @@ fi OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g") OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g") case "$OS_DISTRO" in - fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE_CMD="cmake" ;; - rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE_CMD="cmake3" ;; - centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE_CMD="cmake3" ;; - debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE_CMD="cmake" ;; - ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE_CMD="cmake" ;; + fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;; + rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; + centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; + debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; + ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; esac KERNEL_VERSION=$(uname -r | cut -d '.' -f1) KERNEL_MAJOR=$(uname -r | cut -d '.' -f2) @@ -218,6 +218,9 @@ install_protobuf_c_from_source(){ protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " ( + if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + fi cd /tmp echo "Downloading protobuf-c" rm -rf /tmp/protobuf-c @@ -232,6 +235,27 @@ install_protobuf_c_from_source(){ ) >& $protobuf_c_install_log } +install_usrp_uhd_driver_from_source(){ + uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt + echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log " + ( + cd /tmp + echo "Downloading UHD driver" + rm -rf /tmp/uhd + git clone git://github.com/EttusResearch/uhd.git + cd uhd + git checkout tags/release_003_010_001_001 + mkdir -p host/build + cd host/build + $CMAKE ../ + echo "Compiling UHD" + make + make test + $SUDO make install + $SUDO ldconfig + ) >& $uhd_install_log +} + check_install_usrp_uhd_driver(){ if [[ "$OS_DISTRO" == "ubuntu" ]]; then #first we remove old installation @@ -245,8 +269,14 @@ check_install_usrp_uhd_driver(){ $SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev $SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then - $SUDO $INSTALLER -y install python boost libusb-devel boost-devel - $SUDO $INSTALLER -y install uhd uhd-devel uhd-firmware + $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake + if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + # until EPEL repo hasn't bumped UHD driver to >=3.10 in EPEL, build driver from source + $SUDO $INSTALLER -y remove uhd uhd-devel uhd-firmware + install_ursp_uhd_driver_from_source + else + $SUDO $INSTALLER -y install uhd uhd-devel uhd-firmware + fi fi } @@ -263,6 +293,33 @@ install_usrp_uhd_driver() { fi } +install_bladerf_driver_from_source(){ + bladerf_install_log=$OPENAIR_DIR/cmake_targets/log/bladerf_install_log.txt + echo_info "\nInstalling BladeRF driver from sources. The log file for BladeRF driver installation is here: $bladerf_install_log " + ( + cd /tmp + echo "Downloading BladeRF driver" + rm -rf /tmp/bladeRF + git clone https://github.com/Nuand/bladeRF.git + cd bladeRF + git checkout tags/2016.06 + mkdir -p build + cd build + $CMAKE ../ + echo "Compiling BladeRF driver" + make + $SUDO make install + $SUDO ldconfig + echo "Downloading FPGA and firmware images" + cd /tmp/bladeRF + wget https://www.nuand.com/fx3/bladeRF_fw_latest.img + wget https://www.nuand.com/fpga/hostedx40-latest.rbf + sudo mkdir -p /usr/share/Nuand/bladeRF + sudo mv bladeRF_fw_latest.img /usr/share/Nuand/bladeRF/bladeRF_fw.img + sudo mv hostedx40-latest.rbf /usr/share/Nuand/bladeRF/hostedx40.rbf + ) >& $bladerf_install_log +} + check_install_bladerf_driver(){ if [[ "$OS_DISTRO" == "ubuntu" ]]; then if [ "$(get_distribution_release)" == "ubuntu14.04" ] ; then @@ -272,6 +329,8 @@ check_install_bladerf_driver(){ $SUDO apt-get install -y --allow-unauthenticated bladerf libbladerf-dev $SUDO apt-get install -y --allow-unauthenticated bladerf-firmware-fx3 $SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40 + elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then + install_bladerf_driver_from_source else echo_error "BladeRF Installer for OAI does not support automatic build. Install BladeRF compiling sources manually from BladeRF website" fi @@ -518,8 +577,9 @@ check_install_oai_software() { $SUDO $INSTALLER install -y \ autoconf \ automake \ + bc \ bison \ - $CMAKE_CMD \ + $CMAKE \ doxygen \ ethtool \ flex \ @@ -560,19 +620,22 @@ check_install_oai_software() { openssh-clients \ openssh-server \ openssl \ + patch \ + psmisc \ python \ subversion \ xmlstarlet \ python-pip \ wget \ kernel-headers \ + kernel-devel \ nettle-devel \ gnutls-devel \ libXpm-devel \ lapack \ lapack-devel \ blas \ - libblas-devel + blas-devel fi install_asn1c_from_source diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index 5140a08dbd4..73ad99311f6 100644 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -45,6 +45,9 @@ #include <stdarg.h> #include <time.h> #include <stdint.h> +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif #include <inttypes.h> #ifndef _GNU_SOURCE #define _GNU_SOURCE -- GitLab