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 @@ ...@@ -33,6 +33,114 @@
####################################### #######################################
SUDO=sudo 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() { compilations() {
cd $OPENAIR_DIR/cmake_targets/$1 cd $OPENAIR_DIR/cmake_targets/$1
{ {
...@@ -132,6 +240,10 @@ run_compilation_autotests() { ...@@ -132,6 +240,10 @@ run_compilation_autotests() {
"test 0120: nasmesk.ko failed" "test 0120: nasmesk.ko failed"
} }
##########################################
# X.509 certificates
##########################################
make_one_cert() { make_one_cert() {
openssl genrsa -out $1.key.pem 1024 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 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(){ ...@@ -163,6 +275,10 @@ make_certs(){
} }
############################################
# External packages installers
############################################
install_nettle_from_source() { install_nettle_from_source() {
cd /tmp cd /tmp
echo "Downloading nettle archive" echo "Downloading nettle archive"
...@@ -311,7 +427,7 @@ check_install_asn1c(){ ...@@ -311,7 +427,7 @@ check_install_asn1c(){
compile_hss() { compile_hss() {
cd $OPENAIRCN_DIR/OPENAIRHSS cd $OPENAIRCN_DIR/OPENAIRHSS
if [ "$1" -eq 1 ]; then if [ "$CLEAN" = "1" ]; then
echo_info "build a clean HSS" echo_info "build a clean HSS"
rm -rfv obj* m4 .autom4* configure rm -rfv obj* m4 .autom4* configure
fi fi
...@@ -336,79 +452,6 @@ compile_hss() { ...@@ -336,79 +452,6 @@ compile_hss() {
return 1 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() { compile_nas_tools() {
export NVRAM_DIR=$OPENAIR_TARGETS/bin export NVRAM_DIR=$OPENAIR_TARGETS/bin
...@@ -426,46 +469,10 @@ compile_nas_tools() { ...@@ -426,46 +469,10 @@ compile_nas_tools() {
touch /tmp/nas_cleaned touch /tmp/nas_cleaned
} }
# arg1 is RT TDB() {
# arg2 is HW
# arg3 is ENB_S1 if [ $2 = "USRP" ]; then
install_ltesoftmodem() { echo_info " 8.2 [USRP] "
# 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
if [ $2 = "USRP" ]; then
echo_info " 8.2 [USRP] "
fi
fi fi
# ENB_S1 # ENB_S1
...@@ -596,49 +603,3 @@ set_openair_env(){ ...@@ -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 ...@@ -42,126 +42,99 @@ source $THIS_SCRIPT_PATH/build_helper.bash
#EMULATION_MULTICAST_GROUP=1 #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}'` #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" XFORMS="False"
VCD_TIMING="False" VCD_TIMING="False"
REL="Rel10" REL="Rel10"
HW="EXMIMO" HW="EXMIMO"
until [ -z "$1" ] until [ -z "$1" ]
do do
case "$1" in case "$1" in
-c | --clean) -c | --clean)
export CLEAN=1 CLEAN=1
echo "Will re-compile ALL" clean_all_files
echo_info "Erased all previously producted files"
shift; shift;
;; ;;
--clean-iptables) --clean-kernel)
CLEAN_IPTABLES=1; clean_kernel
echo_info "Erased iptables config and removed modules from kernel"
shift; shift;
;; ;;
-C | --config-file) -C | --config-file)
CONFIG_FILE=$2 CONFIG_FILE=$2
# may be relative path echo_info "Will install the config file $CONFIG_FILE"
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
shift 2; shift 2;
;; ;;
-D | --disable-check-installed-software) -I | --install-external-packages)
DISABLE_CHECK_INSTALLED_SOFTWARE=1 INSTALL_EXTERNAL
echo "disable check installed software" echo_info "Will install external packages"
shift; shift;
;; ;;
-g | --run-with-gdb) -g | --run-with-gdb)
GDB=1 GDB=1
echo "Running with gdb" echo_info "Will Compile with gdb symbols"
shift; shift;
;; ;;
-K | --itti-dump-file) -eNB)
ITTI_ANALYZER=1 eNB=1
ITTI_DUMP_FILE=$2 echo_info "Will compile eNB"
echo "setting ITTI dump file to: $ITTI_DUMP_FILE" shift;;
EXE_ARGUMENTS="$EXE_ARGUMENTS -K $ITTI_DUMP_FILE" -UE)
shift 2; UE=1
;; echo_info "Will compile UE"
-l | --build-target) shift;;
TARGET=$2 -unit_simulators)
echo "setting top-level build target to: $2" SIMUS=1
shift 2; 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) -h | --help)
print_help print_help
exit 1 exit 1
;; ;;
-r | --3gpp-release) -r | --3gpp-release)
REL=$2 REL=$2
echo "setting release to: $REL" echo_info "setting release to: $REL"
shift 2 ; shift 2 ;
;; ;;
-s | --check) -s | --check)
OAI_TEST=1 OAI_TEST=1
echo "setting sanity check to: $OAI_TEST" echo_info "Will run auto-tests"
shift; shift;
;; ;;
-V | --vcd) -V | --vcd)
echo "setting gtk-wave output" echo_info "setting gtk-wave output"
VCD_TIMING=1 VCD_TIMING=1
EXE_ARGUMENTS="$EXE_ARGUMENTS -V" EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
shift ; shift ;
;; ;;
-w | --hardware) -w | --hardware)
HW="$2" #"${i#*=}" HW="$2" #"${i#*=}"
echo "setting hardware to: $HW" echo_info "setting hardware to: $HW"
shift 2 ; shift 2 ;
;; ;;
-x | --xforms) -x | --xforms)
XFORMS=1 XFORMS=1
EXE_ARGUMENTS="$EXE_ARGUMENTS -d" EXE_ARGUMENTS="$EXE_ARGUMENTS -d"
echo "setting xforms to: $XFORMS" echo_info "Will generate the software oscilloscope features"
shift; shift;
;; ;;
*) *)
echo "Unknown option $1" print_help
echo_fatal "Unknown option $1"
break ; break ;
;; ;;
esac esac
done 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 # setting and printing OAI envs, we should check here
############################################ ############################################
...@@ -170,59 +143,62 @@ echo_info "2. Setting the OAI PATHS ..." ...@@ -170,59 +143,62 @@ echo_info "2. Setting the OAI PATHS ..."
set_openair_env set_openair_env
cecho "OPENAIR_HOME = $OPENAIR_HOME" $green 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 dbin=$OPENAIR_HOME/cmake_targets/bin
dlog=$OPENAIR_HOME/cmake_targets/log dlog=$OPENAIR_HOME/cmake_targets/log
mkdir -p $dbin $dlog mkdir -p $dbin $dlog
if [ "$DISABLE_CHECK_INSTALLED_SOFTWARE" != "1" ] ; then if [ "$INSTALL_EXTERNAL" = "1" ] ; then
echo_info "Installing packages"
check_install_oai_software check_install_oai_software
echo_info "Making X.509 certificates"
make_certs make_certs
check_epc_s6a_certificate
check_hss_s6a_certificate
if [ "$HW" == "USRP" ] ; then if [ "$HW" == "USRP" ] ; then
echo_info "installing packages for USRP support"
check_install_usrp_uhd_driver check_install_usrp_uhd_driver
fi fi
fi fi
echo_info "3. building the compilation directives ..." 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
# LTE softmodem compilation mkdir -p $DIR/lte_build_oai
mkdir -p $DIR/lte_build_oai cmake_file=$DIR/lte_build_oai/CMakeLists.txt
cmake_file=$DIR/lte_build_oai/CMakeLists.txt echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file echo "set(XFORMS $XFORMS )" >> $cmake_file
echo "set(XFORMS $XFORMS )" >> $cmake_file echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file echo 'set(PACKAGE_NAME "\"lte-softmodem\"")' >> $cmake_file
echo 'set(PACKAGE_NAME "lte-softmodem")' >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
compilations \ if [ "$eNB" = "1" -o "UE" = "1" ] ; then
lte_build_oai lte-softmodem \ # LTE softmodem compilation
lte-softmodem $dbin/lte-softmodem.$REL \ echo_info "Compiling LTE softmodem"