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
This commit is contained in:
+17
-13
@@ -984,19 +984,23 @@ set_openair_env(){
|
|||||||
print_help(){
|
print_help(){
|
||||||
echo_success "Name : build_oai - install and build OAI"
|
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 "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 "-a | --doxygen : Enable doxygen for documentation (default disabled)"
|
||||||
echo_success "-b : disables S1 interface for eNB (default enabled)"
|
echo_success "-b | --disable-s1 : Disables S1 interface for eNB (default enabled)"
|
||||||
echo_success "-c : enables clean OAI build (default disabled)"
|
echo_success "-c | --clean : Enables clean OAI build (default disabled)"
|
||||||
echo_success "-d : enables debug mode (default disabled)"
|
echo_success "-C | --config-file : Set the config file local path"
|
||||||
echo_success "-e : sets realtime mode: RTAI, NONE (default NONE)"
|
echo_success "-d | --debug : Enables debug mode (default disabled)"
|
||||||
echo_success "-l : sets the LTE build target: ENB,EPC,HSS,NONE (default ENB)"
|
echo_success "-e | --realtime : Sets realtime mode: RTAI, NONE (default NONE)"
|
||||||
echo_success "-m : enables build from the makefile (default disabled)"
|
echo_success "-g | --run-with-gdb : Run with gdb"
|
||||||
echo_success "-r : sets the release: REL8, REL10 (default REL8)"
|
echo_success "-K | --itti-dump-file : Set the execution events trace file"
|
||||||
echo_success "-s : enables OAI testing and sanity check (default disabled)"
|
echo_success "-l | --build-target : Sets the LTE build target: ENB,EPC,HSS,NONE (default ENB)"
|
||||||
echo_success "-t : sets the eNB build target: ALL, SOFTMODEM,OAISIM,UNISIM (default ALL)"
|
echo_success "-m | --build-from-makefile : Enables build from the makefile (default disabled)"
|
||||||
echo_success "-w : sets the hardware platform: EXMIMO, USRP (also installs UHD driver), ETHERNET, NONE, (default EXMIMO)"
|
echo_success "-r | --3gpp-release : Sets the release: REL8, REL10 (default REL8)"
|
||||||
echo_success "-x : enables xforms (default disabled)"
|
echo_success "-s | --check : Enables OAI testing and sanity check (default disabled)"
|
||||||
echo_success "-z : sets the default build options"
|
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
|
## echo and family
|
||||||
|
|||||||
+173
-104
@@ -47,28 +47,31 @@ check_for_root_rights
|
|||||||
######################################
|
######################################
|
||||||
|
|
||||||
#only one could be set at the time
|
#only one could be set at the time
|
||||||
BUILD_LTE="ENB" # ENB, EPC, HSS, NONE
|
declare BUILD_LTE="ENB" # ENB, EPC, HSS, NONE
|
||||||
|
|
||||||
HW="EXMIMO" # EXMIMO, USRP, ETHERNET, NONE
|
declare HW="EXMIMO" # EXMIMO, USRP, ETHERNET, NONE
|
||||||
TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE
|
declare TARGET="ALL" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE
|
||||||
ENB_S1=1
|
declare ENB_S1=1
|
||||||
REL="REL8" # REL8, REL10
|
declare REL="REL8" # REL8, REL10
|
||||||
RT="NONE" # RTAI, RT_PREMPT or RT_DISABLED, NONE
|
declare RT="NONE" # RTAI, RT_PREMPT or RT_DISABLED, NONE
|
||||||
DEBUG=0
|
declare DEBUG=0
|
||||||
|
declare CONFIG_FILE=""
|
||||||
|
declare EXE_ARGUMENTS=""
|
||||||
|
declare RUN_GDB=0
|
||||||
|
declare DISABLE_CHECK_INSTALLED_SOFTWARE=0
|
||||||
|
|
||||||
|
declare OAI_TEST=0
|
||||||
OAI_TEST=0
|
declare XFORMS=0
|
||||||
XFORMS=0
|
|
||||||
|
|
||||||
# script is not currently handling these params
|
# script is not currently handling these params
|
||||||
EPC=0 # flag to build EPC
|
declare EPC=0 # flag to build EPC
|
||||||
|
|
||||||
ITTI_ANALYZER=0
|
declare ITTI_ANALYZER=0
|
||||||
VCD_TIMING=0
|
declare VCD_TIMING=0
|
||||||
WIRESHARK=0
|
declare WIRESHARK=0
|
||||||
TIME_MEAS=0
|
declare TIME_MEAS=0
|
||||||
DOXYGEN=0
|
declare DOXYGEN=0
|
||||||
DEV=0
|
declare DEV=0
|
||||||
|
|
||||||
EMULATION_DEV_INTERFACE="eth0"
|
EMULATION_DEV_INTERFACE="eth0"
|
||||||
EMULATION_MULTICAST_GROUP=1
|
EMULATION_MULTICAST_GROUP=1
|
||||||
@@ -87,79 +90,128 @@ fi
|
|||||||
# echo "i is : $i"
|
# echo "i is : $i"
|
||||||
# case $i in
|
# case $i in
|
||||||
|
|
||||||
while getopts "abcdmsxzhe:l:w:r:t:" OPTION; do
|
|
||||||
case "$OPTION" in
|
|
||||||
a)
|
while true; do
|
||||||
DOXYGEN=1
|
case "$1" in
|
||||||
echo "setting doxygen flag to: $DOXYGEN"
|
-a | --doxygen)
|
||||||
;;
|
DOXYGEN=1
|
||||||
b)
|
echo "setting doxygen flag to: $DOXYGEN"
|
||||||
ENB_S1=0
|
shift;
|
||||||
echo "disable eNB S1 flag"
|
;;
|
||||||
;;
|
-b | --disable-s1)
|
||||||
c)
|
ENB_S1=0
|
||||||
rm -rf ./.lock_oaibuild
|
echo "disable eNB S1 flag"
|
||||||
OAI_CLEAN=1
|
shift;
|
||||||
echo "setting clean flag to: $OAI_CLEAN"
|
;;
|
||||||
echo "check package installation, and recompile OAI"
|
-c | --clean)
|
||||||
;;
|
rm -rf ./.lock_oaibuild
|
||||||
d)
|
OAI_CLEAN=1
|
||||||
DEBUG=1
|
echo "setting clean flag to: $OAI_CLEAN"
|
||||||
echo "setting debug flag to: $DEBUG"
|
echo "may check package installation, and recompile OAI"
|
||||||
;;
|
shift;
|
||||||
e)
|
;;
|
||||||
RT="$OPTARG"
|
-C | --config-file)
|
||||||
echo "setting realtime flag to: $RT"
|
CONFIG_FILE=$2
|
||||||
;;
|
echo "setting config file to: $CONFIG_FILE"
|
||||||
l)
|
EXE_ARGUMENTS ="$EXE_ARGUMENTS -O $CONFIG_FILE"
|
||||||
BUILD_LTE="$OPTARG"
|
shift 2;
|
||||||
echo "setting top-level build target to: $OPTARG"
|
;;
|
||||||
;;
|
-d | --debug)
|
||||||
h)
|
DEBUG=1
|
||||||
print_help
|
echo "setting debug flag to: $DEBUG"
|
||||||
exit -1
|
shift;
|
||||||
;;
|
;;
|
||||||
m)
|
-D | --disable-check-installed-software)
|
||||||
BUILD_FROM_MAKEFILE=1
|
DISABLE_CHECK_INSTALLED_SOFTWARE=1
|
||||||
set_build_from_makefile $BUILD_FROM_MAKEFILE
|
echo "disable check installed software"
|
||||||
echo "setting a flag to build from makefile to: $BUILD_FROM_MAKEFILE"
|
shift;
|
||||||
;;
|
;;
|
||||||
r)
|
-e | --realtime)
|
||||||
REL="$OPTARG"
|
RT="$2"
|
||||||
echo "setting release to: $REL"
|
echo "setting realtime flag to: $RT"
|
||||||
;;
|
shift 2 ;
|
||||||
s)
|
;;
|
||||||
OAI_TEST=1
|
-g | --run-with-gdb)
|
||||||
echo "setting sanity check to: $OAI_TEST"
|
RUN_GDB=1
|
||||||
;;
|
echo "Running with gdb"
|
||||||
t)
|
shift 2 ;
|
||||||
TARGET="$OPTARG"
|
;;
|
||||||
echo "setting target to: $TARGET"
|
-K | --itti-dump-file)
|
||||||
;;
|
ITTI_ANALYZER=1
|
||||||
w)
|
ITTI_DUMP_FILE=$2
|
||||||
HW="$OPTARG" #"${i#*=}"
|
echo "setting ITTI dump file to: $ITTI_DUMP_FILE"
|
||||||
echo "setting hardware to: $HW"
|
EXE_ARGUMENTS="$EXE_ARGUMENTS -K $ITTI_DUMP_FILE"
|
||||||
;;
|
shift 2;
|
||||||
x)
|
;;
|
||||||
XFORMS=1
|
-l | --build-target)
|
||||||
echo "setting xforms to: $XFORMS"
|
BUILD_LTE="$2"
|
||||||
;;
|
echo "setting top-level build target to: $2"
|
||||||
z)
|
shift 2;
|
||||||
echo "setting all parameters to: default"
|
;;
|
||||||
rm -rf ./.lock_oaibuild
|
-h | --help)
|
||||||
OAI_CLEAN=1
|
print_help
|
||||||
HW="EXMIMO"
|
exit -1
|
||||||
TARGET="ALL"
|
;;
|
||||||
ENB_S1=1
|
-m | --build-from-makefile)
|
||||||
REL="REL8"
|
BUILD_FROM_MAKEFILE=1
|
||||||
RT="NONE"
|
set_build_from_makefile $BUILD_FROM_MAKEFILE
|
||||||
DEBUG=0
|
echo "setting a flag to build from makefile to: $BUILD_FROM_MAKEFILE"
|
||||||
ENB_CONFIG_FILE=$OPENAIR_TARGETS/"PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.conf"
|
shift;
|
||||||
OAI_TEST=0
|
;;
|
||||||
;;
|
-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
|
# unknown option
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -304,15 +356,18 @@ build_enb(){
|
|||||||
############################################
|
############################################
|
||||||
# check the installation
|
# check the installation
|
||||||
############################################
|
############################################
|
||||||
|
if [ $DISABLE_CHECK_INSTALLED_SOFTWARE -eq 0 ]; then
|
||||||
|
echo_info "6. Checking the the required softwares/packages ..."
|
||||||
|
|
||||||
echo_info "6. Checking the installation ..."
|
check_install_oai_software
|
||||||
|
if [ $HW = "USRP" ]; then
|
||||||
check_install_oai_software
|
check_install_usrp_uhd_driver
|
||||||
if [ $HW = "USRP" ]; then
|
fi
|
||||||
check_install_usrp_uhd_driver
|
check_install_asn1c
|
||||||
|
check_install_nettle
|
||||||
|
else
|
||||||
|
echo_info "6. Not checking the required softwares/packages ..."
|
||||||
fi
|
fi
|
||||||
check_install_asn1c
|
|
||||||
check_install_nettle
|
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# compile
|
# compile
|
||||||
@@ -416,7 +471,6 @@ build_epc(){
|
|||||||
|
|
||||||
epc_compiled=1
|
epc_compiled=1
|
||||||
|
|
||||||
|
|
||||||
echo_info "Note: this scripts works only for Ubuntu 12.04"
|
echo_info "Note: this scripts works only for Ubuntu 12.04"
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
@@ -572,11 +626,11 @@ esac
|
|||||||
############################################
|
############################################
|
||||||
|
|
||||||
if [ $DOXYGEN = 1 ]; then
|
if [ $DOXYGEN = 1 ]; then
|
||||||
echo_info "9. Generate doxygen documentation ..."
|
echo_info "9. Generate doxygen documentation ..."
|
||||||
doxygen $OPENAIR_TARGETS/DOCS/Doxyfile
|
doxygen $OPENAIR_TARGETS/DOCS/Doxyfile
|
||||||
echo_info "9.1 use your navigator to open $OPENAIR_TARGETS/DOCS/html/index.html "
|
echo_info "9.1 use your navigator to open $OPENAIR_TARGETS/DOCS/html/index.html "
|
||||||
else
|
else
|
||||||
echo_info "9. Bypassing doxygen documentation ..."
|
echo_info "9. Bypassing doxygen documentation ..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -585,13 +639,28 @@ esac
|
|||||||
############################################
|
############################################
|
||||||
|
|
||||||
if [ $OAI_TEST = 1 ]; then
|
if [ $OAI_TEST = 1 ]; then
|
||||||
echo_info "10. Testing ..."
|
echo_info "10. Testing ..."
|
||||||
python $OPENAIR_TARGETS/TEST/OAI/test01.py
|
python $OPENAIR_TARGETS/TEST/OAI/test01.py
|
||||||
else
|
else
|
||||||
echo_info "10. Bypassing the Tests ..."
|
echo_info "10. Bypassing the Tests ..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# run
|
# run
|
||||||
############################################
|
############################################
|
||||||
echo_info "11. Running ... To be done"
|
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user