From 3afaeb33f905236686a41d8823557c1d680e6968 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Fri, 12 Sep 2014 11:02:21 +0000 Subject: [PATCH] * update the oai build script git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5784 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c | 4 +- .../LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c | 2 + openair2/RRC/LITE/rrc_UE.c | 2 +- targets/Makedirectives | 2 +- targets/RT/USER/Makefile | 2 +- targets/RT/USER/init_exmimo2.sh | 22 ++-- targets/SIMU/USER/Makefile | 2 +- targets/TEST/OAI/case02.py | 2 +- targets/build_helper.bash | 124 ++++++++++++++---- targets/build_oai.bash | 81 ++++++------ 10 files changed, 159 insertions(+), 84 deletions(-) diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 347353b29a..45905069d9 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. + included in this distribution in the file called "COPYING". If not, + see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index 33c2ad9b67..a98283855b 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -429,7 +429,9 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); #endif #ifdef USER_MODE +#ifndef EXMIMO assert(1!=1); +#endif #endif memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); // free SDU diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 7fd00153dd..f872bcba6a 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -911,7 +911,7 @@ rrc_ue_process_radioResourceConfigDedicated(module_id_t ue_mod_idP, frame_t fram ); for (cnt=0;cnt<radioResourceConfigDedicated->srb_ToAddModList->list.count;cnt++) { - + // connection_reestablishment_ind.num_srb+=1; SRB_id = radioResourceConfigDedicated->srb_ToAddModList->list.array[cnt]->srb_Identity; LOG_D(RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n",ue_mod_idP,frameP,cnt,SRB_id); if (SRB_id == 1) { diff --git a/targets/Makedirectives b/targets/Makedirectives index c118ddef6a..bb6f050869 100644 --- a/targets/Makedirectives +++ b/targets/Makedirectives @@ -1,4 +1,4 @@ -ifdef EPC +ifdef ENB_S1 ENABLE_ITTI=1 USE_MME=R10 DISABLE_XER_PRINT=1 diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile index 8da8911842..94176b010e 100644 --- a/targets/RT/USER/Makefile +++ b/targets/RT/USER/Makefile @@ -4,8 +4,8 @@ include $(OPENAIR_TARGETS)/Makerules default: lte-softmodem all: lte-softmodem lte-enb -include $(OPENAIR_TARGETS)/Makefile.common include $(OPENAIR_TARGETS)/Makedirectives +include $(OPENAIR_TARGETS)/Makefile.common GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') ifeq "$(GCCVERSION)" "4.4.3" diff --git a/targets/RT/USER/init_exmimo2.sh b/targets/RT/USER/init_exmimo2.sh index e3f6528e5b..f6c9d32c68 100644 --- a/targets/RT/USER/init_exmimo2.sh +++ b/targets/RT/USER/init_exmimo2.sh @@ -44,14 +44,14 @@ fi sudo rmmod nasmesh sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko -if [ "$1" = "eNB" ]; then - echo "bring up oai0 interface for enb" - sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255 - $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.9 -r 1 -else - if [ "$1" = "UE" ]; then - echo "bring up oai0 interface for UE" - sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255 - $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.9 -t 10.0.1.1 -r 1 - fi -fi +#if [ "$1" = "eNB" ]; then +# echo "bring up oai0 interface for enb" +# sudo ifconfig oai0 10.0.1.1 netmask 255.255.255.0 broadcast 10.0.1.255 +# $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.1 -t 10.0.1.9 -r 1 +#else +# if [ "$1" = "UE" ]; then +# echo "bring up oai0 interface for UE" +# sudo ifconfig oai0 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255 +# $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL/rb_tool -a -c0 -i0 -z0 -s 10.0.1.9 -t 10.0.1.1 -r 1 +# fi +#fi diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile index 37969af703..8cdbcf6bfa 100644 --- a/targets/SIMU/USER/Makefile +++ b/targets/SIMU/USER/Makefile @@ -3,8 +3,8 @@ include $(OPENAIR_TARGETS)/Makerules default: oaisim -include $(OPENAIR_TARGETS)/Makefile.common include $(OPENAIR_TARGETS)/Makedirectives +include $(OPENAIR_TARGETS)/Makefile.common TOP_DIR = $(OPENAIR1_DIR) OPENAIR1_TOP = $(OPENAIR1_DIR) diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py index 3c2031f843..ae930a875e 100644 --- a/targets/TEST/OAI/case02.py +++ b/targets/TEST/OAI/case02.py @@ -194,7 +194,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug): conf = '-a -c26' trace = logdir + '/log_' + host + case + test + '.txt' tee = ' 2>&1 | tee ' + trace - oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' DL and UL loss rate below 10% ', 500) + oai.send_expect('./oaisim.rel8.' + host + ' ' + conf + tee, ' DL and UL loss rate below 10 ', 500) except log.err, e: log.fail(case, test, name, conf, e.value, diag, logfile,trace) else: diff --git a/targets/build_helper.bash b/targets/build_helper.bash index 60e2331506..b6d498edd2 100755 --- a/targets/build_helper.bash +++ b/targets/build_helper.bash @@ -40,22 +40,28 @@ ROOT_UID=0 E_NOTROOT=67 NUM_CPU=`cat /proc/cpuinfo | grep processor | wc -l` OAI_INSTALLED=1 - +PWD=`pwd` check_for_root_rights() { - if [[ $EUID -ne 0 ]]; then - echo_warning "Running as a sudoers" 1>&2 + if [[ $EUID -eq 0 ]]; then + echo "Run as a sudoers" return 1 else - echo_success "Running as a root" 1>&2 + echo "Run as a root" return 0 fi } -output=$(check_for_root_rights 2>&1) +output=$(check_for_root_rights) result=$? SUDO='' +PW='' if [ $result -ne 1 ]; then - SUDO='sudo -E' + # echo "Please provide your password :" + # read -s PW +# SUDO="echo $PW | sudo -S -E " + SUDO="sudo -S -E " +else + echo "root" fi test_install_package() { @@ -72,6 +78,17 @@ test_install_package() { fi } +test_uninstall_package() { + + if [ $# -eq 1 ]; then + dpkg -s "$1" > /dev/null 2>&1 && { + $SUDO apt-get remove --assume-yes $1 + echo "$1 is uninstalled." + } || { + echo "$1 is not installed." + } + fi +} test_command_install_script() { # usage: test_command_install_script searched_binary script_to_be_invoked_if_binary_not_found command -v $1 >/dev/null 2>&1 || { echo_warning "Program $1 is not installed. Trying installing it." >&2; bash $2; command -v $1 >/dev/null 2>&1 || { echo_fatal "Program $1 is not installed. Aborting." >&2; };} @@ -101,14 +118,15 @@ check_for_machine_type(){ #################################################### make_certs(){ - - echo "creating the certificate" - + + # for certtificate generation rm -rf demoCA - mkdir demoCA + mkdir -m 777 -p demoCA echo 01 > demoCA/serial touch demoCA/index.txt - + + echo "creating the certificate" + user=$(whoami) HOSTNAME=$(hostname -f) @@ -137,17 +155,13 @@ make_certs(){ check_install_freediamter(){ - if [ -f install_log.txt ]; then - $SUDO rm -f tmp/install_log.txt - fi - if [ ! -d /usr/local/src/ ]; then echo "/usr/local/src/ doesn't exist please create one" exit -1 fi if [ ! -w /usr/local/src/ ]; then - echo "You don't have permissions to write to /usr/local/src/, inslalling as a sudoer" + echo "You don't have permissions to write to /usr/local/src/, installing as a sudoer" # exit -1 fi @@ -164,10 +178,11 @@ check_install_freediamter(){ if [ -d nettle-2.5 ]; then $SUDO rm -rf nettle-2.5/ fi - + + $SUDO wget ftp://ftp.lysator.liu.se/pub/security/lsh/nettle-2.5.tar.gz $SUDO gunzip nettle-2.5.tar.gz - echo "Uncompressing nettle archive" + $SUDO echo "Uncompressing nettle archive" $SUDO tar -xf nettle-2.5.tar cd nettle-2.5/ $SUDO ./configure --disable-openssl --enable-shared --prefix=/usr @@ -188,10 +203,12 @@ check_install_freediamter(){ if [ -d gnutls-3.1.0/ ]; then $SUDO rm -rf gnutls-3.1.0/ fi - + + test_uninstall_package libgnutls-dev + $SUDO wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.0.tar.xz $SUDO tar -xf gnutls-3.1.0.tar.xz - echo "Uncompressing gnutls archive" + echo "Uncompressing gnutls archive ($PWD)" cd gnutls-3.1.0/ $SUDO ./configure --prefix=/usr if [ $? -ne 0 ]; then @@ -334,6 +351,9 @@ check_install_oai_software() { test_install_package valgrind test_install_package vlan test_install_package doxygen + # uninstall some automatically installed packges + # we need a newer version +# test_uninstall_package libnettle4 fi echo "$OPENAIR_TARGETS/bin/install_log.txt" @@ -491,8 +511,8 @@ compile_epc() { compile_ltesoftmodem() { cd $OPENAIR_TARGETS/RT/USER if [ -f Makefile ]; then - echo_success "Compiling for EXMIMO target (default)..." - echo_success "Compiling directives: $SOFTMODEM_DIRECTIVES" + echo "Compiling for EXMIMO target (default)..." + echo "Compiling directives: $SOFTMODEM_DIRECTIVES" make cleanall > /dev/null 2>&1 make $SOFTMODEM_DIRECTIVES make -j $NUM_CPU $SOFTMODEM_DIRECTIVES @@ -512,9 +532,8 @@ compile_ltesoftmodem() { compile_oaisim() { cd $OPENAIR_TARGETS/SIMU/USER if [ -f Makefile ]; then - echo_success "Compiling for oaisim target ..." - echo_success "Compiling directives: $OAISIM_DIRECTIVES" - make cleanall > /dev/null + echo "Compiling for oaisim target ($OAISIM_DIRECTIVES)" + make cleanall > /dev/null make $OAISIM_DIRECTIVES make -j $NUM_CPU $OAISIM_DIRECTIVES if [ $? -ne 0 ]; then @@ -533,7 +552,7 @@ compile_oaisim() { compile_unisim() { cd $OPENAIR1_DIR/SIMULATION/LTE_PHY if [ -f Makefile ]; then - echo_success "Compiling for CHANNELSIM target ..." + echo "Compiling for UNISIM target ..." make cleanall make -j $NUM_CPU all if [ $? -ne 0 ]; then @@ -634,6 +653,59 @@ check_for_mbmssim_executable() { echo_error "Please make sure that the OAI mbmssim is compiled" fi } + +################################################ +# 1. check if the executable functions exist +############################################### + +install_ltesoftmodem_() { + if [ $1 = "RTAI" ] ; then + if [ ! -f /tmp/init_rt_done.tmp ]; then + echo_warning "Step1: insert RTAI modules" + insmod /usr/realtime/modules/rtai_hal.ko > /dev/null 2>&1 + insmod /usr/realtime/modules/rtai_sched.ko > /dev/null 2>&1 + insmod /usr/realtime/modules/rtai_sem.ko > /dev/null 2>&1 + insmod /usr/realtime/modules/rtai_fifos.ko > /dev/null 2>&1 + insmod /usr/realtime/modules/rtai_mbx.ko > /dev/null 2>&1 + touch /tmp/init_rt_done.tmp + chmod 666 /tmp/init_rt_done.tmp + else + echo_warning "RTAI modules already inserted" + fi + else + if [ $1 = "RT_PREEMPT" ]; then + echo_warning "Step1: setup RT_PREMMPT" + fi + fi + + echo_warning "Step2: creating RTAI fifos" + for i in `seq 0 64`; do + have_rtfX=`ls /dev/ |grep -c rtf$$i`; + if [ "$$have_rtfX" -eq 0 ] ;then + mknod -m 666 /dev/rtf$$i c 150 $$i; + fi; + done + echo_warning "Step3: 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 + if [ $2 = 0 ]; then + cd $OPENAIR2_DIR && make clean && make nasmesh_netlink.ko || exit 1 + cd $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL && make clean && make || exit 1 + fi + + echo_warning "Step4: setup RF card" + cd $OPENAIR_TARGETS/RT/USER + bash ./init_exmimo2.sh + +} + +install_oaisim() { + if [ $1 = 0 ]; then + cd $OPENAIR2_DIR && make clean && make nasmesh_netlink.ko || exit 1 + cd $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL && make clean && make || exit 1 + fi + +} ############################### ## echo and family ############################### diff --git a/targets/build_oai.bash b/targets/build_oai.bash index 4208a84bf1..67b5dfa9cd 100755 --- a/targets/build_oai.bash +++ b/targets/build_oai.bash @@ -5,7 +5,7 @@ # OpenAirInterface is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# (at your option) anylater version. # # # OpenAirInterface is distributed in the hope that it will be useful, @@ -40,26 +40,23 @@ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) . $THIS_SCRIPT_PATH/build_helper.bash -################### +##################### # create a bin dir -###################3 +##################### echo_warning "1. Creating the bin dir..." rm -rf bin -mkdir bin -chmod 777 -R bin +mkdir -m 777 -p bin build_date=`date +%Y_%m_%d` oai_build_date="oai_built_${build_date}" touch bin/${oai_build_date} - - ################################ # cleanup first ################################ echo_warning "2. Cleaning ..." -$SUDO kill -9 `ps -ef | grep oaisim | awk '{print $2}'` +output=$($SUDO kill -9 `ps -ef | grep oaisim | awk '{print $2}'` ) $SUDO kill -9 `ps -ef | grep lte-softmodem | awk '{print $2}'` $SUDO kill -9 `ps -ef | grep dlsim | awk '{print $2}'` $SUDO kill -9 `ps -ef | grep ulsim | awk '{print $2}'` @@ -81,22 +78,27 @@ fi echo_warning "3. Setup the parameters" HW="EXMIMO" # EXMIMO, USRP, NONE -TARGET="NONE" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE +TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE -EPC=1 +ENB_S1=1 REL="REL8" # REL8, REL10 RT="RTAI" # RTAI, RT_PREMPT or RT_DISABLED DEBUG=0 ENB_CONFIG_FILE=$OPENAIR_TARGETS/"PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.conf" + OAI_TEST=0 + # script is not currently handling these params +EPC=0 # flag to build EPC + XFORMS=0 ITTI_ANALYZER=0 VCD_TIMING=0 WIRESHARK=0 TIME_MEAS=0 +DEV=0 EMULATION_DEV_INTERFACE="eth0" EMULATION_MULTICAST_GROUP=1 @@ -106,16 +108,10 @@ EMULATION_DEV_ADDRESS=`ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| gr # Check the PARAMETERS ###################################### - -if [ $TARGET != "SOFTMODEM" ]; then - RT="RT_DISABLED" - HW="NONE" -fi - -echo_success "Parameters : HW=$HW, TARGET=$TARGET, EPC=$EPC, REL=$REL, RT=$RT, DEBUG=$DEBUG" +echo_success "Parameters : HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG" echo_success "ENB_CONFIG_FILE: $ENB_CONFIG_FILE" -echo "Parameters : HW=$HW, TARGET=$TARGET, EPC=$EPC, REL=$REL, RT=$RT, DEBUG=$DEBUG" >> bin/${oai_build_date} +echo "Parameters : HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG" >> bin/${oai_build_date} echo "ENB_CONFIG_FILE: $ENB_CONFIG_FILE" >> bin/${oai_build_date} ############################################ @@ -124,12 +120,12 @@ echo "ENB_CONFIG_FILE: $ENB_CONFIG_FILE" >> bin/${oai_build_date} echo_warning "4. building the compilation directives ..." -SOFTMODEM_DIRECTIVES="EPC=$EPC DEBUG=$DEBUG XFORMS=$XFORMS " -OAISIM_DIRECTIVES="EPC=$EPC DEBUG=$DEBUG XFORMS=$XFORMS " +SOFTMODEM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS " +OAISIM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS " if [ $HW = "USRP" ]; then SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES USRP=1 " fi -if [ $EPC -eq 0 ]; then +if [ $ENB_S1 -eq 0 ]; then SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES NAS=1 " OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES NAS=1 " fi @@ -141,9 +137,13 @@ else OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel10=1 " fi if [ $RT = "RTAI" ]; then - SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES HARD_RT=1 " -else - SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 " + if [ ! -f /usr/realtime/modules ]; then + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES HARD_RT=1 " + else + echo_success "RTAI doesn't seem to be installed" + RT="RT_PREMPT" + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 " + fi fi output=$(check_for_machine_type 2>&1) @@ -244,32 +244,21 @@ else fi - - -############################################ -# testing -############################################ - -if [ $OAI_TEST = 1 ]; then - echo_warning "8. Testing ..." - python $OPENAIR_TARGETS/TEST/OAI/test01.py -else - echo_warning "8. Bypassing the Tests ..." -fi - ############################################ -# terminate +# install ############################################ -echo_warning "9. Terminating ..." +echo_warning "8. Installing ..." if [ $softmodem_compiled = 0 ]; then echo "target lte-softmodem built " echo "target lte-softmodem built " >> bin/${oai_build_date} + install_ltesoftmodem $RT $ENB_S1 fi if [ $oaisim_compiled = 0 ]; then echo "target oaisim built " echo "target oaisim built " >> bin/${oai_build_date} + install_oaisim $ENB_S1 fi if [ $unisim_compiled = 0 ]; then echo "target unisim built " @@ -279,7 +268,19 @@ fi echo "build terminated, see logs is $OPENAIR_TARGETS/bin/install_log.txt" - + + +############################################ +# testing +############################################ + +if [ $OAI_TEST = 1 ]; then + echo_warning "9. Testing ..." + python $OPENAIR_TARGETS/TEST/OAI/test01.py +else + echo_warning "9. Bypassing the Tests ..." +fi + -- GitLab