Commit c8a659a1 authored by thomasl's avatar thomasl

More features in the cmake building

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6798 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 6697b3b2
......@@ -110,14 +110,21 @@ add_definitions("-DCMAKER")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O3")
find_package(Subversion)
if(SUBVERSION_FOUND)
Subversion_WC_INFO(${OPENAIR_DIR} openair)
set (FIRMWARE_VERSION "${openair_WC_REVISION} - ${openair_WC_LAST_CHANGED_DATE}")
Subversion_WC_LOG(${OPENAIR_DIR} Project)
else()
set (FIRMWARE_VERSION "No svn information")
endif()
# Below has been put in comment because does not work with
# SVN authentication.
#
#find_package(Subversion)
#if(SUBVERSION_FOUND)
# Subversion_WC_INFO(${OPENAIR_DIR} openair)
# set (FIRMWARE_VERSION "${openair_WC_REVISION} - ${openair_WC_LAST_CHANGED_DATE}")
# Subversion_WC_LOG(${OPENAIR_DIR} Project)
#else()
# set (FIRMWARE_VERSION "No svn information")
#endif()
#add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
# Below is a hard-coded info
set (FIRMWARE_VERSION "No svn information")
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
......@@ -331,7 +338,7 @@ add_boolean_option(NO_RRM True "????")
add_boolean_option(OAI_EMU False "specific to oaisim")
add_boolean_option(OAISIM False "specific to oaisim")
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK False "????")
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
add_boolean_option(OPENAIR1 True "????")
add_boolean_option(OPENAIR2 True "????")
add_boolean_option(OPENAIR_EMU False "specific to oaisim")
......@@ -1298,11 +1305,15 @@ list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c)
# We should change the constant name to xxx_RTAI or likely
if(NOT ${module_cc_opt} MATCHES "DRTAI")
set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK")
list(APPEND nasmesh_src netlink.c)
else()
string(REPLACE "-DNAS_NETLINK" "" tmp "${module_cc_opt}")
set(module_cc_opt ${tmp})
endif()
# legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
# so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
if (OAI_NW_DRIVER_USE_NETLINK)
list(APPEND nasmesh_src netlink.c)
endif()
make_driver(nasmesh ${OPENAIR2_DIR}/NAS/DRIVER/MESH ${nasmesh_src})
# ???
......@@ -1322,6 +1333,14 @@ add_executable(updatefw
${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
)
# ue_ip: purpose ???
###############
list(APPEND ue_ip_src device.c common.c)
if(OAI_NW_DRIVER_USE_NETLINK)
list(APPEND ue_ip_src netlink.c)
endif()
make_driver(ue_ip ${OPENAIR2_DIR}/NETWORK_DRIVER/UE_IP ${ue_ip_src})
# add the install targets
#install (TARGETS Tutorial DESTINATION bin)
#install (FILES "${PROJECT_BIN_DIR}/TutorialConfig.h" DESTINATION include)
#!/bin/bash
if [ -s $OPENAIR_DIR/cmake_targets/build_helper.bash ] ; then
source $OPENAIR_DIR/cmake_targets/build_helper.bash
else
echo "Error: no file in the file tree: is OPENAIR_DIR variable set?"
exit 1
fi
dbin=$OPENAIR_DIR/cmake_targets/autotests/bin
dlog=$OPENAIR_DIR/cmake_targets/autotests/log
run_test() {
case=case$1; shift
cmd=$1; shift
expected=$3; shift
$cmd > $dlog/$case.txt 2>&1
if [ $expected = "true" ] ; then
if $* $dlog/$case.txt; then
echo_success "test $case, command: $cmd ok"
else
echo_error "test $case, command: $cmd Failed"
fi
else
if $* $dlog/$case.txt; then
echo_error "test $case, command: $cmd Failed"
else
echo_success "test $case, command: $cmd ok"
fi
fi
}
run_test 0200 "$dbin/oaisim.r8 -a -A AWGN -n 100" false grep -q '(Segmentation.fault)|(Exiting)|(FATAL)'
run_test 0201 "$dbin/oaisim.r8 -a -A AWGN -n 100" false fgrep -q '[E]'
......@@ -132,43 +132,35 @@ run_compilation_autotests() {
"test 0120: nasmesk.ko failed"
}
make_one_cert() {
openssl genrsa -out $1.key.pem 1024
openssl req -new -batch -out $1.csr.pem -key $1.key.pem -subj /CN=$1.eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
openssl ca -cert cacert.pem -keyfile cakey.pem -in $1.csr.pem -out $1.cert.pem -outdir . -batch
}
make_certs(){
# for certtificate generation
rm -rf demoCA
mkdir -m 777 -p demoCA
echo 01 > demoCA/serial
touch demoCA/index.txt
echo "creating the certificate"
user=$(whoami)
HOSTNAME=$(hostname -f)
echo "Creating certificate for user '$HOSTNAME'"
# CA self certificate
openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out cacert.pem -keyout cakey.pem -subj /CN=eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
# openssl genrsa -out user.key.pem 1024
openssl genrsa -out hss.key.pem 1024
#openssl req -new -batch -out user.csr.pem -key user.key.pem -subj /CN=$HOSTNAME.eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
openssl req -new -batch -out hss.csr.pem -key hss.key.pem -subj /CN=hss.eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
openssl ca -cert cacert.pem -keyfile cakey.pem -in hss.csr.pem -out hss.cert.pem -outdir . -batch
# certificates are stored in diameter config directory
if [ ! -d /usr/local/etc/freeDiameter ]; then
echo "Creating non existing directory: /usr/local/etc/freeDiameter/"
$SUDO mkdir /usr/local/etc/freeDiameter/
$SUDO mkdir -p /usr/local/etc/freeDiameter/ || echo_error "can't create: /usr/local/etc/freeDiameter/"
fi
cd /usr/local/etc/freeDiameter
echo "creating the CA certificate"
echo_warning "erase all existing certificates as long as the CA is regenerated"
$SUDO rm -f /usr/local/etc/freeDiameter/
# CA self certificate
$SUDO openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out cacert.pem -keyout cakey.pem -subj /CN=eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
echo "Copying *.pem to /usr/local/etc/freeDiameter/"
$SUDO cp *.pem /usr/local/etc/freeDiameter/
mv *.pem bin/
# openssl genrsa -out ubuntu.key.pem 1024
# openssl req -new -batch -x509 -out ubuntu.csr.pem -key ubuntu.key.pem -subj /CN=ubuntu.localdomain/C=FR/ST=BdR/L=Aix/O=fD/OU=Tests
# openssl ca -cert cacert.pem -keyfile cakey.pem -in ubuntu.csr.pem -out ubuntu.cert.pem -outdir . -batch
# generate hss certificate and sign it
$SUDO make_one_cert hss
$SUDO make_one_cert mme
# legacy config is using a certificate named 'user'
$SUDO make_one_cert user
}
install_nettle_from_source() {
......@@ -215,56 +207,6 @@ install_freediameter_from_source() {
rm -rf /tmp/1.1.5.tar.gz /tmp/freeDiameter-1.1.5
}
check_epc_s6a_certificate() {
if [ -d /usr/local/etc/freeDiameter ]
then
if [ -f /usr/local/etc/freeDiameter/user.cert.pem ]
then
full_hostname=`cat /usr/local/etc/freeDiameter/user.cert.pem | grep "Subject" | grep "CN" | cut -d '=' -f6`
if [ a$full_hostname == a`hostname`.${1:-'eur'} ]
then
echo_success "EPC S6A: Found valid certificate in /usr/local/etc/freeDiameter"
return 0
fi
fi
fi
echo_error "EPC S6A: Did not find valid certificate in /usr/local/etc/freeDiameter"
echo_warning "EPC S6A: generatting new certificate in /usr/local/etc/freeDiameter..."
cd $OPENAIRCN_DIR/S6A/freediameter
./make_certs.sh ${1:-'eur'}
if [ $# -lt 2 ] ; then
check_epc_s6a_certificate ${1:-'eur'} 2
return $?
else
exit 1
fi
}
check_hss_s6a_certificate() {
if [ -d /usr/local/etc/freeDiameter ]; then
if [ -f /usr/local/etc/freeDiameter/hss.cert.pem ]; then
full_hostname=`cat /usr/local/etc/freeDiameter/hss.cert.pem | grep "Subject" | grep "CN" | cut -d '=' -f6`
if [ a$full_hostname == a`hostname`.${1:-'eur'} ]
then
echo_success "HSS S6A: Found valid certificate in /usr/local/etc/freeDiameter"
return 0
else
echo_error "Bad hss hostname found in cert file: "$full_hostname " hostname is "`hostname`
fi
fi
fi
echo_error "S6A: Did not find valid certificate in /usr/local/etc/freeDiameter"
echo_warning "S6A: generatting new certificate in /usr/local/etc/freeDiameter..."
cd $OPENAIRCN_DIR/OPENAIRHSS/conf
./make_certs.sh ${1:-'eur'}
if [ $# -lt 2 ] ; then
check_hss_s6a_certificate ${1:-'eur'} 2
return $?
else
exit 1
fi
}
check_install_usrp_uhd_driver(){
if [ ! -f /etc/apt/sources.list.d/ettus.list ] ; then
$SUDO bash -c 'echo "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/`lsb_release -cs` `lsb_release -cs` main" >> /etc/apt/sources.list.d/ettus.list'
......@@ -397,7 +339,7 @@ compile_hss() {
compile_epc() {
cd $OPENAIRCN_DIR
if [ $1 = 1 ]; then
if [ "$1" = 1 ]; then
echo_info "build a clean EPC"
bash_exec "rm -rf objs"
fi
......@@ -484,11 +426,6 @@ compile_nas_tools() {
touch /tmp/nas_cleaned
}
compile_ue_ip_nw_driver() {
cd $OPENAIR2_DIR && make ue_ip.ko
}
# arg1 is RT
# arg2 is HW
# arg3 is ENB_S1
......@@ -659,40 +596,7 @@ set_openair_env(){
}
########################################
### print help
######################################
print_help(){
echo_success "Name : build_oai - install and build OAI"
echo_success "-c | --clean : Enable clean OAI build (default disabled)"
echo_success "--clean-iptables"
echo_success "-C | --config-file : Set the config file local path"
echo_success "-g | --run-with-gdb : Run the executable built by this script with gdb"
echo_success "-K | --itti-dump-file : Set the execution events trace file"
echo_success "-l | --build-target : Set the LTE build target: ENB,EPC,HSS,NONE (default ENB)"
echo_success "-m | --build-from-makefile : Enable build from the makefile (default disabled)"
echo_success "-r | --3gpp-release : Set the release: Rel8, Rel10 (default Rel10)"
echo_success "-s | --check : Enable OAI testing and sanity check (default disabled)"
echo_success "-V | --vcd : Log vcd events (costs performance)"
echo_success "-w | --hardware : Set the hardware platform: EXMIMO, USRP (also installs UHD driver), ETHERNET, NONE, (default EXMIMO)"
echo_success "-x | --xforms : Enable xforms (default disabled)"
}
print_help_perf(){
echo_success "Name : perf_oai generate traffic and evaluate the performance "
echo_success "Usage: perf_oai.bash -l ITG "
echo_success "-l | --perf-app : Set Performance evaluation app: ITGS, ITGD,PING, OTG-OAISIM, OTG-CBA, (default PING)"
echo_success "-m | --owd : enable D-ITG one-way-delay meter (default disabled)"
echo_success "-e | --duration : set the duration of the experiment (default 60000ms)"
echo_success "-i | --idt-dist : set the distribution of the inter-departure time: CONSTANT, UNIFORM,EXPONENTIAL (default CONSTANT)"
echo_success "-s | --ps-dist : set the distribution of the inter-departure time (default CONSTANT, available options: UNIFORM,EXPONENTIAL)"
echo_success "-d | --dst : set the destination address (default 127.0.0.1)"
echo_success "-p | --dst-port : set the destination address (default NONE)"
echo_success "-t | --test : enable test mode to validate the functionality (default disabled)"
echo_success "-k | --keep-log-file : keep the log files (default disabled)"
}
###############################
## echo and family
###############################
......@@ -723,55 +627,11 @@ cecho() # Color-echo
return
}
echo_error() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $red
}
echo_fatal() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
echo_error "$my_string"
exit -1
}
echo_warning() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
done
cecho "$my_string" $yellow
}
echo_success() {
local my_string=""
until [ -z "$1" ]
do
my_string="$my_string$1"
shift
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
}
echo_error() { cecho "$*" $red ;}
echo_fatal() { cecho "$*" $red; exit -1 ;}
echo_warning() { cecho "$*" $yellow ;}
echo_success() { cecho "$*" $green ;}
echo_info() { cecho "$*" $blue ;}
bash_exec() {
output=$($1 2>&1)
......
......@@ -212,13 +212,15 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
"lte-softmodem compiled" \
"lte-softmodem compilation failed"
# nasmesh driver compilation
# ue_ip driver compilation
compilations \
lte_build_oai nasmesh \
CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko \
$dlog/nasmesh.txt \
"nasmesh driver compiled" \
"nasmesh driver compilation failed"
lte_build_oai ue_ip \
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko \
$dlog/ue_ip.txt \
"ue_ip driver compiled" \
"ue_ip driver compilation failed"
# lte unitary simulators compilation
simlist="dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
......@@ -269,10 +271,29 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
"oaisim compiled" \
"oaisim compilation failed"
#oai_nw_drv
compilations \
oaisim_build_oai oai_nw_drv \
CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko \
$dlog/oai_nw_drv.txt \
"oai_nw_drv driver compiled" \
"oai_nw_drv driver compilation failed"
# nasmesh driver compilation
compilations \
oaisim_build_oai nasmesh \
CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko \
$dlog/nasmesh.txt \
"nasmesh driver compiled" \
"nasmesh driver compilation failed"
fi
# EPC compilation
##################
if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
compile_epc
fi
# Auto-tests
#####################
......
......@@ -44,8 +44,8 @@ set ( NEW_FFT True )
set ( NO_RRM True )
set ( OAI_EMU True )
set ( OAISIM True )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK False )
set ( OAI_NW_DRIVER_TYPE_ETHERNET True )
set ( OAI_NW_DRIVER_USE_NETLINK True )
set ( OPENAIR1 True )
set ( OPENAIR2 True )
set ( OPENAIR_EMU False )
......
......@@ -41,17 +41,3 @@ else
echo 'No corresponding firmware found'
return
fi
load_module $OPENAIR_DIR/cmake_targets/bin/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
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