Commit 70fefca3 authored by thomasl's avatar thomasl

fix bugs in cmake definitions

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6756 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 167a007f
...@@ -42,15 +42,63 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) ...@@ -42,15 +42,63 @@ set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
project (OpenAirInterface) project (OpenAirInterface)
###########################################
# macros to define options as there is numerous options in oai
################################################
macro(add_boolean_option name val helpstr)
if(DEFINED ${name})
set(value ${${name}})
else(DEFINED ${name})
set(value ${val})
endif()
set(${name} ${value} CACHE STRING "${helpstr}")
set_property(CACHE ${name} PROPERTY TYPE BOOL)
if (${value})
add_definitions("-D${name}")
endif (${value})
endmacro(add_boolean_option)
macro(add_integer_option name val helpstr)
if(DEFINED ${name})
set(value ${${name}})
else(DEFINED ${name})
set(value ${val})
endif()
set(${name} ${value} CACHE STRING "${helpstr}")
add_definitions("-D${name}=${value}")
endmacro(add_integer_option)
macro(add_list1_option name val helpstr)
if(DEFINED ${name})
set(value ${${name}})
else(DEFINED ${name})
set(value ${val})
endif()
set(${name} ${value} CACHE STRING "${helpstr}")
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
if(NOT "${value}" STREQUAL "False")
add_definitions("-D${name}=${value}")
endif()
endmacro(add_list1_option)
macro(add_list2_option name val helpstr)
if(DEFINED ${name})
set(value ${${name}})
else(DEFINED ${name})
set(value ${val})
endif()
set(${name} ${value} CACHE STRING "${helpstr}")
set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
if(NOT "${value}" STREQUAL "False")
add_definitions("-D${value}=1")
endif()
endmacro(add_list2_option)
#################################################### ####################################################
# compilation flags # compilation flags
############################################# #############################################
if(NOT CMAKE_BUILD_TYPE)
# added CMAKER conditional compilation to not bother legacy building system add_list1_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release RelWithDebInfo MinSizeRel)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel)
# #
set(CMAKE_C_FLAGS set(CMAKE_C_FLAGS
...@@ -71,35 +119,12 @@ else() ...@@ -71,35 +119,12 @@ else()
endif() endif()
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
# Define options for compilation
################################################
function(add_boolean_option name val helpstr)
if(DEFINED ${name})
set(value ${${name}})
else(DEFINED ${name})
set(value ${val})
endif()
set(${name} ${value} CACHE STRING "${helpstr}")
set_property(CACHE ${name} PROPERTY TYPE BOOL)
if (${value})
add_definitions("-D${name}")
endif (${value})
endfunction(add_boolean_option)
function(add_integer_option name val helpstr)
if(DEFINED ${name})
set(value ${${name}})
else(DEFINED ${name})
set(value ${val})
endif()
set(${name} ${value} CACHE STRING "${helpstr}")
add_definitions("-D${name}=${value}")
endfunction(add_integer_option)
# Debug related options # Debug related options
######################################### #########################################
add_boolean_option(MSG_PRINT False "print debug messages") add_boolean_option(MSG_PRINT False "print debug messages")
add_boolean_option(DISABLE_XER_PRINT True "print XER Format") add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
add_boolean_option(XER_PRINT False "print XER Format") add_boolean_option(XER_PRINT False "print XER Format")
add_boolean_option(RRC_MSG_PRINT False "print RRC messages") add_boolean_option(RRC_MSG_PRINT False "print RRC messages")
add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages") add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages")
...@@ -148,13 +173,7 @@ set(asn1_generated_dir ${OPENAIR_BIN_DIR}) ...@@ -148,13 +173,7 @@ set(asn1_generated_dir ${OPENAIR_BIN_DIR})
# RRC # RRC
###### ######
if (DEFINED RRC_ASN1_VERSION) add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA")
set(RRC_ASN1_VERSION ${RRC_ASN1_VERSION} CACHE STRING "ASN.1 version of RRC interface")
else(DEFINED RRC_ASN1_VERSION)
set(RRC_ASN1_VERSION "Rel10" CACHE STRING "ASN.1 version of RRC interface")
endif()
set_property(CACHE RRC_ASN1_VERSION PROPERTY STRINGS "Rel8" "Rel10" "CBA")
if (${RRC_ASN1_VERSION} STREQUAL "Rel8") if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
...@@ -167,7 +186,6 @@ if(NOT EXISTS ${asn1c_call}) ...@@ -167,7 +186,6 @@ if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" ) message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call}) endif(NOT EXISTS ${asn1c_call})
execute_process(COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}) execute_process(COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR})
add_definitions("-D${RRC_ASN1_VERSION}")
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c) file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
set(rrc_source ${rrc_source} ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c) set(rrc_source ${rrc_source} ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c)
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h) file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
...@@ -187,108 +205,74 @@ add_custom_command ( ...@@ -187,108 +205,74 @@ add_custom_command (
# Same limitation as described in RRC: unknown generated file list # Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time # so we generate it at cmake time
############## ##############
if (DEFINED USE_MME) add_list1_option(USE_MME "False" "MME version" False R8 R10)
set(USE_MME ${USE_MME} CACHE HELPSTRING "MME version") add_list1_option(S1AP_VERSION R10 "S1AP Asn.1 grammar version" R8 R9 R10)
else (DEFINED USE_MME)
set(USE_MME "R10" CACHE HELPSTRING "MME version") set(S1AP_DIR ${OPENAIRCN_DIR}/S1AP)
endif (DEFINED USE_MME) if (${S1AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R10.5)
set_property(CACHE USE_MME PROPERTY STRINGS False R8 R10) add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10")
elseif (${S1AP_VERSION} STREQUAL "R9")
if (NOT ${USE_MME} STREQUAL "False") set (ASN1RELDIR R9.8)
add_definitions("-DUSE_MME=${USE_MME}") add_definitions("-DUPDATE_RELEASE_9")
set(S1AP_DIR ${OPENAIRCN_DIR}/S1AP) else(${S1AP_VERSION} STREQUAL "R8")
if (${USE_MME} STREQUAL "R10") set (ASN1RELDIR R8.10)
set (ASN1RELDIR R10.5) endif(${S1AP_VERSION} STREQUAL "R10")
add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10") set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
elseif (${USE_MME} STREQUAL "R9") set(S1AP_ASN_FILES
set (ASN1RELDIR R9.8) ${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
add_definitions("-DUPDATE_RELEASE_9") ${S1AP_ASN_DIR}/S1AP-Constants.asn
else(${USE_MME} STREQUAL "R8") ${S1AP_ASN_DIR}/S1AP-IEs.asn
set (ASN1RELDIR R8.10) ${S1AP_ASN_DIR}/S1AP-PDU.asn
endif(${USE_MME} STREQUAL "R10") )
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
${S1AP_ASN_DIR}/S1AP-Constants.asn
${S1AP_ASN_DIR}/S1AP-IEs.asn
${S1AP_ASN_DIR}/S1AP-PDU.asn
)
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}) execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES})
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
set(S1AP_OAI_SRC set(S1AP_OAI_SRC
${S1AP_DIR}/s1ap_common.c ${S1AP_DIR}/s1ap_common.c
${S1AP_DIR}/s1ap_eNB.c ${S1AP_DIR}/s1ap_eNB.c
${S1AP_DIR}/s1ap_eNB_context_management_procedures.c ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
${S1AP_DIR}/s1ap_eNB_decoder.c ${S1AP_DIR}/s1ap_eNB_decoder.c
${S1AP_DIR}/s1ap_eNB_encoder.c ${S1AP_DIR}/s1ap_eNB_encoder.c
${S1AP_DIR}/s1ap_eNB_handlers.c ${S1AP_DIR}/s1ap_eNB_handlers.c
${S1AP_DIR}/s1ap_eNB_itti_messaging.c ${S1AP_DIR}/s1ap_eNB_itti_messaging.c
${S1AP_DIR}/s1ap_eNB_management_procedures.c ${S1AP_DIR}/s1ap_eNB_management_procedures.c
${S1AP_DIR}/s1ap_eNB_nas_procedures.c ${S1AP_DIR}/s1ap_eNB_nas_procedures.c
${S1AP_DIR}/s1ap_eNB_nnsf.c ${S1AP_DIR}/s1ap_eNB_nnsf.c
${S1AP_DIR}/s1ap_eNB_overload.c ${S1AP_DIR}/s1ap_eNB_overload.c
${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_trace.c
${S1AP_DIR}/s1ap_eNB_ue_context.c ${S1AP_DIR}/s1ap_eNB_ue_context.c
) )
set(S1AP_OAI_generated set(S1AP_OAI_generated
${S1AP_C_DIR}/s1ap_decoder.c ${S1AP_C_DIR}/s1ap_decoder.c
${S1AP_C_DIR}/s1ap_encoder.c ${S1AP_C_DIR}/s1ap_encoder.c
${S1AP_C_DIR}/s1ap_xer_print.c ${S1AP_C_DIR}/s1ap_xer_print.c
${S1AP_C_DIR}/s1ap_ies_defs.h ${S1AP_C_DIR}/s1ap_ies_defs.h
) )
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h) file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
set(s1ap_h ${s1ap_h} ${S1AP_C_DIR}/s1ap_ies_defs.h) set(s1ap_h ${s1ap_h} ${S1AP_C_DIR}/s1ap_ies_defs.h)
add_custom_command ( add_custom_command (
OUTPUT ${S1AP_OAI_generated} OUTPUT ${S1AP_OAI_generated}
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES} COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR} COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
DEPENDS ${S1AP_ASN_FILES} DEPENDS ${S1AP_ASN_FILES}
) )
add_library(s1ap_asn1 ${S1AP_OAI_SRC} ${S1AP_OAI_generated} ${S1AP_source}) add_library(s1ap_asn1 ${S1AP_OAI_SRC} ${S1AP_OAI_generated} ${S1AP_source})
set(S1AP_LIB s1ap_asn1) set(S1AP_LIB s1ap_asn1)
include_directories ("${S1AP_C_DIR}") include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}") include_directories ("${S1AP_DIR}")
endif(NOT ${USE_MME} STREQUAL "False")
# Hardware dependant options # Hardware dependant options
################################### ###################################
if(DEFINED NB_ANTENNAS_RX) add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
set(NB_ANTENNAS_RX ${NB_ANTENNAS_RX} CACHE HELPSTRING "Number of antennas in reception") add_list1_option(NB_ANTENNAS_TX "2" "Number of antennas in transmission" "1" "2" "4")
else(DEFINED NB_ANTENNAS_RX) add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")
set(NB_ANTENNAS_RX 2 CACHE HELPSTRING "Number of antennas in reception")
endif(DEFINED NB_ANTENNAS_RX) add_list2_option(RF_BOARD "EXMIMO" "RF head type" "False" "EXMIMO" "USRP" "ETHERNET")
set_property(CACHE NB_ANTENNAS_RX PROPERTY STRINGS 1 2 4)
add_definitions("-DNB_ANTENNAS_RX=${NB_ANTENNAS_RX}") if (${RF_BOARD} STREQUAL "EXMIMO")
if(DEFINED NB_ANTENNAS_TX)
set(NB_ANTENNAS_TX ${NB_ANTENNAS_TX} CACHE HELPSTRING "Number of antennas in transmission")
else(DEFINED NB_ANTENNAS_TX)
set(NB_ANTENNAS_TX 2 CACHE HELPSTRING "Number of antennas in transmission")
endif(DEFINED NB_ANTENNAS_TX)
set_property(CACHE NB_ANTENNAS_TX PROPERTY STRINGS 1 2 4)
add_definitions("-DNB_ANTENNAS_TX=${NB_ANTENNAS_TX}")
if(DEFINED NB_ANTENNAS_TXRX)
set(NB_ANTENNAS_TXRX ${NB_ANTENNAS_TXRX} CACHE HELPSTRING "Number of antennas in ????")
else(DEFINED NB_ANTENNAS_TXRX)
set(NB_ANTENNAS_TXRX 2 CACHE HELPSTRING "Number of antennas in ????")
endif(DEFINED NB_ANTENNAS_TXRX)
set_property(CACHE NB_ANTENNAS_TXRX PROPERTY STRINGS 1 2 4)
add_definitions("-DNB_ANTENNAS_TXRX=${NB_ANTENNAS_TXRX}")
if(DEFINED RF_BOARD)
set(RF_BOARD ${RF_BOARD} CACHE HELPSTRING "RF head type")
else(DEFINED RF_BOARD)
set(RF_BOARD EXMIMO CACHE HELPSTRING "RF head type")
endif(DEFINED RF_BOARD)
set_property(CACHE RF_BOARD PROPERTY STRINGS None EXMIMO USRP ETHERNET)
add_definitions("-D${RF_BOARD}=1")
if (${RF_BOARD} STREQUAL EXMIMO)
set(DRIVER2013) set(DRIVER2013)
include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/") include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/") include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/")
...@@ -296,15 +280,15 @@ if (${RF_BOARD} STREQUAL EXMIMO) ...@@ -296,15 +280,15 @@ if (${RF_BOARD} STREQUAL EXMIMO)
${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c) ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c)
elseif (${RF_BOARD} STREQUAL USRP) elseif (${RF_BOARD} STREQUAL "USRP")
include_directories("/opt/include/uhd") include_directories("/opt/include/uhd")
LINK_DIRECTORIES("/opt/lib") LINK_DIRECTORIES("/opt/lib")
set(option_USRP "uhd") set(option_USRP "uhd")
elseif (${RF_BOARD} STREQUAL ETHERNET) elseif (${RF_BOARD} STREQUAL "ETHERNET")
include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB") include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
endif (${RF_BOARD} STREQUAL EXMIMO) endif (${RF_BOARD} STREQUAL "EXMIMO")
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON") include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
...@@ -312,7 +296,7 @@ include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON") ...@@ -312,7 +296,7 @@ include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
# to be documented options # to be documented options
################### ###################
add_boolean_option(ADDR_CONF False "specific to oaisim") add_boolean_option(ADDR_CONF False "specific to oaisim")
add_boolean_option(ASSERT False "specific to oaisim: ???") add_boolean_option(ASSERT True "???")
add_boolean_option(DRIVER2013 True "????") add_boolean_option(DRIVER2013 True "????")
add_boolean_option(ENABLE_FXP True "????") add_boolean_option(ENABLE_FXP True "????")
add_boolean_option(ENABLE_NAS_UE_LOGGING True "????") add_boolean_option(ENABLE_NAS_UE_LOGGING True "????")
...@@ -324,6 +308,7 @@ add_boolean_option(ENABLE_SECURITY True "???") ...@@ -324,6 +308,7 @@ add_boolean_option(ENABLE_SECURITY True "???")
add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues") add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues")
add_boolean_option(ENABLE_USE_MME True "???") add_boolean_option(ENABLE_USE_MME True "???")
add_boolean_option(ENABLE_VCD_FIFO True "Seems legacy: always true now") add_boolean_option(ENABLE_VCD_FIFO True "Seems legacy: always true now")
add_boolean_option(ENB_MODE True "???")
add_boolean_option(HARD_RT False "???") add_boolean_option(HARD_RT False "???")
add_boolean_option(JUMBO_FRAME True "???") add_boolean_option(JUMBO_FRAME True "???")
add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120") add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120")
...@@ -339,11 +324,12 @@ add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS True "????") ...@@ -339,11 +324,12 @@ add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS True "????")
add_boolean_option(MU_RECEIVER False "????") add_boolean_option(MU_RECEIVER False "????")
add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver") add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
add_boolean_option(NAS_MME False "NAS_UE and NAS_MME are incompatible options") add_boolean_option(NAS_MME False "NAS_UE and NAS_MME are incompatible options")
add_boolean_option(NAS_NETLINK True "???? Must be true to compile nasmesh driver without rtai") add_boolean_option(NAS_NETLINK False "???? Must be true to compile nasmesh driver without rtai")
add_boolean_option(NAS_UE True "NAS_UE and NAS_MME are incompatible options") add_boolean_option(NAS_UE True "NAS_UE and NAS_MME are incompatible options")
add_boolean_option(NEW_FFT True "????") add_boolean_option(NEW_FFT True "????")
add_boolean_option(NO_RRM True "????") add_boolean_option(NO_RRM True "????")
add_boolean_option(OAI_EMU False "specific to oaisim") 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_TYPE_ETHERNET False "????")
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK False "????") add_boolean_option(OAI_NW_DRIVER_USE_NETLINK False "????")
add_boolean_option(OPENAIR1 True "????") add_boolean_option(OPENAIR1 True "????")
...@@ -355,16 +341,16 @@ add_boolean_option(PC_DSP True "????") ...@@ -355,16 +341,16 @@ add_boolean_option(PC_DSP True "????")
add_boolean_option(PC_TARGET True "????") add_boolean_option(PC_TARGET True "????")
add_boolean_option(PERFECT_CE False "????") add_boolean_option(PERFECT_CE False "????")
add_boolean_option(PHY_ABSTRACTION False "specific to oaisim") add_boolean_option(PHY_ABSTRACTION False "specific to oaisim")
add_boolean_option(PHY_CONTEXT False "not clear: must remain False for dlsim") add_boolean_option(PHY_CONTEXT True "not clear: must remain False for dlsim")
add_boolean_option(PHY_EMUL False "not clear: must remain False for dlsim") add_boolean_option(PHY_EMUL False "not clear: must remain False for dlsim")
add_boolean_option(PHYSIM True "??? set in lte-softmodem, for L1 simulators (dlsim, ulsim, ...)?") add_boolean_option(PHYSIM True "??? set in lte-softmodem, for L1 simulators dlsim, ulsim, ...?")
add_boolean_option(PUCCH True "????") add_boolean_option(PUCCH True "????")
add_boolean_option(RANDOM_BF False "????") add_boolean_option(RANDOM_BF False "????")
add_boolean_option(RLC_STOP_ON_LOST_PDU False "Fatal assert in this case") add_boolean_option(RLC_STOP_ON_LOST_PDU False "Fatal assert in this case")
add_boolean_option(SECU False "???") add_boolean_option(SECU False "???")
add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator") add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator")
add_boolean_option(SPECTRA False "???") add_boolean_option(SPECTRA False "???")
add_boolean_option(UE_BUILD False "????") add_boolean_option(UE_BUILD True "????")
add_boolean_option(USE_3GPP_ADDR_AS_LINK_ADDR False "As per attribute name") add_boolean_option(USE_3GPP_ADDR_AS_LINK_ADDR False "As per attribute name")
add_boolean_option(USER_MODE True "????") add_boolean_option(USER_MODE True "????")
add_integer_option(PACKAGE_NAME "NotDefined" "As per attribute name") add_integer_option(PACKAGE_NAME "NotDefined" "As per attribute name")
...@@ -700,12 +686,6 @@ set (ENB_APP_SRC ...@@ -700,12 +686,6 @@ set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_config.c ${OPENAIR2_DIR}/ENB_APP/enb_config.c
) )
if (NOT ${USE_MME} STREQUAL "False")
set(L2_SRC ${L2_SRC}
${RRC_DIR}/rrc_eNB_GTPV1U.c)
endif(NOT ${USE_MME} STREQUAL "False")
add_library(L2 add_library(L2
${L2_SRC} ${L2_SRC}
${MAC_SRC} ${MAC_SRC}
...@@ -765,6 +745,7 @@ endif() ...@@ -765,6 +745,7 @@ endif()
########################## ##########################
set(GTPV1U_SRC ${OPENAIRCN_DIR}/GTPV1-U) set(GTPV1U_SRC ${OPENAIRCN_DIR}/GTPV1-U)
set (libgtpv1u_SRC set (libgtpv1u_SRC
${RRC_DIR}/rrc_eNB_GTPV1U.c
${GTPV1U_SRC}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c ${GTPV1U_SRC}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
${GTPV1U_SRC}/nw-gtpv1u/src/NwGtpv1uTrxn.c ${GTPV1U_SRC}/nw-gtpv1u/src/NwGtpv1uTrxn.c
${GTPV1U_SRC}/nw-gtpv1u/src/NwGtpv1uMsg.c ${GTPV1U_SRC}/nw-gtpv1u/src/NwGtpv1uMsg.c
...@@ -1206,6 +1187,8 @@ ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ...@@ -1206,6 +1187,8 @@ ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR2_DIR}/UTIL/OMG/sumo.c ${OPENAIR2_DIR}/UTIL/OMG/sumo.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c
${HW_SOURCE}
${XFORMS_SOURCE}
) )
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim target_link_libraries (oaisim
......
################################################################################
# OpenAirInterface
# Copyright(c) 1999 - 2014 Eurecom
#
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
#
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@eurecom.fr
#
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
#
################################################################################
# file build_cmake.bash
# brief
# author Laurent Thomas
#
#######################################
mkdir -p $OPENAIR_DIR/cmake_targets/tests/bin
mkdir -p $OPENAIR_DIR/cmake_targets/tests/log
SUDO=sudo
compilations() {
cd $OPENAIR_DIR/cmake_targets/$1
{
[ "$CLEAN" = "1" ] && rm -rf build
mkdir -p build
cd build
rm -f $3
cmake ..
make -j4 $2
} > $5 2>&1
if [ -s $3 ] ; then
cp $3 $4
echo_success "$6"
else
echo_error "$7"
fi
}
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
if [ ! -d /usr/local/etc/freeDiameter ]; then
echo "Creating non existing directory: /usr/local/etc/freeDiameter/"
$SUDO mkdir /usr/local/etc/freeDiameter/
fi
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
}
install_nettle_from_source() {
cd /tmp
echo "Downloading nettle archive"
wget ftp://ftp.lysator.liu.se/pub/security/lsh/nettle-2.5.tar.gz
tar -xzf nettle-2.5.tar.gz
cd nettle-2.5/
./configure --disable-openssl --enable-shared --prefix=/usr
echo "Compiling nettle"
make -j4
make check
$SUDO make install
rm -rf /tmp/nettle-2.5.tar.gz /tmp/nettle-2.5
}
install_gnutls_from_source(){
cd /tmp
echo "Downloading gnutls archive"
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.23.tar.xz
tar -xzf gnutls-3.1.23.tar.xz
cd gnutls-3.1.23/
./configure --prefix=/usr
echo "Compiling gnutls"
make -j4
$SUDO make install
rm -rf /tmp/gnutls-3.1.23.tar.xz /tmp/gnutls-3.1.23
}
install_freediameter_from_source() {
cd /tmp
echo "Downloading freeDiameter archive"
wget http://www.freediameter.net/hg/freeDiameter/archive/1.1.5.tar.gz
tar xf 1.1.5.tar.gz
cd freeDiameter-1.1.5
patch -p1 < $OPENAIRCN_DIR/S6A/freediameter/freediameter-1.1.5.patch
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
echo "Compiling freeDiameter"
make -j4
make test
$SUDO make install
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'
$SUDO apt-get update
fi
$SUDO apt-get -y install python libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y install -t `lsb_release -cs` uhd
}
check_install_oai_software() {
$SUDO apt-get update
$SUDO apt-get install -y
autoconf \
automake \
bison \
build-essential \
check \
cmake \
cmake-curses-gui \
dialog \
dkms \
doxygen \
ethtool \
flex \
g++ \
gawk \
gcc \
gccxml \
gdb \
graphviz \
gtkwave \
guile-2.0-dev \
iperf \
iproute \
iptables \
iptables-dev \
libatlas-base-dev \
libatlas-dev \
libblas \
libblas3gf \
libblas-dev \
libboost-all-dev \
libconfig8-dev \
libforms-bin \
libforms-dev \
libgcrypt11-dev \
libgmp-dev \
libgtk-3-dev \
libidn11-dev \
libidn2-0-dev \
libmysqlclient-dev \
libpgm-5.1 \
libpgm-dev \
libpthread-stubs0-dev \
libsctp1 \
libsctp-dev \
libssl-dev \
libtasn1-3-dev \
libtool \
libusb-1.0-0-dev \
libxml2 \
libxml2-dev \
linux-headers-`uname -r` \
make \
mysql-client \
mysql-server \
openssh-client \
openssh-server \
openssl \
openvpn \
phpmyadmin \
pkg-config \
python \
python-dev \
python-pexpect \
sshfs \
subversion \
swig \
tshark \
uml-utilities \
unzip \
valgrind \
vlan
if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source
install_gnutls_from_source
else
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
fi
install_freediameter_from_source
check_install_asn1c
}
check_install_asn1c(){
$SUDO $OPENAIR_TARGETS/SCRIPTS/install_asn1c_0.9.24.modified.bash
}
#################################################
# 2. compile
################################################
compile_hss() {
cd $OPENAIRCN_DIR/OPENAIRHSS
if [ "$1" -eq 1 ]; then
echo_info "build a clean HSS"
rm -rfv obj* m4 .autom4* configure
fi
echo_success "Invoking autogen"
./autogen.sh || return 1
mkdir -p objs ; cd objs
echo_success "Invoking configure"
./configure || return 1
if [ -f Makefile ]; then
echo_success "Compiling..."
make -j4
if [ $? -ne 0 ]; then
echo_error "Build failed, exiting"
return 1
else
return 0
fi
else
echo_error "Configure failed, aborting"
fi
return 1
}
compile_epc() {
cd $OPENAIRCN_DIR
if [ $1 = 1 ]; then
echo_info "build a clean EPC"
bash_exec "rm -rf objs"
fi
OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*`
if [ ! -n "$OBJ_DIR" ]; then
OBJ_DIR="objs"
bash_exec "mkdir -m 777 ./$OBJ_DIR"
echo_success "Created $OBJ_DIR directory"
else
OBJ_DIR=`basename $OBJ_DIR`
fi
if [ ! -f $OBJ_DIR/Makefile ]; then
if [ ! -n "m4" ]; then
mkdir -m 777 m4
fi
bash_exec "autoreconf -i -f"
echo_success "Invoking autogen"
bash_exec "libtoolize"
bash_exec "./autogen.sh"
cd ./$OBJ_DIR
echo_success "Invoking configure"
if [ $DEBUG -ne 0 ]; then
../configure --enable-debug --enable-standalone-epc --enable-gtp1u-in-kernel LDFLAGS=-L/usr/local/lib
else
../configure --enable-standalone-epc --enable-gtp1u-in-kernel LDFLAGS=-L/usr/local/lib
fi
else
cd ./$OBJ_DIR
fi
# 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"
return 1
else
cp -pf ./OAI_EPC/oai_epc $OPENAIR_TARGETS/bin
fi
else
echo_error "Configure failed, exiting"
return 1
fi
cd $OPENAIRCN_DIR/GTPV1-U/GTPUAH;
make
if [ $? -ne 0 ]; then
echo_error "Build GTPUAH module failed, exiting"
return 1
else
$SUDO cp -pfv ./Bin/libxt_*.so /lib/xtables
$SUDO cp -pfv ./Bin/*.ko $OPENAIR_TARGETS/bin
fi
cd $OPENAIRCN_DIR/GTPV1-U/GTPURH;
make
if [ $? -ne 0 ]; then
echo_error "Build GTPURH module failed, exiting"
return 1
else
$SUDO cp -pfv ./Bin/libxt_*.so /lib/xtables
$SUDO cp -pfv ./Bin/*.ko $OPENAIR_TARGETS/bin
fi
return 0
}
compile_nas_tools() {
export NVRAM_DIR=$OPENAIR_TARGETS/bin
cd $NVRAM_DIR
if [ ! -f /tmp/nas_cleaned ]; then
echo_success "make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS/tools veryveryclean"
make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS/tools veryveryclean
fi
echo_success "make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS/tools all"
make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS/tools all
rm .ue.nvram
rm .usim.nvram
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
install_ltesoftmodem() {
# RT
if [ $1 = "RTAI" ]; then
if [ ! -f /tmp/init_rt_done.tmp ]; then
echo_info " 8.1 Insert RTAI modules"
$SUDO insmod /usr/realtime/modules/rtai_hal.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_sched.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_sem.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_fifos.ko > /dev/null 2>&1
$SUDO insmod /usr/realtime/modules/rtai_mbx.ko > /dev/null 2>&1
$SUDO touch /tmp/init_rt_done.tmp
$SUDO chmod 666 /tmp/init_rt_done.tmp
else
echo_warning " 8.1 RTAI modules already inserted"
fi
fi
#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
$SUDO 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
# 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
}
# arg1 is ENB_S1 'boolean'
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
else
compile_ue_ip_nw_driver
install_nas_tools
fi
}
install_nas_tools() {
cd $OPENAIR_TARGETS/bin
if [ ! -f .ue.nvram ]; then
echo_success "generate .ue_emm.nvram .ue.nvram"
$OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/ue_data --gen
fi
if [ ! -f .usim.nvram ]; then
echo_success "generate .usim.nvram"
$OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/usim_data --gen
fi
$OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/ue_data --print
$OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/usim_data --print
}
install_nasmesh(){
echo_success "LOAD NASMESH IP DRIVER FOR UE AND eNB"
(cd $OPENAIR2_DIR/NAS/DRIVER/MESH/RB_TOOL && make clean && make)
(cd $OPENAIR2_DIR && make clean && make nasmesh_netlink_address_fix.ko)
$SUDO rmmod nasmesh
$SUDO insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
}
##################################
# create HSS DB
################################
# arg 1 is mysql user (root)
# arg 2 is mysql password (linux)
# arg 3 is hss username (hssadmin)
# arg 4 is hss password (admin)
# arg 5 is database name (oai_db)
create_hss_database(){
EXPECTED_ARGS=5
E_BADARGS=65
MYSQL=`which mysql`
rv=0
if [ $# -ne $EXPECTED_ARGS ]
then
echo_fatal "Usage: $0 dbuser dbpass hssuser hsspass databasename"
rv=1
fi
set_openair_env
# removed %
#Q1="GRANT ALL PRIVILEGES ON *.* TO '$3'@'%' IDENTIFIED BY '$4' WITH GRANT OPTION;"
Q1="GRANT ALL PRIVILEGES ON *.* TO '$3'@'localhost' IDENTIFIED BY '$4' WITH GRANT OPTION;"
Q2="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}"
$MYSQL -u $1 --password=$2 -e "$SQL"
if [ $? -ne 0 ]; then
echo_error "$3 permissions failed"
return 1
else
echo_success "$3 permissions succeeded"
fi
Q1="CREATE DATABASE IF NOT EXISTS ${BTICK}$5${BTICK};"
SQL="${Q1}"
$MYSQL -u $3 --password=$4 -e "$SQL"
if [ $? -ne 0 ]; then
echo_error "$5 creation failed"
return 1
else
echo_success "$5 creation succeeded"
fi
# test if tables have been created
mysql -u $3 --password=$4 -e "desc $5.users" > /dev/null 2>&1
if [ $? -eq 1 ]; then
$MYSQL -u $3 --password=$4 $5 < $OPENAIRCN_DIR/OPENAIRHSS/db/oai_db.sql
if [ $? -ne 0 ]; then
echo_error "$5 tables creation failed"
return 1
else
echo_success "$5 tables creation succeeded"
fi
fi
return 0
}
################################
# set_openair_env
###############################
set_openair_env(){
fullpath=`readlink -f $BASH_SOURCE`
[ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath`
openair_path=${fullpath%/cmake_targets/*}
openair_path=${openair_path%/targets/*}
openair_path=${openair_path%/openair-cn/*}
openair_path=${openair_path%/openair[123]/*}
export OPENAIR_DIR=$openair_path
export OPENAIR_HOME=$openair_path
export OPENAIR1_DIR=$openair_path/openair1
export OPENAIR2_DIR=$openair_path/openair2
export OPENAIR3_DIR=$openair_path/openair3
export OPENAIRCN_DIR=$openair_path/openair-cn
export OPENAIR_TARGETS=$openair_path/targets
}
########################################
### 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
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
cecho() # Color-echo
# arg1 = message
# arg2 = color
{
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
if [ "$BUILD_FROM_MAKEFILE" = "" ]; then
echo -e -n "$color$message$reset_color"
echo
else
echo "$message"
fi
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
}
bash_exec() {
output=$($1 2>&1)
result=$?
if [ $result -eq 0 ]; then
echo_success "$1"
else
echo_error "$1: $output"
fi
}
...@@ -52,7 +52,7 @@ until [ -z "$1" ] ...@@ -52,7 +52,7 @@ until [ -z "$1" ]
do do
case "$1" in case "$1" in
-c | --clean) -c | --clean)
CLEAN=1 export CLEAN=1
echo "Will re-compile ALL" echo "Will re-compile ALL"
shift; shift;
;; ;;
...@@ -178,11 +178,6 @@ cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green ...@@ -178,11 +178,6 @@ cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green
dbin=$OPENAIR_HOME/cmake_targets/bin dbin=$OPENAIR_HOME/cmake_targets/bin
dlog=$OPENAIR_HOME/cmake_targets/log dlog=$OPENAIR_HOME/cmake_targets/log
if [ "$CLEAN" == "1" ] ; then
rm -rf $OPENAIR_DIR/cmake_targets/*/build $dbin $dlog
echo_info "deleted all compilation results"
fi
mkdir -p $dbin $dlog mkdir -p $dbin $dlog
if [ "$DISABLE_CHECK_INSTALLED_SOFTWARE" != "1" ] ; then if [ "$DISABLE_CHECK_INSTALLED_SOFTWARE" != "1" ] ; then
...@@ -210,32 +205,32 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then ...@@ -210,32 +205,32 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo 'set(PACKAGE_NAME "lte-softmodem")' >> $cmake_file echo 'set(PACKAGE_NAME "lte-softmodem")' >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
compilations \
if compilations lte_build_oai lte-softmodem lte-softmodem $dbin/lte-softmodem.$REL \ lte_build_oai lte-softmodem \
> $dlog/lte-softmodem.$REL.txt 2>&1 ; then lte-softmodem $dbin/lte-softmodem.$REL \
echo_success "lte-softmodem compiled" $dlog/lte-softmodem.$REL.txt \
else "lte-softmodem compiled" \
echo_error "lte-softmodem compilation failed" "lte-softmodem compilation failed"
fi
# nasmesh driver compilation # nasmesh driver compilation
if compilations lte_build_oai nasmesh CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesk.ko \ compilations \
> $dlog/nasmesh.txt 2>&1 ; then lte_build_oai nasmesh \
echo_success "nasmesh driver compiled" CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko \
else $dlog/nasmesh.txt \
echo_error "nasmesh driver compilation failed" "nasmesh driver compiled" \
fi "nasmesh driver compilation failed"
# lte unitary simulators compilation # lte unitary simulators compilation
simlist="dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim" simlist="dlsim ulsim pucchsim prachsim pdcchsim pbchsim mbmssim"
log=$dlog/lte-simulators.log log=$dlog/lte-simulators.log
cd $OPENAIR_DIR/cmake_targets/lte-simulators cd $OPENAIR_DIR/cmake_targets/lte-simulators
[ "$CLEAN" = "1" ] && rm -rf build
mkdir -p build mkdir -p build
cd build cd build
rm -f *sim rm -f *sim
cmake .. > $log 2>&1 cmake .. > $log 2>&1
make -j4 $simlist > $log 2>&1
for f in $simlist ; do for f in $simlist ; do
make -j4 $f > $log 2>&1
if [ -s $f ] ; then if [ -s $f ] ; then
echo_success "$f compiled" echo_success "$f compiled"
cp $f $OPENAIR_DIR/cmake_targets/tests/bin cp $f $OPENAIR_DIR/cmake_targets/tests/bin
...@@ -246,63 +241,66 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then ...@@ -246,63 +241,66 @@ if [ "$TARGET" = "ALL" -o "$TARGET" = "SOFTMODEM" ] ; then
# EXMIMO drivers & firmware loader # EXMIMO drivers & firmware loader
if [ "$HW" = "EXMIMO" ] ; then if [ "$HW" = "EXMIMO" ] ; then
if compilations lte_build_oai openair_rf CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko \ compilations \
> $dlog/openair_rf.txt 2>&1 ; then lte_build_oai openair_rf \
echo_success "EXMIMO driver compiled" CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko \
else $dlog/openair_rf.txt 2>&1 \
echo_error "EXMIMO driver compilation failed" "EXMIMO driver compiled" \
fi "EXMIMO driver compilation failed"
if compilations lte_build_oai updatefw updatefw $dbin/updatefw \ compilations \
> $dlog/updatefw.txt 2>&1 ; then lte_build_oai updatefw \
echo_success "EXMIMO firmware loader compiled" updatefw $dbin/updatefw \
else $dlog/updatefw.txt 2>&1 \
echo_error "EXMIMO firmware loader compilation failed" "EXMIMO firmware loader compiled" \
fi "EXMIMO firmware loader compilation failed"
fi fi
# TBD: oasim compilation # oasim compilation
cmake_file=$DIR/oaisim_build_oai/CMakeLists.txt cmake_file=$DIR/oaisim_build_oai/CMakeLists.txt
cp $DIR/oaisim_build_oai/CMakeLists.template $cmake_file cp $DIR/oaisim_build_oai/CMakeLists.template $cmake_file
echo "set(XFORMS $XFORMS )" >> $cmake_file echo "set(XFORMS $XFORMS )" >> $cmake_file
echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set(RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set(ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set(RF_BOARD \"${HW}\")" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
compilations \
if compilations oaisim_build_oai oaisim oaisim $dbin/oaisim.$REL \ oaisim_build_oai oaisim \
> $dlog/oaisim.$REL.txt 2>&1 ; then oaisim $dbin/oaisim.$REL \
echo_success "oaisim compiled" $dlog/oaisim.$REL.txt 2>&1 \
else "oaisim compiled" \
echo_error "oaisim compilation failed" "oaisim compilation failed"
fi
fi fi
exit 0
build_epc(){ # EPC compilation
##################
epc_compiled=1 # Auto-tests
#####################
if [ "$OAI_TEST" = "1" ]; then
echo_info "10. Running OAI pre commit tests (pre-ci) ..."
updated=$(svn st -q $OPENAIR_DIR)
if [ "$updated" != "" ] ; then
echo_warning "some files are not in svn: $updated"
fi
mkdir -p $dbin.test
compilations \
test.0101 oaisim \
oaisim $dbin.test/oaisim.r8 \
$dlog/oaisim.r8.test0101.txt \
"test 0101:oaisim passed" \
"test 0101:oaisim failed"
compilations test.0102 nasmesh \
CMakeFiles/nasmesh/nasmesh.ko $dbin/test/nasmesh.ko \
$dlog/nasmesh.test0102.txt \
"test 0102: nasmesh.ko passed" \
"test 0102: nasmesk.ko failed"
else
echo_info "10. Bypassing the Tests ..."
fi
exit 0
echo_info "Note: this scripts tested only on Ubuntu 14.04x64"
######################################
# CHECK MISC SOFTWARES AND LIBS #
######################################
if [ $DISABLE_CHECK_INSTALLED_SOFTWARE -eq 0 ]; then
echo_info "4. Checking the the required softwares/packages for EPC..."
check_install_epc_software
check_install_asn1c
if [ $OAI_CLEAN -eq 1 ]; then
check_install_freediamter
else
if [ ! -d /usr/local/etc/freeDiameter ]; then
check_install_freediamter
fi
fi
else
echo_info "4. Not checking the required softwares/packages for EPC"
fi
########################################### ###########################################
# configure and compile # configure and compile
......
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(XFORMS False ) set(XFORMS 1 )
set(RRC_ASN1_VERSION "Rel10") set(RRC_ASN1_VERSION "Rel8")
set(ENABLE_VCD_FIFO False ) set(ENABLE_VCD_FIFO False )
set(RF_BOARD "EXMIMO") set(RF_BOARD "EXMIMO")
set(PACKAGE_NAME "lte-softmodem") set(PACKAGE_NAME "lte-softmodem")
......
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(ADDR_CONF False) set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set(ASSERT True) set ( ADDR_CONF False )
set(DEBUG_OMG False) set ( ASSERT True )
set(DRIVER2013 True) set ( DEBUG_OMG False )
set(ENABLE_FXP True) set ( DISABLE_XER_PRINT False )
set(ENABLE_ITTI True) set ( DRIVER2013 True )
set(ENABLE_NAS_UE_LOGGING True) set ( EMOS False )
set(ENABLE_NEW_MULTICAST True) set ( ENABLE_FXP True )
set(ENABLE_PDCP_NETLINK_FIFO False) set ( ENABLE_ITTI True )
set(ENABLE_PGM_TRANSPORT True) set ( ENABLE_NAS_UE_LOGGING True )
set(ENABLE_RAL False) set ( ENABLE_NEW_MULTICAST True )
set(ENABLE_SECURITY True) set ( ENABLE_PDCP_NETLINK_FIFO False )
set(ENABLE_USE_CPU_EXECUTION_TIME True) set ( ENABLE_PGM_TRANSPORT True )
set(ENABLE_USE_MME True) set ( ENABLE_RAL False )
set(HARD_RT False) set ( ENABLE_SECURITY True )
set(JUMBO_FRAME False) set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set(LARGE_SCALE False) set ( ENABLE_USE_MME True )
set(LINK_PDCP_TO_GTPV1U True) set ( ENABLE_VCD_FIFO True )
set(LINUX_LIST False) set ( EXMIMO_IOT True )
set(LINUX True) set ( HARD_RT False )
set(LOCALIZATION False) set ( JUMBO_FRAME True )
set(LOG_NO_THREAD True) set ( LARGE_SCALE False )
set(LOWLATENCY True) set ( LINK_PDCP_TO_GTPV1U True )
set(MAC_CONTEXT 1) set ( LINUX_LIST False )
set(MAX_NUM_CCs 1) set ( LINUX True )
set(MIH_C_MEDIEVAL_EXTENSIONS True) set ( LOCALIZATION False )
set(MSG_PRINT False) set ( LOG_NO_THREAD False )
set(MU_RECEIVER False) set ( LOWLATENCY False )
set(NAS_ADDRESS_FIX true) set ( MAC_CONTEXT 1 )
set(NAS_NETLINK False) set ( MAX_NUM_CCs 1 )
set(NAS_UE False) set ( MIH_C_MEDIEVAL_EXTENSIONS True )
set(NEW_FFT True) set ( MSG_PRINT False )
set(NO_RRM True) set ( MU_RECEIVER False )
set(OAI_EMU True) set ( NAS_ADDRESS_FIX False )
set(OAISIM True) set ( NAS_MME False )
set(OAI_NW_DRIVER_TYPE_ETHERNET False) set ( NAS_NETLINK False )
set(OPENAIR1 True) set ( NAS_UE True )
set(OPENAIR2 True) set ( NB_ANTENNAS_RX "2" )
set(OPENAIR_EMU False) set ( NB_ANTENNAS_TX "2" )
set(OPENAIR_LTE True) set ( NB_ANTENNAS_TXRX "2" )
set(PACKAGE_NAME "oaisim") set ( NEW_FFT True )
set(PBS_SIM False) set ( NO_RRM True )
set(PC_DSP True) set ( OAI_EMU True )
set(PC_TARGET True) set ( OAISIM True )
set(PDCP_MSG_PRINT False) set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set(PERFECT_CE False) set ( OAI_NW_DRIVER_USE_NETLINK False )
set(PHY_ABSTRACTION False) set ( OPENAIR1 True )
set(PHY_ABSTRACTION False) set ( OPENAIR2 True )
set(PHY_EMUL False) set ( OPENAIR_EMU False )
set(PHYSIM True) set ( OPENAIR_LTE True )
set(PUCCH True) set ( PACKAGE_NAME "oaisim" )
set(RANDOM_BF False) set ( PBS_SIM False )
set(RF_BOARD "EXMIMO") set ( PC_DSP True )
set(RLC_STOP_ON_LOST_PDU False) set ( PC_TARGET True )
set(RRC_ASN1_VERSION False) set ( PDCP_MSG_PRINT False )
set(RRC_ASN1_VERSION "Rel10") set ( PERFECT_CE False )
set(RRC_MSG_PRINT False) set ( PHY_ABSTRACTION False )
set(RTAI False) set ( PHY_CONTEXT False )
set(SECU False) set ( PHY_EMUL False )
set(SMBV False) set ( PHYSIM True )
set(SPECTRA False) set ( PUCCH True )
set(TEST_OMG False) set ( RANDOM_BF False )
set(UE_BUILD False) set ( RF_BOARD "False" )
set(USE_3GPP_ADDR_AS_LINK_ADDR False) set ( RRC_ASN1_VERSION "Rel10" )
set(USE_MME False) set ( RLC_STOP_ON_LOST_PDU False )
set(USER_MODE True) set ( RRC_MSG_PRINT False )
set(XER_PRINT False) set ( RTAI False )
set ( SECU False )
set ( SMBV False )
set ( SPECTRA False )
set ( TEST_OMG False )
set ( UE_BUILD False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME "R10" )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(ADDR_CONF False) set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set(ASSERT True) set ( ADDR_CONF False )
set(DEBUG_OMG False) set ( ASSERT True )
set(DRIVER2013 True) set ( DEBUG_OMG False )
set(ENABLE_FXP True) set ( DISABLE_XER_PRINT False )
set(ENABLE_ITTI True) set ( DRIVER2013 True )
set(ENABLE_NAS_UE_LOGGING True) set ( EMOS False )
set(ENABLE_NEW_MULTICAST True) set ( ENABLE_FXP True )
set(ENABLE_PDCP_NETLINK_FIFO False) set ( ENABLE_ITTI True )
set(ENABLE_PGM_TRANSPORT True) set ( ENABLE_NAS_UE_LOGGING True )
set(ENABLE_RAL False) set ( ENABLE_NEW_MULTICAST True )
set(ENABLE_SECURITY True) set ( ENABLE_PDCP_NETLINK_FIFO False )
set(ENABLE_USE_CPU_EXECUTION_TIME True) set ( ENABLE_PGM_TRANSPORT True )
set(ENABLE_USE_MME True) set ( ENABLE_RAL False )
set(HARD_RT False) set ( ENABLE_SECURITY True )
set(JUMBO_FRAME False) set ( ENABLE_USE_CPU_EXECUTION_TIME True )
set(LARGE_SCALE False) set ( ENABLE_USE_MME True )
set(LINK_PDCP_TO_GTPV1U True) set ( ENABLE_VCD_FIFO True )
set(LINUX_LIST False) set ( EXMIMO_IOT True )
set(LINUX True) set ( HARD_RT False )
set(LOCALIZATION False) set ( JUMBO_FRAME True )
set(LOG_NO_THREAD True) set ( LARGE_SCALE False )
set(LOWLATENCY True) set ( LINK_PDCP_TO_GTPV1U True )
set(MAC_CONTEXT 1) set ( LINUX_LIST False )
set(MAX_NUM_CCs 1) set ( LINUX True )
set(MIH_C_MEDIEVAL_EXTENSIONS True) set ( LOCALIZATION False )
set(MSG_PRINT False) set ( LOG_NO_THREAD False )
set(MU_RECEIVER False) set ( LOWLATENCY False )
set(NAS_ADDRESS_FIX true) set ( MAC_CONTEXT 1 )
set(NAS_NETLINK False) set ( MAX_NUM_CCs 1 )
set(NAS_UE False) set ( MIH_C_MEDIEVAL_EXTENSIONS True )
set(NEW_FFT True) set ( MSG_PRINT False )
set(NO_RRM True) set ( MU_RECEIVER False )
set(OAI_EMU True) set ( NAS_ADDRESS_FIX False )
set(OAISIM True) set ( NAS_MME False )
set(OAI_NW_DRIVER_TYPE_ETHERNET False) set ( NAS_NETLINK False )
set(OPENAIR1 True) set ( NAS_UE True )
set(OPENAIR2 True) set ( NB_ANTENNAS_RX "2" )
set(OPENAIR_EMU False) set ( NB_ANTENNAS_TX "2" )
set(OPENAIR_LTE True) set ( NB_ANTENNAS_TXRX "2" )
set(PACKAGE_NAME "oaisim") set ( NEW_FFT True )
set(PBS_SIM False) set ( NO_RRM True )
set(PC_DSP True) set ( OAI_EMU True )
set(PC_TARGET True) set ( OAISIM True )
set(PDCP_MSG_PRINT False) set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set(PERFECT_CE False) set ( OAI_NW_DRIVER_USE_NETLINK False )
set(PHY_ABSTRACTION False) set ( OPENAIR1 True )
set(PHY_ABSTRACTION False) set ( OPENAIR2 True )
set(PHY_EMUL False) set ( OPENAIR_EMU False )
set(PHYSIM True) set ( OPENAIR_LTE True )
set(PUCCH True) set ( PACKAGE_NAME "oaisim" )
set(RANDOM_BF False) set ( PBS_SIM False )
set(RF_BOARD "EXMIMO") set ( PC_DSP True )
set(RLC_STOP_ON_LOST_PDU False) set ( PC_TARGET True )
set(RRC_ASN1_VERSION False) set ( PDCP_MSG_PRINT False )
set(RRC_ASN1_VERSION "Rel10") set ( PERFECT_CE False )
set(RRC_MSG_PRINT False) set ( PHY_ABSTRACTION False )
set(RTAI False) set ( PHY_CONTEXT False )
set(SECU False) set ( PHY_EMUL False )
set(SMBV False) set ( PHYSIM True )
set(SPECTRA False) set ( PUCCH True )
set(TEST_OMG False) set ( RANDOM_BF False )
set(UE_BUILD False) set ( RF_BOARD "False" )
set(USE_3GPP_ADDR_AS_LINK_ADDR False) set ( RRC_ASN1_VERSION "Rel10" )
set(USE_MME False) set ( RLC_STOP_ON_LOST_PDU False )
set(USER_MODE True) set ( RRC_MSG_PRINT False )
set(XER_PRINT False) set ( RTAI False )
set ( SECU False )
set ( SMBV False )
set ( SPECTRA False )
set ( TEST_OMG False )
set ( UE_BUILD False )
set ( USE_3GPP_ADDR_AS_LINK_ADDR False )
set ( USE_MME "R10" )
set ( USER_MODE True )
set ( XER_PRINT False )
set ( XFORMS False )
set(XFORMS False ) set(XFORMS False )
set(RRC_ASN1_VERSION "Rel10") set(RRC_ASN1_VERSION "Rel8")
set(ENABLE_VCD_FIFO False ) set(ENABLE_VCD_FIFO False )
set(RF_BOARD "EXMIMO")
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
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