Commit 59cfa1fc authored by thomasl's avatar thomasl
Browse files

fixing compilation issues with new cmake procedure



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6814 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c8a659a1
This diff is collapsed.
......@@ -33,6 +33,114 @@
#######################################
SUDO=sudo
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
COLORIZE=1
cecho() {
# Color-echo
# arg1 = message
# arg2 = color
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
echo -e "$message"
return
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
print_help() {
echo_info '
This program installs OpenAirInterface Software
You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14
Options
-h
This help
-c | --clean
Erase all files made by previous compilation, installation"
--clean-kernel
Erase previously installed features in kernel: iptables, drivers, ...
-C | --config-file
The configuration file to install
-I | --install-external-packages
Installs required packages such as LibXML, asn1.1 compiler, freediameter, ...
-g | --run-with-gdb
Add debugging symbols to compilation directives
-eNB
Makes the eNB LTE softmodem
-UE
Makes the UE softmodem
-oaisim
Makes the oaisim simulator
-unit_simulators
Makes the unitary tests Layer 1 simulators
-EPC
Makes the EPC
-r | --3gpp-release
default is Rel10,
Rel8 limits the implementation to 3GPP Release 8 version
-w | --hardware
EXMIMO (Default), USRP, None
Adds this RF board support (in external packages installation and in compilation)
-s | --check
runs a set of auto-tests based on simulators and several compilation tests
-V | --vcd
Adds a debgging facility to the binary files: GUI with major internal synchronization events
-x | --xforms
Adds a software oscilloscope feature to the produced binaries
Typical Options for a quick startup with a COTS UE and Eurecom RF board: build_oai.bash -I -g -eNB -EPC -x'
}
###########################
# Cleaners
###########################
clean_kernel() {
$SUDO modprobe ip_tables
$SUDO modprobe x_tables
$SUDO iptables -P INPUT ACCEPT
$SUDO iptables -F INPUT
$SUDO iptables -P OUTPUT ACCEPT
$SUDO iptables -F OUTPUT
$SUDO iptables -P FORWARD ACCEPT
$SUDO iptables -F FORWARD
$SUDO iptables -t nat -F
$SUDO iptables -t mangle -F
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
$SUDO rmmod nasmesh > /dev/null 2>&1
$SUDO rmmod oai_nw_drv > /dev/null 2>&1
$SUDO rmmod openair_rf > /dev/null 2>&1
$SUDO rmmod ue_ip > /dev/null 2>&1
echo_info "removed drivers from kernel"
}
clean_all_files() {
dir=$OPENAIR_DIR/cmake
rm -rf $dir/log $dir/bin $dir/autotests/bin $dir/autotests/log $dir/autotests/*/buid $dir/build_*/build
}
###################################
# Compilers
###################################
compilations() {
cd $OPENAIR_DIR/cmake_targets/$1
{
......@@ -132,6 +240,10 @@ run_compilation_autotests() {
"test 0120: nasmesk.ko failed"
}
##########################################
# X.509 certificates
##########################################
make_one_cert() {
openssl genrsa -out $1.key.pem 1024
openssl req -new -batch -out $1.csr.pem -key $1.key.pem -subj /CN=$1.eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
......@@ -163,6 +275,10 @@ make_certs(){
}
############################################
# External packages installers
############################################
install_nettle_from_source() {
cd /tmp
echo "Downloading nettle archive"
......@@ -311,7 +427,7 @@ check_install_asn1c(){
compile_hss() {
cd $OPENAIRCN_DIR/OPENAIRHSS
if [ "$1" -eq 1 ]; then
if [ "$CLEAN" = "1" ]; then
echo_info "build a clean HSS"
rm -rfv obj* m4 .autom4* configure
fi
......@@ -336,79 +452,6 @@ compile_hss() {
return 1
}
compile_epc() {
cd $OPENAIRCN_DIR
if [ "$1" = 1 ]; then
echo_info "build a clean EPC"
bash_exec "rm -rf objs"
fi
OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*`
if [ ! -n "$OBJ_DIR" ]; then
OBJ_DIR="objs"
bash_exec "mkdir -m 777 ./$OBJ_DIR"
echo_success "Created $OBJ_DIR directory"
else
OBJ_DIR=`basename $OBJ_DIR`
fi
if [ ! -f $OBJ_DIR/Makefile ]; then
if [ ! -n "m4" ]; then
mkdir -m 777 m4
fi
bash_exec "autoreconf -i -f"
echo_success "Invoking autogen"
bash_exec "libtoolize"
bash_exec "./autogen.sh"
cd ./$OBJ_DIR
echo_success "Invoking configure"
if [ $DEBUG -ne 0 ]; then
../configure --enable-debug --enable-standalone-epc --enable-gtp1u-in-kernel LDFLAGS=-L/usr/local/lib
else
../configure --enable-standalone-epc --enable-gtp1u-in-kernel LDFLAGS=-L/usr/local/lib
fi
else
cd ./$OBJ_DIR
fi
# pkill oai_epc
# pkill tshark
if [ -f Makefile ]; then
echo_success "Compiling..."
make -j $NUM_CPU
if [ $? -ne 0 ]; then
echo_error "Build failed, exiting"
return 1
else
cp -pf ./OAI_EPC/oai_epc $OPENAIR_TARGETS/bin
fi
else
echo_error "Configure failed, exiting"
return 1
fi
cd $OPENAIRCN_DIR/GTPV1-U/GTPUAH;
make
if [ $? -ne 0 ]; then
echo_error "Build GTPUAH module failed, exiting"
return 1
else
$SUDO cp -pfv ./Bin/libxt_*.so /lib/xtables
$SUDO cp -pfv ./Bin/*.ko $OPENAIR_TARGETS/bin
fi
cd $OPENAIRCN_DIR/GTPV1-U/GTPURH;
make
if [ $? -ne 0 ]; then
echo_error "Build GTPURH module failed, exiting"
return 1
else
$SUDO cp -pfv ./Bin/libxt_*.so /lib/xtables
$SUDO cp -pfv ./Bin/*.ko $OPENAIR_TARGETS/bin
fi
return 0
}
compile_nas_tools() {
export NVRAM_DIR=$OPENAIR_TARGETS/bin
......@@ -426,48 +469,12 @@ compile_nas_tools() {
touch /tmp/nas_cleaned
}
# arg1 is RT
# arg2 is HW
# arg3 is ENB_S1
install_ltesoftmodem() {
# RT
if [ $1 = "RTAI" ]; then
if [ ! -f /tmp/init_rt_done.tmp ]; then
echo_info " 8.1 Insert RTAI modules"
$SUDO insmod /usr/realtime/modules/rtai_hal.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_sched.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_sem.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_fifos.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_mbx.ko > /dev/null 2>&1
$SUDO touch /tmp/init_rt_done.tmp
$SUDO chmod 666 /tmp/init_rt_done.tmp
else
echo_warning " 8.1 RTAI modules already inserted"
fi
fi
#HW
if [ $2 = "EXMIMO" ]; then
echo_info " 8.2 [EXMIMO] creating RTAI fifos"
for i in `seq 0 64`; do
have_rtfX=`ls /dev/ |grep -c rtf$i`;
if [ "$have_rtfX" -eq 0 ] ; then
$SUDO mknod -m 666 /dev/rtf$i c 150 $i;
fi;
done
echo_info " 8.3 [EXMIMO] Build lte-softmodemdrivers"
cd $OPENAIR_TARGETS/ARCH/EXMIMO/DRIVER/eurecom && make clean && make # || exit 1
cd $OPENAIR_TARGETS/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT && make clean && make # || exit 1
echo_info " 8.4 [EXMIMO] Setup RF card"
cd $OPENAIR_TARGETS/RT/USER
. ./init_exmimo2.sh
else
TDB() {
if [ $2 = "USRP" ]; then
echo_info " 8.2 [USRP] "
fi
fi
# ENB_S1
if [ $3 = 0 ]; then
cd $OPENAIR2_DIR && make clean && make nasmesh_netlink.ko #|| exit 1
......@@ -596,49 +603,3 @@ set_openair_env(){
}
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
cecho() # Color-echo
# arg1 = message
# arg2 = color
{
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
if [ "$BUILD_FROM_MAKEFILE" = "" ]; then
echo -e -n "$color$message$reset_color"
echo
else
echo "$message"
fi
return
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
bash_exec() {
output=$($1 2>&1)
result=$?
if [ $result -eq 0 ]; then
echo_success "$1"
else
echo_error "$1: $output"
fi
}
......@@ -42,126 +42,99 @@ source $THIS_SCRIPT_PATH/build_helper.bash
#EMULATION_MULTICAST_GROUP=1
#EMULATION_DEV_ADDRESS=`ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
TARGET="ALL"
XFORMS="False"
VCD_TIMING="False"
REL="Rel10"
HW="EXMIMO"
until [ -z "$1" ]
do
do
case "$1" in
-c | --clean)
export CLEAN=1
echo "Will re-compile ALL"
CLEAN=1
clean_all_files
echo_info "Erased all previously producted files"
shift;
;;
--clean-iptables)
CLEAN_IPTABLES=1;
--clean-kernel)
clean_kernel
echo_info "Erased iptables config and removed modules from kernel"
shift;
;;
-C | --config-file)
CONFIG_FILE=$2
# may be relative path
if [ -f $(dirname $(readlink -f $0))/$CONFIG_FILE ]; then
CONFIG_FILE=$(dirname $(readlink -f $0))/$CONFIG_FILE
echo "setting config file to: $CONFIG_FILE"
CONFIG_FILE_ACCESS_OK=1
else
# may be absolute path
if [ -f $CONFIG_FILE ]; then
echo "setting config file to: $CONFIG_FILE"
CONFIG_FILE_ACCESS_OK=1
else
echo "config file not found"
exit 1
fi
fi
echo_info "Will install the config file $CONFIG_FILE"
shift 2;
;;
-D | --disable-check-installed-software)
DISABLE_CHECK_INSTALLED_SOFTWARE=1
echo "disable check installed software"
-I | --install-external-packages)
INSTALL_EXTERNAL
echo_info "Will install external packages"
shift;
;;
-g | --run-with-gdb)
GDB=1
echo "Running with gdb"
echo_info "Will Compile with gdb symbols"
shift;
;;
-K | --itti-dump-file)
ITTI_ANALYZER=1
ITTI_DUMP_FILE=$2
echo "setting ITTI dump file to: $ITTI_DUMP_FILE"
EXE_ARGUMENTS="$EXE_ARGUMENTS -K $ITTI_DUMP_FILE"
shift 2;
;;
-l | --build-target)
TARGET=$2
echo "setting top-level build target to: $2"
shift 2;
;;
-eNB)
eNB=1
echo_info "Will compile eNB"
shift;;
-UE)
UE=1
echo_info "Will compile UE"
shift;;
-unit_simulators)
SIMUS=1
echo_info "Will compile dlsim, ulsim, ..."
shift;;
-oaisim)
oaisim=1
echo_info "Will compile oaisim and drivers nasmesh, ..."
shift;;
-EPC)
EPC=1
echo_info "Will compile EPC"
shift;;
-h | --help)
print_help
exit 1
;;
-r | --3gpp-release)
REL=$2
echo "setting release to: $REL"
echo_info "setting release to: $REL"
shift 2 ;
;;
-s | --check)
OAI_TEST=1
echo "setting sanity check to: $OAI_TEST"
echo_info "Will run auto-tests"
shift;
;;
-V | --vcd)
echo "setting gtk-wave output"
echo_info "setting gtk-wave output"
VCD_TIMING=1
EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
shift ;
;;
-w | --hardware)
HW="$2" #"${i#*=}"
echo "setting hardware to: $HW"
echo_info "setting hardware to: $HW"
shift 2 ;
;;
-x | --xforms)
XFORMS=1
EXE_ARGUMENTS="$EXE_ARGUMENTS -d"
echo "setting xforms to: $XFORMS"
echo_info "Will generate the software oscilloscope features"
shift;
;;
*)
echo "Unknown option $1"
print_help
echo_fatal "Unknown option $1"
break ;
;;
esac
done
################################
# cleanup first
################################
echo_info "1. Cleaning ..."
if [ "$CLEAN_IPTABLES" == "1" ] ; then
echo_info "Flushing iptables..."
$SUDO modprobe ip_tables
$SUDO modprobe x_tables
$SUDO iptables -P INPUT ACCEPT
$SUDO iptables -F INPUT
$SUDO iptables -P OUTPUT ACCEPT
$SUDO iptables -F OUTPUT
$SUDO iptables -P FORWARD ACCEPT
$SUDO iptables -F FORWARD
$SUDO iptables -t nat -F
$SUDO iptables -t mangle -F
$SUDO iptables -t filter -F
$SUDO iptables -t raw -F
echo_info "Flushed iptables"
fi
############################################
# setting and printing OAI envs, we should check here
############################################
......@@ -170,59 +143,62 @@ echo_info "2. Setting the OAI PATHS ..."
set_openair_env
cecho "OPENAIR_HOME = $OPENAIR_HOME" $green
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green
cecho "OPENAIRCN_DIR = $OPENAIRCN_DIR" $green
cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
dbin=$OPENAIR_HOME/cmake_targets/bin
dlog=$OPENAIR_HOME/cmake_targets/log
mkdir -p $dbin $dlog
if [ "$DISABLE_CHECK_INSTALLED_SOFTWARE" != "1" ] ; then
if [ "$INSTALL_EXTERNAL" = "1" ] ; then
echo_info "Installing packages"
check_install_oai_software
echo_info "Making X.509 certificates"
make_certs
check_epc_s6a_certificate
check_hss_s6a_certificate
if [ "$HW" == "USRP" ] ; then
echo_info "installing packages for USRP support"
check_install_usrp_uhd_driver
fi
fi
echo_info "3. building the compilation directives ..."
if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
DIR=$OPENAIR_HOME/cmake_targets
DIR=$OPENAIR_HOME/cmake_targets
# Create the cmake directives for selected options
mkdir -p $DIR/lte_build_oai
cmake_file=$DIR/lte_build_oai/CMakeLists.txt
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
echo "set(XFORMS $XFORMS )" >> $cmake_file
echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "\"lte-softmodem\"")' >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
if [ "$eNB" = "1" -o "UE" = "1" ] ; then
# LTE softmodem compilation
mkdir -p $DIR/lte_build_oai
cmake_file=$DIR/lte_build_oai/CMakeLists.txt
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
echo "set(XFORMS $XFORMS )" >> $cmake_file
echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "lte-softmodem")' >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
echo_info "Compiling LTE softmodem"
compilations \
lte_build_oai lte-softmodem \
lte-softmodem $dbin/lte-softmodem.$REL \
$dlog/lte-softmodem.$REL.txt \
"lte-softmodem compiled" \
"lte-softmodem compilation failed"
fi
if [ "$UE" = 1 ] ; then
# ue_ip driver compilation
echo_info "Compiling UE specific part"
compilations \
lte_build_oai ue_ip \
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko \
$dlog/ue_ip.txt \
"ue_ip driver compiled" \
"ue_ip driver compilation failed"
fi
if [ "SIMUS" = "1" ] ; then
# lte unitary simulators compilation
echo_info "Compiling unitary tests simulators"
simlist="dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
log=$dlog/lte-simulators.log
cd $OPENAIR_DIR/cmake_targets/lte-simulators
......@@ -240,9 +216,11 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
echo_error "$f compilation failed"
fi
done
fi
# EXMIMO drivers & firmware loader
if [ "$HW" = "EXMIMO" ] ; then
# EXMIMO drivers & firmware loader
if [ "$HW" = "EXMIMO" ] ; then
echo_info "Compiling Express MIMO 2 board drivers"
compilations \
lte_build_oai openair_rf \
CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko \
......@@ -255,9 +233,11 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
$dlog/updatefw.txt 2>&1 \
"EXMIMO firmware loader compiled" \
"EXMIMO firmware loader compilation failed"
fi
fi
if [ "$oaisim" = "1" ] ; then
# oasim compilation
echo_info "Compiling oaisim simulator"
cmake_file=$DIR/oaisim_build_oai/CMakeLists.txt
cp $DIR/oaisim_build_oai/CMakeLists.template $cmake_file
echo "set(XFORMS $XFORMS )" >> $cmake_file
......@@ -290,9 +270,61 @@ fi
# EPC compilation
##################
if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
compile_epc
if [ "$EPC" = "1" ] ; then
echo_info "Compiling EPC"
cmake_file=$DIR/epc_build_oai/CMakeLists.txt
cp $DIR/epc_build_oai/CMakeLists.template $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
compilations \
epc_build_oai oai_epc \
oai_epc $dbin/oai_epc.$REL \
$dlog/oai_epc.$REL.txt \
"oai_epc compiled" \
"oai_epc compilation failed"
compilations \
epc_build_oai xt_GTPUAH_lib \
libxt_GTPUAH_lib.so $dbin \
$dlog/xt_GTPUAH.txt \
"library xt_GTPUAH compiled" \
"library xt_GTPUAH compilation failed"
compilations \
epc_build_oai xt_GTPURH_lib \
libxt_GTPURH_lib.so $dbin \
$dlog/xt_GTPURH.txt \
"library xt_GTPURH compiled" \
"library xt_GTPURH compilation failed"
compilations \
epc_build_oai xt_GTPURH \
CMakeFiles/xt_GTPURH/xt_GTPURH.ko $dbin \