From 35bd7f34ba198993bc1910bb4456a964f2d37eb0 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Thu, 6 Nov 2014 00:32:53 +0000 Subject: [PATCH] git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5979 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- targets/build_helper.bash | 52 +++++++++++++++++++-------- targets/build_oai.bash | 76 +++++++++++++++++++++++++++++++++------ 2 files changed, 103 insertions(+), 25 deletions(-) diff --git a/targets/build_helper.bash b/targets/build_helper.bash index 73201c1515..e2f6a92a9b 100755 --- a/targets/build_helper.bash +++ b/targets/build_helper.bash @@ -342,7 +342,7 @@ check_install_oai_software() { fi else - echo_info "skip the package installations" + echo_info "All the required packages installed: skip" fi } @@ -425,11 +425,11 @@ check_install_epc_software() { test_install_package libatlas-dev test_install_package libblas test_install_package libblas-dev - if [ $MACHINE_ARCH = 64 ]; then +# if [ $MACHINE_ARCH = 64 ]; then test_install_package libconfig8-dev - else - test_install_package libconfig-dev - fi +# else +# test_install_package libconfig-dev +# fi test_install_package libforms-bin test_install_package libforms-dev test_install_package libgcrypt11-dev @@ -445,7 +445,7 @@ check_install_epc_software() { test_install_package libtasn1-3-dev test_install_package libxml2 test_install_package libxml2-dev - test_install_package linux-headers-`uname -r` +# test_install_package linux-headers-`uname -r` test_install_package make test_install_package openssh-client test_install_package openssh-server @@ -525,17 +525,24 @@ compile_hss() { make -j $NUM_CPU if [ $? -ne 0 ]; then echo_error "Build failed, exiting" - exit 1 + return 1 + else + cp -f ./openair-hss $OPENAIR_TARGETS/bin + return 0 fi else echo_error "Configure failed, exiting" - exit 1 + return 1 fi } compile_epc() { cd $OPENAIRCN_DIR + if [ $1 = 1 ]; then + echo_info "build a clean EPC" + bash_exec "rm -rf obj" + fi OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*` if [ ! -n "$OBJ_DIR" ]; then OBJ_DIR="objs" @@ -557,19 +564,22 @@ compile_epc() { cd ./$OBJ_DIR fi - pkill oai_epc - pkill tshark +# 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" - exit 1 - fi + return 1 + else + cp -f ./OAI_EPC/oai_epc $OPENAIR_TARGETS/bin + return 0 + fi else echo_error "Configure failed, exiting" - exit 1 + return 1 fi } @@ -650,11 +660,18 @@ check_for_ltesoftmodem_executable() { check_for_epc_executable() { if [ ! -f $OPENAIRCN_DIR/objs/OAI_EPC/oai_epc ]; then - echo_error "Cannot find oai_epc executable object in directory $OPENAIR3_DIR/OPENAIRMME/objs/OAI_EPC/" + echo_error "Cannot find oai_epc executable object in directory $OPENAIRCN_DIR/objs/OAI_EPC/" echo_error "Please make sure you have compiled OAI EPC with --enable-standalone-epc option" fi } +check_for_hss_executable() { + if [ ! -f $OPENAIRCN_DIR/OPENAIRHSS/objs/openair-hss ]; then + echo_error "Cannot find openair-hss executable object in directory $OPENAIRCN_DIR/OPENAIRHSS/objs/" + echo_error "Please make sure you have compiled OAI HSS" + fi +} + check_for_sgw_executable() { if [ ! -f $OPENAIRCN_DIR/objs/OAI_SGW/oai_sgw ]; then echo_error "Cannot find oai_sgw executable object in directory $OPENAIR3_DIR/OPENAIRMME/objs/OAI_SGW/" @@ -787,10 +804,11 @@ create_hss_database(){ EXPECTED_ARGS=2 E_BADARGS=65 MYSQL=`which mysql` - + rv=0 if [ $# -ne $EXPECTED_ARGS ] then echo_fatal "Usage: $0 dbuser dbpass" + rv=1 fi set_openair @@ -800,6 +818,7 @@ create_hss_database(){ $MYSQL -u $1 --password=$2 -e "$SQL" if [ $? -ne 0 ]; then echo_error "oai_db creation failed" + rv=1 else echo_success "oai_db creation succeeded" fi @@ -807,6 +826,7 @@ create_hss_database(){ $MYSQL -u $1 --password=$2 oai_db < $OPENAIRCN_DIR/OPENAIRHSS/db/oai_db.sql if [ $? -ne 0 ]; then echo_error "oai_db tables creation failed" + rv=1 else echo_success "oai_db tables creation succeeded" fi @@ -817,9 +837,11 @@ create_hss_database(){ $MYSQL -u $1 --password=$2 -e "$SQL" if [ $? -ne 0 ]; then echo_error "hssadmin permissions failed" + rv=1 else echo_success "hssadmin permissions succeeded" fi + return rv } ################################ diff --git a/targets/build_oai.bash b/targets/build_oai.bash index 48bd4b7aa4..278d8d2003 100755 --- a/targets/build_oai.bash +++ b/targets/build_oai.bash @@ -406,6 +406,9 @@ build_enb(){ } build_epc(){ + + epc_compiled=1 + echo_info "Note: this scripts works only for Ubuntu 12.04" @@ -418,8 +421,12 @@ build_epc(){ check_install_asn1c - if [ ! -d /usr/local/etc/freeDiameter ]; then + if [ $OAI_CLEAN = 1 ]; then check_install_freediamter + else + if [ ! -d /usr/local/etc/freeDiameter ]; then + check_install_freediamter + fi fi check_s6a_certificate @@ -427,14 +434,40 @@ build_epc(){ # configure and compile ########################################## - compile_epc + echo_info "5. configure and compile epc" + + output=$(compile_epc $OAI_CLEAN >> bin/install_log.txt 2>&1 ) + epc_compiled=$? + check_for_epc_executable + echo_info "finished epc target: check the installation log file bin/install_log.txt" + +########################################### +# install the binary in bin +########################################## + + echo_info "6. install the binary file" + + if [ $epc_compiled = 0 ]; then + echo_success "target epc built and installed in the bin directory" + echo "target epc built and installed in the bin directory" >> bin/${oai_build_date} + cp -f $OPENAIR_TARGETS/PROJECTS/GENERIC-LTE-EPC/CONF/epc.generic.conf $OPENAIR_TARGETS/bin + fi + +###################################### +# run +###################################### + echo_info "7. run EPC (check the bin/epc.generic.conf params)" + + sudo bin/oai_epc -c bin/epc.generic.conf -K /tmp/itti.log } build_hss(){ -echo_info "Note: this scripts works only for Ubuntu 12.04" + hss_compiled=1 + + echo_info "Note: this scripts works only for Ubuntu 12.04" ###################################### # CHECK MISC SOFTWARES AND LIBS # @@ -443,8 +476,12 @@ echo_info "Note: this scripts works only for Ubuntu 12.04" check_install_hss_software - if [ ! -d /usr/local/etc/freeDiameter ]; then + if [ $OAI_CLEAN = 1 ]; then check_install_freediamter + else + if [ ! -d /usr/local/etc/freeDiameter ]; then + check_install_freediamter + fi fi check_s6a_certificate ###################################### @@ -452,20 +489,39 @@ echo_info "Note: this scripts works only for Ubuntu 12.04" ###################################### echo_info "5.compile HSS" - compile_hss - - + output=$(compile_hss >> bin/install_log.txt 2>&1 ) + hss_compiled=$? + check_for_hss_executable + echo_info "finished hss target: check the installation log file bin/install_log.txt" + ###################################### # fill the HSS DB ###################################### - echo_info "5.compile HSS" + echo_info "6.create HSS database (for EURECOM SIM CARDS)" + hss_db_created=1 + output=$(create_hss_database) + hss_db_created=$? + +###################################### +# install hss +###################################### - create_hss_database + echo_info "6. install the binary file" + if [ $hss_compiled = 0 ]; then + if [ $hss_db_created = 0 ]; then + echo_success "target hss built, DB created and installed in the bin directory" + echo "target hss built, DB created, and installed in the bin directory" >> bin/${oai_build_date} + else + echo_warning "hss DB not created" + fi + cp -f $OPENAIRCN_DIR/OPENAIRHSS/conf/hss.conf $OPENAIR_TARGETS/bin + fi ###################################### # LAUNCH HSS # ###################################### - $OPENAIRCN_DIR/OPENAIRHSS/objs/openair-hss -c $OPENAIRCN_DIR/OPENAIRHSS/conf/hss.conf + echo_info "7. run hss" + bin/openair-hss -c bin/hss.conf } -- 2.26.2