|
|
|
@@ -24,6 +24,22 @@
|
|
|
|
|
# authors Laurent Thomas, Lionel GAUTHIER
|
|
|
|
|
#
|
|
|
|
|
#######################################
|
|
|
|
|
if [ ! -f /etc/os-release ]; then
|
|
|
|
|
echo "No /etc/os-release file found. You're likely on an unsupported distro."
|
|
|
|
|
exit -1
|
|
|
|
|
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="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)
|
|
|
|
|
|
|
|
|
|
SUDO='sudo -E'
|
|
|
|
|
|
|
|
|
|
###############################
|
|
|
|
@@ -66,12 +82,11 @@ echo_info() { cecho "$*" $blue ;}
|
|
|
|
|
# If we can't check the distribution, it returns "Unknown"
|
|
|
|
|
# This function return always true as exit code by design
|
|
|
|
|
# Examples:
|
|
|
|
|
# Ubuntu16.04
|
|
|
|
|
# Debian8.5
|
|
|
|
|
# ubuntu16.04
|
|
|
|
|
# debian8.5
|
|
|
|
|
get_distribution_release() {
|
|
|
|
|
local distributor
|
|
|
|
|
if distributor=$(lsb_release -si 2>/dev/null) ; then
|
|
|
|
|
echo $distributor$(lsb_release -sr)
|
|
|
|
|
if [[ ! -z "$OS_DISTRO$OS_RELEASE" ]]; then
|
|
|
|
|
echo "$OS_DISTRO$OS_RELEASE"
|
|
|
|
|
else
|
|
|
|
|
echo Unknown
|
|
|
|
|
fi
|
|
|
|
@@ -80,8 +95,11 @@ get_distribution_release() {
|
|
|
|
|
check_supported_distribution() {
|
|
|
|
|
local distribution=$(get_distribution_release)
|
|
|
|
|
case "$distribution" in
|
|
|
|
|
"Ubuntu16.04") return 0 ;;
|
|
|
|
|
"Ubuntu14.04") return 0 ;;
|
|
|
|
|
"ubuntu16.04") return 0 ;;
|
|
|
|
|
"ubuntu14.04") return 0 ;;
|
|
|
|
|
"fedora24") return 0 ;;
|
|
|
|
|
"rhel7") return 0 ;;
|
|
|
|
|
"centos7") return 0 ;;
|
|
|
|
|
esac
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
@@ -200,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
|
|
|
|
@@ -214,7 +235,29 @@ 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
|
|
|
|
|
$SUDO apt-get remove -y uhd || true
|
|
|
|
|
$SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y
|
|
|
|
@@ -225,27 +268,72 @@ check_install_usrp_uhd_driver(){
|
|
|
|
|
$SUDO apt-get update
|
|
|
|
|
$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 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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
install_usrp_uhd_driver() {
|
|
|
|
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
|
|
|
|
# We move uhd-host apart because it depends on linux kernel version
|
|
|
|
|
# On newer kernels, it fails to install
|
|
|
|
|
$SUDO apt-get -y install uhd-host
|
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
|
$SUDO uhd_images_downloader
|
|
|
|
|
else
|
|
|
|
|
$SUDO uhd_images_downloader -i $1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
|
$SUDO uhd_images_downloader
|
|
|
|
|
else
|
|
|
|
|
$SUDO uhd_images_downloader -i $1
|
|
|
|
|
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 [ "$(get_distribution_release)" == "Ubuntu14.04" ] ; then
|
|
|
|
|
$SUDO add-apt-repository -y ppa:bladerf/bladerf
|
|
|
|
|
$SUDO apt-get update
|
|
|
|
|
fi
|
|
|
|
|
$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
|
|
|
|
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
|
|
|
|
if [ "$(get_distribution_release)" == "ubuntu14.04" ] ; then
|
|
|
|
|
$SUDO add-apt-repository -y ppa:bladerf/bladerf
|
|
|
|
|
$SUDO apt-get update
|
|
|
|
|
fi
|
|
|
|
|
$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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flash_firmware_bladerf() {
|
|
|
|
@@ -268,8 +356,9 @@ check_install_lmssdr_driver(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_install_additional_tools (){
|
|
|
|
|
$SUDO apt-get update
|
|
|
|
|
$SUDO apt-get install -y \
|
|
|
|
|
$SUDO $INSTALLER update -y
|
|
|
|
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
|
|
|
|
PACKAGE_LIST="\
|
|
|
|
|
check \
|
|
|
|
|
dialog \
|
|
|
|
|
dkms \
|
|
|
|
@@ -298,13 +387,73 @@ check_install_additional_tools (){
|
|
|
|
|
bc \
|
|
|
|
|
ntp \
|
|
|
|
|
python-scipy \
|
|
|
|
|
python-matplotlib
|
|
|
|
|
|
|
|
|
|
$SUDO pip install paramiko
|
|
|
|
|
$SUDO pip install pyroute2 colorama
|
|
|
|
|
python-matplotlib"
|
|
|
|
|
elif [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
|
|
|
|
|
PACKAGE_LIST="\
|
|
|
|
|
check \
|
|
|
|
|
dialog \
|
|
|
|
|
dkms \
|
|
|
|
|
gawk \
|
|
|
|
|
boost-devel \
|
|
|
|
|
openvpn \
|
|
|
|
|
pkgconfig \
|
|
|
|
|
pexpect \
|
|
|
|
|
sshfs \
|
|
|
|
|
swig \
|
|
|
|
|
wireshark \
|
|
|
|
|
unzip \
|
|
|
|
|
valgrind \
|
|
|
|
|
vconfig \
|
|
|
|
|
ctags \
|
|
|
|
|
ntpdate \
|
|
|
|
|
iperf3 \
|
|
|
|
|
wvdial \
|
|
|
|
|
numpy \
|
|
|
|
|
sshpass \
|
|
|
|
|
nscd \
|
|
|
|
|
python2-paramiko \
|
|
|
|
|
python-pyroute2 \
|
|
|
|
|
python-netifaces \
|
|
|
|
|
scipy \
|
|
|
|
|
python-matplotlib"
|
|
|
|
|
elif [[ "$OS_DISTRO" == "fedora" ]]; then
|
|
|
|
|
PACKAGE_LIST=" \
|
|
|
|
|
check \
|
|
|
|
|
dialog \
|
|
|
|
|
dkms \
|
|
|
|
|
gawk \
|
|
|
|
|
boost-devel \
|
|
|
|
|
openvpn \
|
|
|
|
|
pkgconfig \
|
|
|
|
|
python-pexpect \
|
|
|
|
|
sshfs \
|
|
|
|
|
swig \
|
|
|
|
|
wireshark \
|
|
|
|
|
unzip \
|
|
|
|
|
valgrind \
|
|
|
|
|
vconfig \
|
|
|
|
|
ctags \
|
|
|
|
|
ntpdate \
|
|
|
|
|
iperf3 \
|
|
|
|
|
wvdial \
|
|
|
|
|
python-numpy \
|
|
|
|
|
sshpass \
|
|
|
|
|
nscd \
|
|
|
|
|
python2-paramiko \
|
|
|
|
|
python-pyroute2 \
|
|
|
|
|
python-netifaces \
|
|
|
|
|
python2-scipy \
|
|
|
|
|
python2-matplotlib"
|
|
|
|
|
fi
|
|
|
|
|
$SUDO $INSTALLER install -y $PACKAGE_LIST
|
|
|
|
|
|
|
|
|
|
$SUDO rm -fr /opt/ssh
|
|
|
|
|
$SUDO GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#The packages below are already installed for Redhat distros (RHEL, CentOS, Fedora)
|
|
|
|
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
|
|
|
|
$SUDO pip install paramiko
|
|
|
|
|
$SUDO pip install pyroute2 colorama
|
|
|
|
|
log_netiface=$OPENAIR_DIR/cmake_targets/log/netiface_install_log.txt
|
|
|
|
|
echo_info "Installing Netinterfaces package. The logfile for installation is in $log_netiface"
|
|
|
|
|
(
|
|
|
|
@@ -315,6 +464,7 @@ check_install_additional_tools (){
|
|
|
|
|
$SUDO python setup.py install
|
|
|
|
|
cd -
|
|
|
|
|
) >& $log_netiface
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_install_oai_software() {
|
|
|
|
@@ -323,16 +473,17 @@ check_install_oai_software() {
|
|
|
|
|
echo_error "Your distribution $(get_distribution_release) is not supported by oai !"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
$SUDO apt-get update
|
|
|
|
|
$SUDO $INSTALLER update -y
|
|
|
|
|
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
|
|
|
|
|
$SUDO apt install -y software-properties-common
|
|
|
|
|
case "$(get_distribution_release)" in
|
|
|
|
|
"Ubuntu14.04")
|
|
|
|
|
"ubuntu14.04")
|
|
|
|
|
specific_packages="libtasn1-3-dev"
|
|
|
|
|
# For iperf3
|
|
|
|
|
$SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe"
|
|
|
|
|
$SUDO apt-get update
|
|
|
|
|
;;
|
|
|
|
|
"Ubuntu16.04")
|
|
|
|
|
"ubuntu16.04")
|
|
|
|
|
specific_packages="libtasn1-6-dev"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
@@ -395,7 +546,8 @@ check_install_oai_software() {
|
|
|
|
|
python-pip \
|
|
|
|
|
pydb \
|
|
|
|
|
libyaml-dev \
|
|
|
|
|
wget
|
|
|
|
|
wget \
|
|
|
|
|
libxpm-dev
|
|
|
|
|
|
|
|
|
|
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
|
|
|
|
|
|
|
|
|
@@ -406,7 +558,86 @@ check_install_oai_software() {
|
|
|
|
|
remove_gnutls_from_source
|
|
|
|
|
|
|
|
|
|
$SUDO apt-get install -y libgnutls-dev
|
|
|
|
|
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
|
|
|
|
|
if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
|
|
|
|
|
if rpm -q epel-release > /dev/null; then
|
|
|
|
|
echo "EPEL repos already present. Good."
|
|
|
|
|
else
|
|
|
|
|
echo "EPEL repos not present. Installing them."
|
|
|
|
|
$SUDO $INSTALLER install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
|
|
|
|
fi
|
|
|
|
|
$SUDO $INSTALLER install -y python-epdb
|
|
|
|
|
$SUDO $INSTALLER install -y gccxml
|
|
|
|
|
else
|
|
|
|
|
$SUDO $INSTALLER install -y mscgen pydb
|
|
|
|
|
# Fedora repos already contain gccxml's successor castxml.
|
|
|
|
|
$SUDO $INSTALLER install -y castxml
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
$SUDO $INSTALLER install -y \
|
|
|
|
|
autoconf \
|
|
|
|
|
automake \
|
|
|
|
|
bc \
|
|
|
|
|
bison \
|
|
|
|
|
$CMAKE \
|
|
|
|
|
doxygen \
|
|
|
|
|
ethtool \
|
|
|
|
|
flex \
|
|
|
|
|
gdb \
|
|
|
|
|
git \
|
|
|
|
|
graphviz \
|
|
|
|
|
gtkwave \
|
|
|
|
|
guile-devel \
|
|
|
|
|
iperf \
|
|
|
|
|
iproute \
|
|
|
|
|
iptables \
|
|
|
|
|
iptables-devel \
|
|
|
|
|
atlas-devel \
|
|
|
|
|
blas-devel \
|
|
|
|
|
libconfig-devel \
|
|
|
|
|
libffi-devel \
|
|
|
|
|
xforms \
|
|
|
|
|
xforms-devel \
|
|
|
|
|
libgcrypt-devel \
|
|
|
|
|
gmp-devel \
|
|
|
|
|
gtk3-devel \
|
|
|
|
|
libidn2-devel \
|
|
|
|
|
libidn-devel \
|
|
|
|
|
mariadb-devel \
|
|
|
|
|
octave-devel \
|
|
|
|
|
openpgm-devel \
|
|
|
|
|
lksctp-tools \
|
|
|
|
|
lksctp-tools-devel \
|
|
|
|
|
openssl-devel \
|
|
|
|
|
libtasn1 \
|
|
|
|
|
libtool \
|
|
|
|
|
libusb-devel \
|
|
|
|
|
libxml2 \
|
|
|
|
|
libxml2-devel \
|
|
|
|
|
libxslt-devel \
|
|
|
|
|
octave \
|
|
|
|
|
octave-signal \
|
|
|
|
|
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 \
|
|
|
|
|
blas-devel
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
install_asn1c_from_source
|
|
|
|
|
$SUDO rm -fr /opt/ssh
|
|
|
|
|
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
|
|
|
|
@@ -414,7 +645,7 @@ check_install_oai_software() {
|
|
|
|
|
install_protobuf_c_from_source
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
### Remove Nettle installation which was done from sources
|
|
|
|
|
### Remove Nettle installation which was done from sources (only done for Ubuntu Distro)
|
|
|
|
|
remove_nettle_from_source() {
|
|
|
|
|
nettle_uninstall_log=$OPENAIR_DIR/cmake_targets/log/nettle_uninstall_log.txt
|
|
|
|
|
echo_info "\nUn-Installing Nettle from sources. The log file for nettle un-installation is here: $nettle_uninstall_log "
|
|
|
|
@@ -440,7 +671,7 @@ remove_nettle_from_source() {
|
|
|
|
|
) >& $nettle_uninstall_log
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
### Remove Gnutls from source
|
|
|
|
|
### Remove Gnutls from source (Only done for Ubuntu Distro)
|
|
|
|
|
remove_gnutls_from_source(){
|
|
|
|
|
gnutls_uninstall_log=$OPENAIR_DIR/cmake_targets/log/gnutls_uninstall_log.txt
|
|
|
|
|
echo_info "\nUn-Installing Gnutls. The log file for Gnutls un-installation is here: $gnutls_uninstall_log "
|
|
|
|
|