Commit d6c7a4dd authored by Navid Nikaein's avatar Navid Nikaein

* update OAI build scripts


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5785 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 3afaeb33
# This file gathers compilation directive shared between lte-softmodem and oaisim
COMMON_UTILS_DIR = $(OPENAIR_HOME)/common/utils
UE_NAS_DIR = $(OPENAIR_HOME)/openair-cn/NAS
S1AP_DIR = $(OPENAIR_HOME)/openair-cn/S1AP
......@@ -58,9 +56,8 @@ endif
endif
endif
ifdef JF
CFLAGS += -DJUMBO_FRAME
endif
COMMON_CFLAGS += -DMAX_NUM_CCs=1
ifeq ($(ENABLE_RAL), 1)
CFLAGS += -DENABLE_RAL
......@@ -70,11 +67,11 @@ ifeq ($(LIBCONFIG_LONG),1)
CFLAGS += -DLIBCONFIG_LONG
endif
COMMON_CFLAGS += -DMAX_NUM_CCs=1
ifdef USE_MME
# add R9
ifeq ($(USE_MME), R10)
COMMON_CFLAGS += -DENABLE_USE_MME
ENABLE_ITTI = 1
ifdef LINK_PDCP_TO_GTPV1U
ifeq ($(LINK_PDCP_TO_GTPV1U), 1)
COMMON_CFLAGS += -DLINK_PDCP_TO_GTPV1U
# COMMON_CFLAGS += -I$(UDP_DIR)
# COMMON_CFLAGS += -I$(GTPV1U_DIR)
......@@ -82,7 +79,7 @@ ifdef LINK_PDCP_TO_GTPV1U
endif
endif
ifdef ENABLE_ITTI
ifeq ($(ENABLE_ITTI),1)
COMMON_CFLAGS += -DENABLE_ITTI
COMMON_CFLAGS += -DUSER_MODE
COMMON_CFLAGS += -I$(OPENAIR1_DIR)
......@@ -92,7 +89,7 @@ COMMON_CFLAGS += $(UTILS_incl)
SHARED_DEPENDENCIES += $(ITTI_MESSAGES_H)
endif
ifdef USE_MME
ifeq ($(USE_MME), R10)
LIBS += $(UE_NAS_OBJ_DIR)/libuenas.a $(SECU_OBJ_DIR)/libsecu.a
LIBS += $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a -lsctp -lcrypt
LIBS += $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a
......@@ -141,7 +138,7 @@ S1AP_CFLAGS += -I$(TOP_DIR)
S1AP_CFLAGS += $(UTIL_incl)
export S1AP_CFLAGS
X2AP_CFLAGS = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS)
X2AP_CFLAGS = $(COMMON_CFLAGS)
X2AP_CFLAGS += -DENB_MODE
X2AP_CFLAGS += -I$(TOP_DIR)
X2AP_CFLAGS += $(UTIL_incl)
......@@ -198,13 +195,10 @@ endif
export COMMON_CFLAGS
ifdef ENABLE_ITTI
ifeq ($(ENABLE_ITTI),1)
CFLAGS += $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS) $(TARGETS_COMMON_incl)
OBJ += $(TARGETS_COMMON_OBJS)
endif
ifdef ENABLE_ITTI
gccxml_available = $(shell if [ `gccxml --version | grep GCC-XML -c` = "0" ]; then echo "0" ; else echo "1" ; fi )
ifeq ($(gccxml_available), 0)
$(error gccxml is missing, please install)
......
......@@ -41,6 +41,7 @@ E_NOTROOT=67
NUM_CPU=`cat /proc/cpuinfo | grep processor | wc -l`
OAI_INSTALLED=1
PWD=`pwd`
check_for_root_rights() {
if [[ $EUID -eq 0 ]]; then
echo "Run as a sudoers"
......@@ -513,7 +514,9 @@ compile_ltesoftmodem() {
if [ -f Makefile ]; then
echo "Compiling for EXMIMO target (default)..."
echo "Compiling directives: $SOFTMODEM_DIRECTIVES"
make cleanall > /dev/null 2>&1
if [ $1 = 1 ]; then
make cleanall > /dev/null 2>&1
fi
make $SOFTMODEM_DIRECTIVES
make -j $NUM_CPU $SOFTMODEM_DIRECTIVES
if [ $? -ne 0 ]; then
......@@ -533,7 +536,9 @@ compile_oaisim() {
cd $OPENAIR_TARGETS/SIMU/USER
if [ -f Makefile ]; then
echo "Compiling for oaisim target ($OAISIM_DIRECTIVES)"
make cleanall > /dev/null
if [ $1 = 1 ]; then
make cleanall > /dev/null
fi
make $OAISIM_DIRECTIVES
make -j $NUM_CPU $OAISIM_DIRECTIVES
if [ $? -ne 0 ]; then
......@@ -553,7 +558,9 @@ compile_unisim() {
cd $OPENAIR1_DIR/SIMULATION/LTE_PHY
if [ -f Makefile ]; then
echo "Compiling for UNISIM target ..."
make cleanall
if [ $1 = 1 ]; then
make cleanall
fi
make -j $NUM_CPU all
if [ $? -ne 0 ]; then
echo_error "Build unisim failed, returning"
......@@ -658,10 +665,11 @@ check_for_mbmssim_executable() {
# 1. check if the executable functions exist
###############################################
install_ltesoftmodem_() {
if [ $1 = "RTAI" ] ; then
install_ltesoftmodem() {
# RT
if [ $1 = "RTAI" ]; then
if [ ! -f /tmp/init_rt_done.tmp ]; then
echo_warning "Step1: insert RTAI modules"
echo_info " 8.1 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
......@@ -670,39 +678,48 @@ install_ltesoftmodem_() {
touch /tmp/init_rt_done.tmp
chmod 666 /tmp/init_rt_done.tmp
else
echo_warning "RTAI modules already inserted"
echo_warning " 8.1 RTAI modules already inserted"
fi
else
if [ $1 = "RT_PREEMPT" ]; then
echo_warning "Step1: setup RT_PREMMPT"
echo_info " 8.1 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
#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
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
echo_warning "Step4: setup RF card"
cd $OPENAIR_TARGETS/RT/USER
bash ./init_exmimo2.sh
# ENB_S1
if [ $3 = 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
}
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
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
}
......@@ -782,6 +799,15 @@ echo_success() {
done
cecho "$my_string" $green
}
echo_info() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $blue
}
bash_exec() {
output=$($1 2>&1)
......
......@@ -43,7 +43,7 @@ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
#####################
# create a bin dir
#####################
echo_warning "1. Creating the bin dir..."
echo_info "1. Creating the bin dir ..."
rm -rf bin
mkdir -m 777 -p bin
......@@ -54,28 +54,18 @@ touch bin/${oai_build_date}
################################
# cleanup first
################################
echo_warning "2. Cleaning ..."
echo_info "2. Cleaning ..."
output=$($SUDO kill -9 `ps -ef | grep oaisim | awk '{print $2}'` )
$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}'`
#if [ $# -eq 0 ]; then
if [ -z "$1" ]; then
echo "Build OAI"
else
if [ $1 = 0 ]; then
echo "Check the installation, and build OAI"
rm -rf ./.lock_oaibuild
fi
fi
#######################################
# PARAMETERS
# process PARAMETERS
######################################
echo_warning "3. Setup the parameters"
echo_info "3. Process the parameters"
HW="EXMIMO" # EXMIMO, USRP, NONE
TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE
......@@ -104,21 +94,55 @@ EMULATION_DEV_INTERFACE="eth0"
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}'`
#######################################
# Check the PARAMETERS
######################################
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"
############## script params #####################
echo "Parameters : HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG" >> bin/${oai_build_date}
if [ -f ./.lock_oaibuild ]; then
CLEAN=0
else
CLEAN=1
fi
while [[ $# > 0 ]]
do
key="$1"
shift
case $key in
c|-c|--clean)
rm -rf ./.lock_oaibuild
CLEAN=1
;;
t)
TEST=$1
shift
;;
--default)
DEFAULT=1
CLEAN=0
shift
;;
*)
# unknown option
;;
esac
done
echo_info "CLEAN=$CLEAN, TEST=$TEST"
########## print the PARAMETERS############
echo_info "User-defined Parameters : HW=$HW, TARGET=$TARGET, ENB_S1=$ENB_S1, REL=$REL, RT=$RT, DEBUG=$DEBUG"
echo_info "ENB_CONFIG_FILE: $ENB_CONFIG_FILE"
echo "User-defined 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}
############################################
# compilation directives
############################################
echo_warning "4. building the compilation directives ..."
echo_info "4. building the compilation directives ..."
SOFTMODEM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
OAISIM_DIRECTIVES="ENB_S1=$ENB_S1 DEBUG=$DEBUG XFORMS=$XFORMS "
......@@ -137,15 +161,21 @@ else
OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel10=1 "
fi
if [ $RT = "RTAI" ]; then
if [ ! -f /usr/realtime/modules ]; then
if [ -f /usr/realtime/modules ]; then
SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES HARD_RT=1 "
else
echo_success "RTAI doesn't seem to be installed"
echo_warning "RTAI doesn't seem to be installed"
RT="RT_PREMPT"
SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 "
fi
fi
if [ $TARGET != "ALL" ]; then
if [$TARGET != "SOFTMODEM" ]; then
$HW="NONE"
fi
fi
output=$(check_for_machine_type 2>&1)
MACHINE_ARCH=$?
if [ $MACHINE_ARCH -eq 64 ]; then
......@@ -153,10 +183,10 @@ if [ $MACHINE_ARCH -eq 64 ]; then
OAISIM_DIRECTIVES="$OASIM_DIRECTIVES LIBCONFIG_LONG=1 "
fi
echo_success "SOFTMODEM Compilation directive: $SOFTMODEM_DIRECTIVES"
echo_success "OAISIM Compilation directive: $OAISIM_DIRECTIVES"
echo_success "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES"
echo_success "OAISIM Compilation directives: $OAISIM_DIRECTIVES"
echo "SOFTMODEM Compilation directive: $SOFTMODEM_DIRECTIVES" >> bin/${oai_build_date}
echo "SOFTMODEM Compilation directives: $SOFTMODEM_DIRECTIVES" >> bin/${oai_build_date}
echo "OAISIM Compilation directive: $OAISIM_DIRECTIVES" >> bin/${oai_build_date}
############################################
......@@ -164,7 +194,7 @@ echo "OAISIM Compilation directive: $OAISIM_DIRECTIVES" >> bin/${oai_build_d
############################################
echo_warning "5. Checking the OAI PATHS... (TBD)"
echo_info "5. Checking the OAI PATHS ... (TBD)"
cecho "OPENAIR_HOME = $OPENAIR_HOME" $green
cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green
cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green
......@@ -184,31 +214,31 @@ echo "OPENAIR_TARGETS = $OPENAIR_TARGETS" >> bin/${oai_build_date}
# check the installation
############################################
echo_warning "6. Checking the installation ..."
echo_info "6. Checking the installation ..."
output=$(check_install_oai_software >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(check_install_oai_software >> bin/install_log.txt 2>&1 )
############################################
# compile
############################################
echo_warning "7. compiling and installing the OAI binaries..."
echo_info "7. compiling and installing the OAI binaries ..."
softmodem_compiled=1
oaisim_compiled=1
unisim_compiled=1
if [ $TARGET = "ALL" ]; then
output=$(compile_ltesoftmodem >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(compile_ltesoftmodem $CLEAN >> bin/install_log.txt 2>&1 )
softmodem_compiled=$?
check_for_ltesoftmodem_executable
output=$(compile_oaisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(compile_oaisim $CLEAN >> bin/install_log.txt 2>&1 )
oaisim_compiled=$?
check_for_oaisim_executable
output=$(compile_unisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(compile_unisim $CLEAN >> bin/install_log.txt 2>&1 )
unisim_compiled=$?
check_for_dlsim_executable
check_for_ulsim_executable
......@@ -221,17 +251,17 @@ if [ $TARGET = "ALL" ]; then
else
if [ $TARGET = "SOFTMODEM" ]; then
output=$(compile_ltesoftmodem >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(compile_ltesoftmodem >> bin/install_log.txt 2>&1 )
softmodem_compiled=$?
check_for_ltesoftmodem_executable
fi
if [ $TARGET = "OAISIM" ]; then
output=$(compile_oaisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(compile_oaisim >> bin/install_log.txt 2>&1 )
oaisim_compiled=$?
check_for_oaisim_executable
fi
if [ $TARGET = "UNISIM" ]; then
output=$(compile_unisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 )
output=$(compile_unisim >> bin/install_log.txt 2>&1 )
unisim_compiled=$?
check_for_dlsim_executable
check_for_ulsim_executable
......@@ -248,20 +278,20 @@ fi
# install
############################################
echo_warning "8. Installing ..."
echo_info "8. Installing ..."
if [ $softmodem_compiled = 0 ]; then
echo "target lte-softmodem built "
echo_success "target lte-softmodem built "
echo "target lte-softmodem built " >> bin/${oai_build_date}
install_ltesoftmodem $RT $ENB_S1
output=$(install_ltesoftmodem $RT $HW $ENB_S1 >> bin/install_log.txt 2>&1)
fi
if [ $oaisim_compiled = 0 ]; then
echo "target oaisim built "
echo_success "target oaisim built "
echo "target oaisim built " >> bin/${oai_build_date}
install_oaisim $ENB_S1
output=$(install_oaisim $ENB_S1 >> bin/install_log.txt 2>&1 )
fi
if [ $unisim_compiled = 0 ]; then
echo "target unisim built "
echo_success "target unisim built "
echo "target unisim built " >> bin/${oai_build_date}
fi
......@@ -275,10 +305,10 @@ echo "build terminated, see logs is $OPENAIR_TARGETS/bin/install_log.txt"
############################################
if [ $OAI_TEST = 1 ]; then
echo_warning "9. Testing ..."
echo_info "9. Testing ..."
python $OPENAIR_TARGETS/TEST/OAI/test01.py
else
echo_warning "9. Bypassing the Tests ..."
echo_info "9. Bypassing the Tests ..."
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment