From c3bde8bbb6a6dbaeccc02be1f008207cd97f43f0 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Tue, 9 Dec 2014 15:54:35 +0000 Subject: [PATCH] changed getopt that do not take long arguments in bash. May have a look at https://code.google.com/p/shflags/downloads/list #!/bin/sh # source shflags from current directory . ./shflags # define a 'name' command-line string flag DEFINE_string 'name' 'world' 'name to say hello to' 'n' # parse the command-line FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" # say hello echo "Hello, ${FLAGS_name}!" git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6212 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- targets/build_helper.bash | 30 ++-- targets/build_oai.bash | 283 ++++++++++++++++++++++++-------------- 2 files changed, 193 insertions(+), 120 deletions(-) diff --git a/targets/build_helper.bash b/targets/build_helper.bash index c0839ba4a1..e1fa87c503 100755 --- a/targets/build_helper.bash +++ b/targets/build_helper.bash @@ -984,19 +984,23 @@ set_openair_env(){ print_help(){ echo_success "Name : build_oai - install and build OAI" echo_success "Usage: build_oai.bash -a -b -c -d -eRTAI -m -rREL8 -s -tOAISIM -wEXMIMO -x" - echo_success "-a : enable doxygen for documentation (default disabled)" - echo_success "-b : disables S1 interface for eNB (default enabled)" - echo_success "-c : enables clean OAI build (default disabled)" - echo_success "-d : enables debug mode (default disabled)" - echo_success "-e : sets realtime mode: RTAI, NONE (default NONE)" - echo_success "-l : sets the LTE build target: ENB,EPC,HSS,NONE (default ENB)" - echo_success "-m : enables build from the makefile (default disabled)" - echo_success "-r : sets the release: REL8, REL10 (default REL8)" - echo_success "-s : enables OAI testing and sanity check (default disabled)" - echo_success "-t : sets the eNB build target: ALL, SOFTMODEM,OAISIM,UNISIM (default ALL)" - echo_success "-w : sets the hardware platform: EXMIMO, USRP (also installs UHD driver), ETHERNET, NONE, (default EXMIMO)" - echo_success "-x : enables xforms (default disabled)" - echo_success "-z : sets the default build options" + echo_success "-a | --doxygen : Enable doxygen for documentation (default disabled)" + echo_success "-b | --disable-s1 : Disables S1 interface for eNB (default enabled)" + echo_success "-c | --clean : Enables clean OAI build (default disabled)" + echo_success "-C | --config-file : Set the config file local path" + echo_success "-d | --debug : Enables debug mode (default disabled)" + echo_success "-e | --realtime : Sets realtime mode: RTAI, NONE (default NONE)" + echo_success "-g | --run-with-gdb : Run with gdb" + echo_success "-K | --itti-dump-file : Set the execution events trace file" + echo_success "-l | --build-target : Sets the LTE build target: ENB,EPC,HSS,NONE (default ENB)" + echo_success "-m | --build-from-makefile : Enables build from the makefile (default disabled)" + echo_success "-r | --3gpp-release : Sets the release: REL8, REL10 (default REL8)" + echo_success "-s | --check : Enables OAI testing and sanity check (default disabled)" + echo_success "-t | --enb-build-target : Sets the eNB build target: ALL, SOFTMODEM,OAISIM,UNISIM (default ALL)" + echo_success "-V | --vcd : Log vcd events" + echo_success "-w | --hardware : sets the hardware platform: EXMIMO, USRP (also installs UHD driver), ETHERNET, NONE, (default EXMIMO)" + echo_success "-x | --xforms : enables xforms (default disabled)" + echo_success "-z | --defaults : sets the default build options" } ############################### ## echo and family diff --git a/targets/build_oai.bash b/targets/build_oai.bash index 650f894258..5f25255230 100755 --- a/targets/build_oai.bash +++ b/targets/build_oai.bash @@ -47,28 +47,31 @@ check_for_root_rights ###################################### #only one could be set at the time -BUILD_LTE="ENB" # ENB, EPC, HSS, NONE - -HW="EXMIMO" # EXMIMO, USRP, ETHERNET, NONE -TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE -ENB_S1=1 -REL="REL8" # REL8, REL10 -RT="NONE" # RTAI, RT_PREMPT or RT_DISABLED, NONE -DEBUG=0 - - -OAI_TEST=0 -XFORMS=0 +declare BUILD_LTE="ENB" # ENB, EPC, HSS, NONE + +declare HW="EXMIMO" # EXMIMO, USRP, ETHERNET, NONE +declare TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE +declare ENB_S1=1 +declare REL="REL8" # REL8, REL10 +declare RT="NONE" # RTAI, RT_PREMPT or RT_DISABLED, NONE +declare DEBUG=0 +declare CONFIG_FILE="" +declare EXE_ARGUMENTS="" +declare RUN_GDB=0 +declare DISABLE_CHECK_INSTALLED_SOFTWARE=0 + +declare OAI_TEST=0 +declare XFORMS=0 # script is not currently handling these params -EPC=0 # flag to build EPC +declare EPC=0 # flag to build EPC -ITTI_ANALYZER=0 -VCD_TIMING=0 -WIRESHARK=0 -TIME_MEAS=0 -DOXYGEN=0 -DEV=0 +declare ITTI_ANALYZER=0 +declare VCD_TIMING=0 +declare WIRESHARK=0 +declare TIME_MEAS=0 +declare DOXYGEN=0 +declare DEV=0 EMULATION_DEV_INTERFACE="eth0" EMULATION_MULTICAST_GROUP=1 @@ -87,79 +90,128 @@ fi # echo "i is : $i" # case $i in -while getopts "abcdmsxzhe:l:w:r:t:" OPTION; do - case "$OPTION" in - a) - DOXYGEN=1 - echo "setting doxygen flag to: $DOXYGEN" - ;; - b) - ENB_S1=0 - echo "disable eNB S1 flag" - ;; - c) - rm -rf ./.lock_oaibuild - OAI_CLEAN=1 - echo "setting clean flag to: $OAI_CLEAN" - echo "check package installation, and recompile OAI" - ;; - d) - DEBUG=1 - echo "setting debug flag to: $DEBUG" - ;; - e) - RT="$OPTARG" - echo "setting realtime flag to: $RT" - ;; - l) - BUILD_LTE="$OPTARG" - echo "setting top-level build target to: $OPTARG" - ;; - h) - print_help - exit -1 - ;; - m) - BUILD_FROM_MAKEFILE=1 - set_build_from_makefile $BUILD_FROM_MAKEFILE - echo "setting a flag to build from makefile to: $BUILD_FROM_MAKEFILE" - ;; - r) - REL="$OPTARG" - echo "setting release to: $REL" - ;; - s) - OAI_TEST=1 - echo "setting sanity check to: $OAI_TEST" - ;; - t) - TARGET="$OPTARG" - echo "setting target to: $TARGET" - ;; - w) - HW="$OPTARG" #"${i#*=}" - echo "setting hardware to: $HW" - ;; - x) - XFORMS=1 - echo "setting xforms to: $XFORMS" - ;; - z) - echo "setting all parameters to: default" - rm -rf ./.lock_oaibuild - OAI_CLEAN=1 - HW="EXMIMO" - TARGET="ALL" - ENB_S1=1 - REL="REL8" - RT="NONE" - DEBUG=0 - ENB_CONFIG_FILE=$OPENAIR_TARGETS/"PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.conf" - OAI_TEST=0 - ;; - *) + + +while true; do + case "$1" in + -a | --doxygen) + DOXYGEN=1 + echo "setting doxygen flag to: $DOXYGEN" + shift; + ;; + -b | --disable-s1) + ENB_S1=0 + echo "disable eNB S1 flag" + shift; + ;; + -c | --clean) + rm -rf ./.lock_oaibuild + OAI_CLEAN=1 + echo "setting clean flag to: $OAI_CLEAN" + echo "may check package installation, and recompile OAI" + shift; + ;; + -C | --config-file) + CONFIG_FILE=$2 + echo "setting config file to: $CONFIG_FILE" + EXE_ARGUMENTS ="$EXE_ARGUMENTS -O $CONFIG_FILE" + shift 2; + ;; + -d | --debug) + DEBUG=1 + echo "setting debug flag to: $DEBUG" + shift; + ;; + -D | --disable-check-installed-software) + DISABLE_CHECK_INSTALLED_SOFTWARE=1 + echo "disable check installed software" + shift; + ;; + -e | --realtime) + RT="$2" + echo "setting realtime flag to: $RT" + shift 2 ; + ;; + -g | --run-with-gdb) + RUN_GDB=1 + echo "Running with gdb" + shift 2 ; + ;; + -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) + BUILD_LTE="$2" + echo "setting top-level build target to: $2" + shift 2; + ;; + -h | --help) + print_help + exit -1 + ;; + -m | --build-from-makefile) + BUILD_FROM_MAKEFILE=1 + set_build_from_makefile $BUILD_FROM_MAKEFILE + echo "setting a flag to build from makefile to: $BUILD_FROM_MAKEFILE" + shift; + ;; + -r | --3gpp-release) + REL="$2" + echo "setting release to: $REL" + shift 2 ; + ;; + -s | --check) + OAI_TEST=1 + echo "setting sanity check to: $OAI_TEST" + shift; + ;; + -t | --enb-build-target) + TARGET="$2" + echo "setting target to: $TARGET" + shift 2; + ;; + -V | --vcd) + echo "setting gtk-wave output" + VCD_TIMING=1 + EXE_ARGUMENTS="$EXE_ARGUMENTS -V" + shift ; + ;; + -w | --hardware) + HW="$2" #"${i#*=}" + echo "setting hardware to: $HW" + shift 2 ; + ;; + -x | --xforms) + XFORMS=1 + echo "setting xforms to: $XFORMS" + shift; + ;; + -z | --defaults) + echo "setting all parameters to: default" + rm -rf ./.lock_oaibuild + OAI_CLEAN=1 + HW="EXMIMO" + TARGET="ALL" + ENB_S1=1 + REL="REL8" + RT="NONE" + DEBUG=0 + ENB_CONFIG_FILE=$OPENAIR_TARGETS/"PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.conf" + OAI_TEST=0 + shift ; + ;; + ' ') + shift ; + ;; + *) + echo "Unknown option $1" + break ; # unknown option - ;; + ;; esac done @@ -304,15 +356,18 @@ build_enb(){ ############################################ # check the installation ############################################ - - echo_info "6. Checking the installation ..." - - check_install_oai_software - if [ $HW = "USRP" ]; then - check_install_usrp_uhd_driver + if [ $DISABLE_CHECK_INSTALLED_SOFTWARE -eq 0 ]; then + echo_info "6. Checking the the required softwares/packages ..." + + check_install_oai_software + if [ $HW = "USRP" ]; then + check_install_usrp_uhd_driver + fi + check_install_asn1c + check_install_nettle + else + echo_info "6. Not checking the required softwares/packages ..." fi - check_install_asn1c - check_install_nettle ############################################ # compile @@ -416,7 +471,6 @@ build_epc(){ epc_compiled=1 - echo_info "Note: this scripts works only for Ubuntu 12.04" ###################################### @@ -572,11 +626,11 @@ esac ############################################ if [ $DOXYGEN = 1 ]; then - echo_info "9. Generate doxygen documentation ..." - doxygen $OPENAIR_TARGETS/DOCS/Doxyfile - echo_info "9.1 use your navigator to open $OPENAIR_TARGETS/DOCS/html/index.html " + echo_info "9. Generate doxygen documentation ..." + doxygen $OPENAIR_TARGETS/DOCS/Doxyfile + echo_info "9.1 use your navigator to open $OPENAIR_TARGETS/DOCS/html/index.html " else - echo_info "9. Bypassing doxygen documentation ..." + echo_info "9. Bypassing doxygen documentation ..." fi @@ -585,13 +639,28 @@ esac ############################################ if [ $OAI_TEST = 1 ]; then - echo_info "10. Testing ..." - python $OPENAIR_TARGETS/TEST/OAI/test01.py + echo_info "10. Testing ..." + python $OPENAIR_TARGETS/TEST/OAI/test01.py else - echo_info "10. Bypassing the Tests ..." + echo_info "10. Bypassing the Tests ..." fi ############################################ # run ############################################ echo_info "11. Running ... To be done" + if [ $TARGET = "SOFTMODEM" ]; then + echo_info "############# running ltesoftmodem #############" + $OPENAIR_TARGETS/RT/USER/lte-softmodem + cd $OPENAIR_TARGETS/RT/USER;bash ./init_exmimo2.sh; + if [ $RUN_GDB -eq 0 ]; then + $OPENAIR_TARGETS/RT/USER/lte-softmodem "$EXE_ARGUMENTS" + else + touch ~/.gdb_lte_softmodem + echo "file $OPENAIR_TARGETS/RT/USER/lte-softmodem" > ~/.gdb_lte_softmodem + echo "set args $EXE_ARGUMENTS" >> ~/.gdb_lte_softmodem + echo "run" >> ~/.gdb_lte_softmodem + gdb -nh -x ~/.gdb_lte_softmodem 2>&1 + fi + fi + -- GitLab