diff --git a/common/utils/Makefile.inc b/common/utils/Makefile.inc index 09d585b567ae96e36021531973ed1a27e0216025..d617a9e82fb54608e6e472b6e30e51204967c3d0 100644 --- a/common/utils/Makefile.inc +++ b/common/utils/Makefile.inc @@ -18,4 +18,4 @@ UTILS_OBJS = $(ITTI_OBJS) $(HASHTABLE_OBJS) UTILS_incl = \ -I$(COMMON_UTILS_DIR) \ -I$(HASHTABLE_DIR) \ - -I$(ITTI_DIR) + -I$(ITTI_DIR) diff --git a/openair-cn/SCRIPTS/install_asn1c_0.9.24.modified.bash b/openair-cn/SCRIPTS/install_asn1c_0.9.24.modified.bash index adaa0d56547244698b70ac29095a8ac72b4efdee..3821d656c9e3cfca005788c51bcd699d6f9f150f 100755 --- a/openair-cn/SCRIPTS/install_asn1c_0.9.24.modified.bash +++ b/openair-cn/SCRIPTS/install_asn1c_0.9.24.modified.bash @@ -29,13 +29,10 @@ ################################################################################ # Tested on ubuntu 12.04 with updates 07 november 2013 - -sudo rm -Rf /usr/local/src/asn1c-r1516 -sudo svn co https://github.com/vlm/asn1c/trunk /usr/local/src/asn1c-r1516 -r 1516 +$1 rm -Rf /usr/local/src/asn1c-r1516 +$1 svn co https://github.com/vlm/asn1c/trunk /usr/local/src/asn1c-r1516 -r 1516 > /tmp/install_log.txt cd /usr/local/src/asn1c-r1516 -sudo patch -p0 < $OPENAIRCN_DIR/S1AP/MESSAGES/ASN1/asn1cpatch.p0 -sudo ./configure -sudo make -make install -cd - - +$1 patch -p0 < $OPENAIRCN_DIR/S1AP/MESSAGES/ASN1/asn1cpatch.p0 > /tmp/install_log.txt +$1 ./configure > /tmp/install_log.txt +$1 make > /tmp/install_log.txt +$1 make install > /tmp/install_log.txt \ No newline at end of file diff --git a/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc b/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc index ef396586a884ec3fd7cef4dc47ce13bccbd28609..b865ef7612620c221146de0052f0e9fc33997411 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc +++ b/openair1/SIMULATION/ETH_TRANSPORT/Makefile.inc @@ -1,6 +1,4 @@ -ifeq ($(cygwin),0) ETHERNET_TRANSPORT_OBJS = $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o -endif ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/multicast_link.o ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/socket.o ETHERNET_TRANSPORT_OBJS += $(TOP_DIR)/SIMULATION/ETH_TRANSPORT/bypass_session_layer.o diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index e6dfec90ef8afb4226436cc414eb651ecc502d9e..d2bbef2206d2beb0bf14ce51b8a61a860edc44d3 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -401,7 +401,7 @@ int main(int argc, char **argv) { PHY_vars_UE->lte_frame_parms.MBSFN_config[0].fourFrames_flag = 0; PHY_vars_UE->lte_frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xff; // activate all possible subframes - fill_eNB_dlsch_MCH(PHY_vars_eNB,mcs,1,0); + fill_eNB_dlsch_MCH(PHY_vars_eNB,mcs,1,0,0); fill_UE_dlsch_MCH(PHY_vars_UE,mcs,1,0,0); if (is_pmch_subframe(0,subframe,&PHY_vars_eNB->lte_frame_parms)==0) { printf("eNB is not configured for MBSFN in subframe %d\n",subframe); @@ -423,8 +423,9 @@ int main(int argc, char **argv) { snr_step = input_snr_step; for (SNR=snr0;SNR<snr1;SNR+=snr_step) { - PHY_vars_UE->frame=0; - PHY_vars_eNB->frame=0; + PHY_vars_UE->frame_tx=0; + PHY_vars_eNB->proc[subframe].frame_tx=0; + errs[0]=0; errs[1]=0; errs[2]=0; @@ -446,7 +447,7 @@ int main(int argc, char **argv) { eNB2UE->first_run = 1; memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][0][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); - generate_mch(PHY_vars_eNB,subframe,input_buffer); + generate_mch(PHY_vars_eNB,subframe,input_buffer,0); PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][0], // input, txdata[0], // output @@ -527,7 +528,7 @@ int main(int argc, char **argv) { PHY_vars_UE->dlsch_ue_MCH[0]->harq_processes[0]->rb_alloc, get_Qm(PHY_vars_UE->dlsch_ue_MCH[0]->harq_processes[0]->mcs), 1,2, - PHY_vars_UE->frame,subframe); + PHY_vars_UE->frame_tx,subframe); dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms,1,PHY_vars_UE->dlsch_ue_MCH[0], PHY_vars_UE->dlsch_ue_MCH[0]->harq_processes[0]->G, PHY_vars_UE->lte_ue_pdsch_vars_MCH[0]->llr[0],0,subframe<<1); @@ -543,8 +544,8 @@ int main(int argc, char **argv) { printf("MCH decoding returns %d\n",ret); if (ret == (1+PHY_vars_UE->dlsch_ue_MCH[0]->max_turbo_iterations)) errs[0]++; - PHY_vars_UE->frame++; - PHY_vars_eNB->frame++; + PHY_vars_UE->frame_tx++; + PHY_vars_eNB->proc[subframe].frame_tx++; } printf("errors %d/%d (Pe %e)\n",errs[round],trials,(double)errs[round]/trials); diff --git a/openair2/X2AP/MESSAGES/ASN1/R11.2/Makefile.inc b/openair2/X2AP/MESSAGES/ASN1/R11.2/Makefile.inc index 4a3811bf109d211a8303a13271801259bde406e6..8dd84743c854045d7ccb7ef8ed91665ef5617fdf 100755 --- a/openair2/X2AP/MESSAGES/ASN1/R11.2/Makefile.inc +++ b/openair2/X2AP/MESSAGES/ASN1/R11.2/Makefile.inc @@ -398,65 +398,65 @@ X2AP_ASN_MODULE_HEADERS= \ X2ap-CellActivationResponse.h \ X2ap-CellActivationFailure.h -ASN_MODULE_HEADERS+=ANY.h -ASN_MODULE_SOURCES+=ANY.c -ASN_MODULE_HEADERS+=BOOLEAN.h -ASN_MODULE_SOURCES+=BOOLEAN.c -ASN_MODULE_HEADERS+=INTEGER.h -ASN_MODULE_HEADERS+=NativeEnumerated.h -ASN_MODULE_SOURCES+=INTEGER.c -ASN_MODULE_HEADERS+=NULL.h -ASN_MODULE_SOURCES+=NULL.c -ASN_MODULE_SOURCES+=NativeEnumerated.c -ASN_MODULE_HEADERS+=NativeInteger.h -ASN_MODULE_SOURCES+=NativeInteger.c -ASN_MODULE_HEADERS+=OBJECT_IDENTIFIER.h -ASN_MODULE_SOURCES+=OBJECT_IDENTIFIER.c -ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h -ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c -ASN_MODULE_HEADERS+=asn_SET_OF.h -ASN_MODULE_SOURCES+=asn_SET_OF.c -ASN_MODULE_HEADERS+=constr_CHOICE.h -ASN_MODULE_SOURCES+=constr_CHOICE.c -ASN_MODULE_HEADERS+=constr_SEQUENCE.h -ASN_MODULE_SOURCES+=constr_SEQUENCE.c -ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h -ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c -ASN_MODULE_HEADERS+=constr_SET_OF.h -ASN_MODULE_SOURCES+=constr_SET_OF.c -ASN_MODULE_HEADERS+=asn_application.h -ASN_MODULE_HEADERS+=asn_system.h -ASN_MODULE_HEADERS+=asn_codecs.h -ASN_MODULE_HEADERS+=asn_internal.h -ASN_MODULE_HEADERS+=OCTET_STRING.h -ASN_MODULE_SOURCES+=OCTET_STRING.c -ASN_MODULE_HEADERS+=BIT_STRING.h -ASN_MODULE_SOURCES+=BIT_STRING.c -ASN_MODULE_SOURCES+=asn_codecs_prim.c -ASN_MODULE_HEADERS+=asn_codecs_prim.h -ASN_MODULE_HEADERS+=ber_tlv_length.h -ASN_MODULE_SOURCES+=ber_tlv_length.c -ASN_MODULE_HEADERS+=ber_tlv_tag.h -ASN_MODULE_SOURCES+=ber_tlv_tag.c -ASN_MODULE_HEADERS+=ber_decoder.h -ASN_MODULE_SOURCES+=ber_decoder.c -ASN_MODULE_HEADERS+=der_encoder.h -ASN_MODULE_SOURCES+=der_encoder.c -ASN_MODULE_HEADERS+=constr_TYPE.h -ASN_MODULE_SOURCES+=constr_TYPE.c -ASN_MODULE_HEADERS+=constraints.h -ASN_MODULE_SOURCES+=constraints.c -ASN_MODULE_HEADERS+=xer_support.h -ASN_MODULE_SOURCES+=xer_support.c -ASN_MODULE_HEADERS+=xer_decoder.h -ASN_MODULE_SOURCES+=xer_decoder.c -ASN_MODULE_HEADERS+=xer_encoder.h -ASN_MODULE_SOURCES+=xer_encoder.c -ASN_MODULE_HEADERS+=per_support.h -ASN_MODULE_SOURCES+=per_support.c -ASN_MODULE_HEADERS+=per_decoder.h -ASN_MODULE_SOURCES+=per_decoder.c -ASN_MODULE_HEADERS+=per_encoder.h -ASN_MODULE_SOURCES+=per_encoder.c -ASN_MODULE_HEADERS+=per_opentype.h -ASN_MODULE_SOURCES+=per_opentype.c +X2AP_ASN_MODULE_HEADERS+=ANY.h +X2AP_ASN_MODULE_SOURCES+=ANY.o +X2AP_ASN_MODULE_HEADERS+=BOOLEAN.h +X2AP_ASN_MODULE_SOURCES+=BOOLEAN.o +X2AP_ASN_MODULE_HEADERS+=INTEGER.h +X2AP_ASN_MODULE_HEADERS+=NativeEnumerated.h +X2AP_ASN_MODULE_SOURCES+=INTEGER.o +X2AP_ASN_MODULE_HEADERS+=NULL.h +X2AP_ASN_MODULE_SOURCES+=NULL.o +X2AP_ASN_MODULE_SOURCES+=NativeEnumerated.o +X2AP_ASN_MODULE_HEADERS+=NativeInteger.h +X2AP_ASN_MODULE_SOURCES+=NativeInteger.o +X2AP_ASN_MODULE_HEADERS+=OBJECT_IDENTIFIER.h +X2AP_ASN_MODULE_SOURCES+=OBJECT_IDENTIFIER.o +X2AP_ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h +X2AP_ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.o +X2AP_ASN_MODULE_HEADERS+=asn_SET_OF.h +X2AP_ASN_MODULE_SOURCES+=asn_SET_OF.o +X2AP_ASN_MODULE_HEADERS+=constr_CHOICE.h +X2AP_ASN_MODULE_SOURCES+=constr_CHOICE.o +X2AP_ASN_MODULE_HEADERS+=constr_SEQUENCE.h +X2AP_ASN_MODULE_SOURCES+=constr_SEQUENCE.o +X2AP_ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h +X2AP_ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.o +X2AP_ASN_MODULE_HEADERS+=constr_SET_OF.h +X2AP_ASN_MODULE_SOURCES+=constr_SET_OF.o +X2AP_ASN_MODULE_HEADERS+=asn_application.h +X2AP_ASN_MODULE_HEADERS+=asn_system.h +X2AP_ASN_MODULE_HEADERS+=asn_codecs.h +X2AP_ASN_MODULE_HEADERS+=asn_internal.h +X2AP_ASN_MODULE_HEADERS+=OCTET_STRING.h +X2AP_ASN_MODULE_SOURCES+=OCTET_STRING.o +X2AP_ASN_MODULE_HEADERS+=BIT_STRING.h +X2AP_ASN_MODULE_SOURCES+=BIT_STRING.o +X2AP_ASN_MODULE_SOURCES+=asn_codecs_prim.o +X2AP_ASN_MODULE_HEADERS+=asn_codecs_prim.h +X2AP_ASN_MODULE_HEADERS+=ber_tlv_length.h +X2AP_ASN_MODULE_SOURCES+=ber_tlv_length.o +X2AP_ASN_MODULE_HEADERS+=ber_tlv_tag.h +X2AP_ASN_MODULE_SOURCES+=ber_tlv_tag.o +X2AP_ASN_MODULE_HEADERS+=ber_decoder.h +X2AP_ASN_MODULE_SOURCES+=ber_decoder.o +X2AP_ASN_MODULE_HEADERS+=der_encoder.h +X2AP_ASN_MODULE_SOURCES+=der_encoder.o +X2AP_ASN_MODULE_HEADERS+=constr_TYPE.h +X2AP_ASN_MODULE_SOURCES+=constr_TYPE.o +X2AP_ASN_MODULE_HEADERS+=constraints.h +X2AP_ASN_MODULE_SOURCES+=constraints.o +X2AP_ASN_MODULE_HEADERS+=xer_support.h +X2AP_ASN_MODULE_SOURCES+=xer_support.o +X2AP_ASN_MODULE_HEADERS+=xer_decoder.h +X2AP_ASN_MODULE_SOURCES+=xer_decoder.o +X2AP_ASN_MODULE_HEADERS+=xer_encoder.h +X2AP_ASN_MODULE_SOURCES+=xer_encoder.o +X2AP_ASN_MODULE_HEADERS+=per_support.h +X2AP_ASN_MODULE_SOURCES+=per_support.o +X2AP_ASN_MODULE_HEADERS+=per_decoder.h +X2AP_ASN_MODULE_SOURCES+=per_decoder.o +X2AP_ASN_MODULE_HEADERS+=per_encoder.h +X2AP_ASN_MODULE_SOURCES+=per_encoder.o +X2AP_ASN_MODULE_HEADERS+=per_opentype.h +X2AP_ASN_MODULE_SOURCES+=per_opentype.o diff --git a/openair2/X2AP/Makefile.inc b/openair2/X2AP/Makefile.inc index 1b99d0550576c5a9ce00cd4c2a960488b18b76c3..7369cf8dfa1b92421099fade99949ca65d10bd4c 100755 --- a/openair2/X2AP/Makefile.inc +++ b/openair2/X2AP/Makefile.inc @@ -17,7 +17,7 @@ include $(ASN1DIR)/$(ASN1RELDIR)/Makefile.inc libx2ap_OBJECTS = \ x2ap.o \ x2ap_common.o \ - $(addprefix MESSAGES/ASN1/$(ASN1RELDIR)/, $(ASN_MODULE_SOURCES)) + $(addprefix MESSAGES/ASN1/$(ASN1RELDIR)/, $(X2AP_ASN_MODULE_SOURCES)) @@ -31,6 +31,7 @@ CFLAGS = \ -DUSER_MODE \ -I. \ -I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \ + -I$(ASN1MESSAGESDIR) \ -I$(OUTDIR) \ -I../UTILS \ $(ADD_CFLAGS) \ @@ -79,8 +80,8 @@ $(OUTDIR)/x2ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU-Contents.asn $(A $(OUTDIR)/x2ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/X2AP-CommonDataTypes.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/X2AP-PDU.asn @echo "Timestamp DIR " $(ASN1DIR) " DIRREL " $(ASN1RELDIR) # (cd $(ASN1DIR)/$(ASN1RELDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names $^) - (cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names $^) - @echo "Timestamp" $(X2AP_CFLAGS) + (cd $(ASN1MESSAGESDIR) && asn1c -fhave_native64 -gen-PER -fcompound-names -fskeletons-copy $^) + @echo "Timestamp X2AP_CFLAGS: " $(X2AP_CFLAGS) @echo Timestamp > $@ $(OUTDIR)/libx2ap.a: $(OUTDIR)/x2ap_ieregen.stamp $(OUTDIR)/x2ap_asn1regen.stamp $(X2AP_GENERATED) $(addprefix $(OUTDIR)/,$(libx2ap_OBJECTS)) @@ -91,8 +92,8 @@ $(OUTDIR)/libx2ap.a: $(OUTDIR)/x2ap_ieregen.stamp $(OUTDIR)/x2ap_asn1regen.stamp clean: @$(RM_F_V) $(OUTDIR)/*.o @$(RM_F_V) $(OUTDIR)/*.d - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(ASN_MODULE_SOURCES)) - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(ASN_MODULE_SOURCES:.o=.d)) + @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES)) + @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.d)) @$(RM_F_V) $(OUTDIR)/libx2ap.a @$(RM_F_V) $(OUTDIR)/x2ap_asn1regen.stamp @$(RM_F_V) $(OUTDIR)/x2ap_ieregen.stamp @@ -100,8 +101,8 @@ clean: @$(RM_F_V) $(OUTDIR)/x2ap_xer_print.c $(OUTDIR)/x2ap_ies_defs.h cleanall: clean - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(ASN_MODULE_SOURCES:.o=.c)) - @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(ASN_MODULE_SOURCES:.o=.h)) + @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.c)) + @$(RM_F_V) $(addprefix $(OUTDIR)/MESSAGES/ASN1/$(ASN1RELDIR), $(X2AP_ASN_MODULE_SOURCES:.o=.h)) showcflags: @echo x2ap cflags: $(CFLAGS) diff --git a/targets/COMMON/Makefile.inc b/targets/COMMON/Makefile.inc index 49f62c3580e6313c42c704e8bd181dac67beae82..9902574fce06a573576d5072e633b649c52e9ac8 100644 --- a/targets/COMMON/Makefile.inc +++ b/targets/COMMON/Makefile.inc @@ -3,4 +3,4 @@ TARGETS_COMMON_DIR = $(OPENAIR_TARGETS)/COMMON TARGETS_COMMON_OBJS = $(TARGETS_COMMON_DIR)/create_tasks.o TARGETS_COMMON_incl = \ - -I$(TARGETS_COMMON_DIR) + -I$(TARGETS_COMMON_DIR) diff --git a/targets/Makedirectives b/targets/Makedirectives new file mode 100644 index 0000000000000000000000000000000000000000..c118ddef6aff4475312cd6b086d0bf2726bcfa05 --- /dev/null +++ b/targets/Makedirectives @@ -0,0 +1,19 @@ +ifdef EPC +ENABLE_ITTI=1 +USE_MME=R10 +DISABLE_XER_PRINT=1 +LINK_PDCP_TO_GTPV1U=1 +SECU=1 +endif + +ifndef OPENAIR2 +OPENAIR2=1 +endif + +ifdef DEBUG +DISABLE_XER_PRINT=0 +MSG_PRINT=1 +endif + + + diff --git a/targets/Makefile b/targets/Makefile index 268fab5f22fdda8467e9c4551ff38dc769536d8e..7f17c6f5f2f11bf15b2452fe76540ef5d27b76bd 100644 --- a/targets/Makefile +++ b/targets/Makefile @@ -1,8 +1,10 @@ -#ifdef cygwin -# cyg=1 -#else -# cyg=0 -#endif + +build: + ./build_oai.bash 1 + +rebuild: + ./build_oai.bash 0 + help: @echo make check1 performs a simple sanity check diff --git a/targets/Makefile.common b/targets/Makefile.common index e094f703828ca9ef4118507df0670725e9ab54f2..84a42ef27bb63ef51f88394523c62f4a80618f1f 100644 --- a/targets/Makefile.common +++ b/targets/Makefile.common @@ -1,4 +1,6 @@ + # This file gathers compilation directive shared between lte-softmodem and oaisim + COMMON_UTILS_DIR = $(OPENAIR_HOME)/common/utils UE_NAS_DIR = $(OPENAIR_HOME)/openair-cn/NAS S1AP_DIR = $(OPENAIR_HOME)/openair-cn/S1AP @@ -41,6 +43,33 @@ include $(COMMON_UTILS_DIR)/Makefile.inc include $(OPENAIR_TARGETS)/COMMON/Makefile.inc include $(OPENAIR2_DIR)/NAS/Makefile.inc +ifeq ($(SECU), 1) +ifeq ($(NETTLE_FOUND), 0) +@echo "Nettle library >= 2.5 is not installed on your system, nettle-dev lib needed, continuing with security disabled" +SECU=0 +else +ifeq ($(OPENSSL_FOUND), 0) +@echo "openssl library is not installed on your system, openssl lib needed, continuing with security disabled" +SECU=0 +else +CFLAGS += -DENABLE_SECURITY +LIBS += $(OPENSSL_LIBS) $(NETTLE_LIBS) +endif +endif +endif + +ifdef JF +CFLAGS += -DJUMBO_FRAME +endif + +ifeq ($(ENABLE_RAL), 1) +CFLAGS += -DENABLE_RAL +endif + +ifeq ($(LIBCONFIG_LONG),1) +CFLAGS += -DLIBCONFIG_LONG +endif + COMMON_CFLAGS += -DMAX_NUM_CCs=1 ifdef USE_MME COMMON_CFLAGS += -DENABLE_USE_MME @@ -101,7 +130,7 @@ export SECU_CFLAGS COMMON_MME_CFLAGS = -I$(SECU_DIR) COMMON_MME_CFLAGS += -I$(SCTP_DIR) -COMMON_MME_CFLAGS += -I$(X2AP_DIR) -I$(X2AP_DIR)/MESSAGES +COMMON_MME_CFLAGS += -I$(X2AP_DIR) COMMON_MME_CFLAGS += -I$(S1AP_DIR) COMMON_MME_CFLAGS += -I$(UDP_DIR) COMMON_MME_CFLAGS += -I$(GTPV1U_DIR) @@ -112,7 +141,7 @@ S1AP_CFLAGS += -I$(TOP_DIR) S1AP_CFLAGS += $(UTIL_incl) export S1AP_CFLAGS -X2AP_CFLAGS = $(COMMON_CFLAGS) +X2AP_CFLAGS = $(COMMON_CFLAGS) $(COMMON_MME_CFLAGS) X2AP_CFLAGS += -DENB_MODE X2AP_CFLAGS += -I$(TOP_DIR) X2AP_CFLAGS += $(UTIL_incl) diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile index f27b2752da8d00fc56014dc6577b2c5b5aead36e..8da89118422941448b8eb9f223428a66e672e2ac 100644 --- a/targets/RT/USER/Makefile +++ b/targets/RT/USER/Makefile @@ -5,6 +5,7 @@ default: lte-softmodem all: lte-softmodem lte-enb include $(OPENAIR_TARGETS)/Makefile.common +include $(OPENAIR_TARGETS)/Makedirectives GCCVERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') ifeq "$(GCCVERSION)" "4.4.3" @@ -30,42 +31,23 @@ ifeq ($(USRP),0) CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO endif -ifdef DEBUG -CFLAGS += -g -ggdb +ifeq ($(DEBUG),1) +CFLAGS += -g -ggdb -DDEBUG_PHY -DDEBUG_MEAS +CFLAGS += -DRRC_MSG_PRINT +CFLAGS += -DPDCP_MSG_PRINT endif -SRC = synctest.c condtest.c #lte-softmodem.c -ifdef LIBCONFIG_LONG -CFLAGS += -DLIBCONFIG_LONG +ifdef ($(MSG_PRINT),1) +CFLAGS += -DRRC_MSG_PRINT +CFLAGS += -DPDCP_MSG_PRINT endif +SRC = synctest.c condtest.c #lte-softmodem.c + ifndef RTAI RTAI=1 endif -ifeq ($(ENABLE_RAL), 1) -CFLAGS += -DENABLE_RAL -endif - -ifdef SECU -ifeq ($(NETTLE_FOUND), 0) -@echo "Nettle library >= 2.5 is not installed on your system, nettle-dev lib needed, continuing with security disabled" -SECU=0 -else -ifeq ($(OPENSSL_FOUND), 0) -@echo "openssl library is not installed on your system, openssl lib needed, continuing with security disabled" -SECU=0 -else -CFLAGS += -DENABLE_SECURITY -LIBS += $(OPENSSL_LIBS) $(NETTLE_LIBS) -endif -endif -endif - -ifdef JF -CFLAGS += -DJUMBO_FRAME -endif - ifeq ($(RTAI),1) CFLAGS += -DENABLE_RTAI_CLOCK CFLAGS += -DCONFIG_RTAI_LXRT_INLINE #remend the RTAI warning @@ -124,9 +106,6 @@ include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc OBJ += $(LOG_OBJS) -ifndef OPENAIR2 -OPENAIR2=1 -endif ifeq ($(OPENAIR2),1) ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS)) OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS) $(OSA_OBJS) @@ -142,11 +121,6 @@ RTAI_OBJ += $(UTILS_OBJS) CFLAGS += -DEXMIMO_IOT #endif -ifdef MSG_PRINT -CFLAGS += -DRRC_MSG_PRINT -CFLAGS += -DPDCP_MSG_PRINT -endif - CFLAGS += $(L2_incl) $(ENB_APP_incl) $(UTIL_incl) $(UTILS_incl) CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES #-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile index a2a3845af87167d8eb326987d067d93f47c84710..37969af7033c3a162a21ee577a832201df62cc36 100644 --- a/targets/SIMU/USER/Makefile +++ b/targets/SIMU/USER/Makefile @@ -4,6 +4,7 @@ include $(OPENAIR_TARGETS)/Makerules default: oaisim include $(OPENAIR_TARGETS)/Makefile.common +include $(OPENAIR_TARGETS)/Makedirectives TOP_DIR = $(OPENAIR1_DIR) OPENAIR1_TOP = $(OPENAIR1_DIR) @@ -16,12 +17,18 @@ CPUFLAGS = -mmmx -msse -msse2 -msse4.1 -march=native CPUFLAGS += $(shell if grep --silent ssse3 /proc/cpuinfo ; then echo "-mssse3" ; else if grep --silent User\ Mode\ Linux /proc/cpuinfo ; then echo "-mssse3" ; else echo ""; fi; fi) CPUFLAGS += $(shell if grep --silent -w sse4 /proc/cpuinfo ; then echo "-msse4" ; else echo ""; fi) linux = $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi) +CFLAGS += -O2 -ifdef DEBUG +ifeq ($(DEBUG),1) CFLAGS += -g -ggdb -DDEBUG_PHY -DDEBUG_MEAS +CFLAGS += -DRRC_MSG_PRINT +CFLAGS += -DPDCP_MSG_PRINT #CFLAGS += -DTRACE_RLC_UM_PDU -else -CFLAGS += -O2 +endif + +ifeq ($(MSG_PRINT),1) +CFLAGS += -DRRC_MSG_PRINT +CFLAGS += -DPDCP_MSG_PRINT endif CFLAGS += -Wstrict-prototypes -Wpointer-sign @@ -40,9 +47,6 @@ CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_U CFLAGS += -DNEW_FFT #CFLAGS += -DLLR8 CFLAGS += -DPACKAGE_NAME='"oaisim"' -ifndef OPENAIR2 -OPENAIR2=1 -endif ifndef OPENAIR_EMU export OPENAIR_EMU=1 @@ -59,19 +63,15 @@ endif # activate OCG and libxml only under linux ifeq ($(linux),1) CFLAGS += $(LIBXML2_CFLAGS) -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib -OCG_FLAG = 1 -cygwin=0 +OCG_FLAG =1 CFLAGS += -DLINUX -else -cygwin=1 -OCG_FLAG = 0 endif ifdef SMBV CFLAGS += -DSMBV endif -ifdef XFORMS +ifeq ($(XFORMS), 1) CFLAGS += -DXFORMS endif @@ -101,9 +101,6 @@ else endif endif -ifdef JF -CFLAGS += -DJUMBO_FRAME -endif ifdef LS CFLAGS += -DLARGE_SCALE endif @@ -134,9 +131,6 @@ ifeq ($(STOP_ON_IP_TRAFFIC_OVERLOAD), 1) CFLAGS += -DSTOP_ON_IP_TRAFFIC_OVERLOAD endif -ifeq ($(ENABLE_RAL), 1) -CFLAGS += -DENABLE_RAL -endif ifeq ($(MIH_C_MEDIEVAL_EXTENSIONS), 1) CFLAGS += -DMIH_C_MEDIEVAL_EXTENSIONS @@ -235,7 +229,7 @@ OAISIM_OBJS_COMMON += $(OPENAIR_TARGETS)/SIMU/USER/event_handler.o OAISIM_OBJS = $(OPENAIR_TARGETS)/SIMU/USER/oaisim.o -ifdef XFORMS +ifeq ($(XFORMS), 1) TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o endif @@ -460,6 +454,7 @@ print: @echo "IS_REL10 is " $(IS_REL10) @echo "ENABLE_DB is " $(ENABLE_DB) @echo "Libs are" $(LIBS) + @echo "NAS" $(NAS) showcflags: @echo oaisim cflags: $(CFLAGS) diff --git a/targets/build_helper.bash b/targets/build_helper.bash new file mode 100755 index 0000000000000000000000000000000000000000..60e233150660f7d591fa81879326887b23aaab83 --- /dev/null +++ b/targets/build_helper.bash @@ -0,0 +1,769 @@ +################################################################################ +# 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_helper.bash +# brief +# author Lionel Gauthier and Navid Nikaein +# company Eurecom +# email: lionel.gauthier@eurecom.fr and navid.nikaein@eurecom.fr +# +####################################### +# Helper Func +###################################### + +ROOT_UID=0 +E_NOTROOT=67 +NUM_CPU=`cat /proc/cpuinfo | grep processor | wc -l` +OAI_INSTALLED=1 + +check_for_root_rights() { + if [[ $EUID -ne 0 ]]; then + echo_warning "Running as a sudoers" 1>&2 + return 1 + else + echo_success "Running as a root" 1>&2 + return 0 + fi +} + +output=$(check_for_root_rights 2>&1) +result=$? +SUDO='' +if [ $result -ne 1 ]; then + SUDO='sudo -E' +fi + +test_install_package() { + # usage: test_install_package package_name + + if [ $# -eq 1 ]; then + dpkg -s "$1" > /dev/null 2>&1 && { + echo "$1 is installed." + } || { + echo "$1 is not installed." + OAI_INSTALLED=0 + $SUDO apt-get install --assume-yes $1 + } + fi +} + +test_command_install_script() { + # usage: test_command_install_script searched_binary script_to_be_invoked_if_binary_not_found + command -v $1 >/dev/null 2>&1 || { echo_warning "Program $1 is not installed. Trying installing it." >&2; bash $2; command -v $1 >/dev/null 2>&1 || { echo_fatal "Program $1 is not installed. Aborting." >&2; };} + echo_success "$1 available" +} + + +check_for_machine_type(){ + MACHINE_TYPE=`uname -m` + if [ ${MACHINE_TYPE} = "x86_64" ]; then + return 64 # 64-bit stuff here + else + if [ ${MACHINE_TYPE} = "i686" ]; then + return 32 # 32-bit stuff here + else + return -1 + fi + fi +} + +#################################################### +## OAI related functions +##################################################### + +#################################################### +# 1. install the required packages +#################################################### + +make_certs(){ + + echo "creating the certificate" + + rm -rf demoCA + mkdir demoCA + echo 01 > demoCA/serial + touch demoCA/index.txt + + 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 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 ca -cert cacert.pem -keyfile cakey.pem -in user.csr.pem -out user.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 cakey.pem user.key.pem cacert.pem to /usr/local/etc/freeDiameter/" + $SUDO cp user.key.pem user.cert.pem cacert.pem /usr/local/etc/freeDiameter/ + +# 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 + +} + +check_install_freediamter(){ + + if [ -f install_log.txt ]; then + $SUDO rm -f tmp/install_log.txt + fi + + if [ ! -d /usr/local/src/ ]; then + echo "/usr/local/src/ doesn't exist please create one" + exit -1 + fi + + if [ ! -w /usr/local/src/ ]; then + echo "You don't have permissions to write to /usr/local/src/, inslalling as a sudoer" +# exit -1 + fi + + cd /usr/local/src/ + + echo "Downloading nettle archive" + + if [ -f nettle-2.5.tar.gz ]; then + $SUDO rm -f nettle-2.5.tar.gz + fi + if [ -f nettle-2.5.tar ]; then + $SUDO rm -f nettle-2.5.tar + fi + if [ -d nettle-2.5 ]; then + $SUDO rm -rf nettle-2.5/ + fi + + $SUDO wget ftp://ftp.lysator.liu.se/pub/security/lsh/nettle-2.5.tar.gz + $SUDO gunzip nettle-2.5.tar.gz + echo "Uncompressing nettle archive" + $SUDO tar -xf nettle-2.5.tar + cd nettle-2.5/ + $SUDO ./configure --disable-openssl --enable-shared --prefix=/usr + if [ $? -ne 0 ]; then + exit -1 + fi + echo "Compiling nettle" + $SUDO make -j $NUM_CPU + $SUDO make check + $SUDO make install + cd ../ + + echo "Downloading gnutls archive" + + if [ -f gnutls-3.1.0.tar.xz ]; then + $SUDO rm -f gnutls-3.1.0.tar.xz + fi + if [ -d gnutls-3.1.0/ ]; then + $SUDO rm -rf gnutls-3.1.0/ + fi + + $SUDO wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.0.tar.xz + $SUDO tar -xf gnutls-3.1.0.tar.xz + echo "Uncompressing gnutls archive" + cd gnutls-3.1.0/ + $SUDO ./configure --prefix=/usr + if [ $? -ne 0 ]; then + exit -1 + fi + echo "Compiling gnutls" + $SUDO make -j $NUM_CPU + $SUDO make install + cd ../ + + echo "Downloading freeDiameter archive" + + if [ -f 1.1.5.tar.gz ]; then + $SUDO rm -f 1.1.5.tar.gz + fi + if [ -d freeDiameter-1.1.5/ ]; then + $SUDO rm -rf freeDiameter-1.1.5/ + fi + + $SUDO wget http://www.freediameter.net/hg/freeDiameter/archive/1.1.5.tar.gz + $SUDO tar -xzf 1.1.5.tar.gz + echo "Uncompressing freeDiameter archive" + cd freeDiameter-1.1.5 + $SUDO patch -p1 < $OPENAIRCN_DIR/S6A/freediameter/freediameter-1.1.5.patch + $SUDO mkdir build + cd build + $SUDO cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ../ + if [ $? -ne 0 ]; then + exit -1 + fi + echo "Compiling freeDiameter" + $SUDO make -j $NUM_CPU +#make help + $SUDO make test + $SUDO sudo make install + + make_certs + +} + +check_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 [ $full_hostname = `hostname`.eur ]; then + echo_success "S6A: Found valid certificate in /usr/local/etc/freeDiameter" + return 1 + 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/S6A/freediameter + make_certs + check_s6a_certificate + return 1 +} + +check_install_oai_software() { + + if [ ! -f ./.lock_oaibuild ]; then + + test_install_package autoconf + test_install_package automake + test_install_package bison + test_install_package build-essential + test_install_package cmake + test_install_package cmake-curses-gui + test_install_package dkms + test_install_package flex + test_install_package gawk + test_install_package gcc + test_install_package gdb + test_install_package make + test_install_package openssh-client + test_install_package openssh-server + test_install_package swig + test_install_package unzip + test_install_package valgrind + test_install_package autoconf + test_install_package automake + test_install_package bison + test_install_package build-essential + test_install_package check + test_install_package cmake + test_install_package cmake-curses-gui + test_install_package ethtool + test_install_package flex + test_install_package g++ + test_install_package gawk + test_install_package gcc + test_install_package gccxml + test_install_package gdb + test_install_package guile-2.0-dev + test_install_package iperf + test_install_package iproute + test_install_package iptables + test_install_package libatlas-base-dev + test_install_package libatlas-dev + test_install_package libblas3gf + test_install_package libblas-dev +# if [ $MACHINE_ARCH = 64 ]; then + test_install_package libconfig8-dev +# else +# test_install_package libconfig-dev +# fi + test_install_package libforms-bin + test_install_package libforms-dev + test_install_package libgcrypt11-dev + test_install_package libgmp-dev + test_install_package libgtk-3-dev + test_install_package libidn11-dev + test_install_package libidn2-0-dev + test_install_package libpgm-dev + test_install_package libpgm-5.1-0 + test_install_package libpthread-stubs0-dev + test_install_package libsctp1 + test_install_package libsctp-dev + 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 make + test_install_package openssh-client + test_install_package openssh-server + test_install_package openssl + test_install_package libssl-dev + test_install_package nettle-dev + test_install_package nettle-bin + test_install_package openvpn + test_install_package pkg-config + test_install_package python-dev + test_install_package python-pexpect + test_install_package sshfs + test_install_package subversion + test_install_package swig + test_install_package tshark + test_install_package uml-utilities + test_install_package unzip + test_install_package valgrind + test_install_package vlan + test_install_package doxygen + fi + + echo "$OPENAIR_TARGETS/bin/install_log.txt" + if [ $OAI_INSTALLED = 1 ]; then + touch ./.lock_oaibuild + fi + + if [ ! -d /usr/local/etc/freeDiameter ]; then + # This script make certificates also +# echo "run the install script for free diameter " +# cd $OPENAIRCN_DIR/S6A/freediameter/ && ./install_freediameter.sh + check_install_freediamter + else + echo_success "freediameter is installed" + check_s6a_certificate + fi + + test_command_install_script "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $result" + + # One mor check about version of asn1c + ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE="ASN.1 Compiler, v0.9.24" + ASN1C_COMPILER_VERSION_MESSAGE=`asn1c -h 2>&1 | grep -i ASN\.1\ Compiler` + ##ASN1C_COMPILER_VERSION_MESSAGE=`trim $ASN1C_COMPILER_VERSION_MESSAGE` + if [ "$ASN1C_COMPILER_VERSION_MESSAGE" != "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE" ]; then + # diff <(echo -n "$ASN1C_COMPILER_VERSION_MESSAGE") <(echo -n "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE") + echo_error "Version of asn1c is not the required one, do you want to install the required one (overwrite installation) ? (Y/n)" + echo_error "$ASN1C_COMPILER_VERSION_MESSAGE" + while read -r -n 1 -s answer; do + if [[ $answer = [YyNn] ]]; then + [[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash $results + [[ $answer = [Nn] ]] && echo_error "Version of asn1c is not the required one, exiting." && exit 1 + break + fi + done + fi + +} + +check_install_hss_software() { + test_install_package autoconf + test_install_package automake + test_install_package bison + test_install_package build-essential + test_install_package cmake + test_install_package cmake-curses-gui + test_install_package dkms + test_install_package flex + test_install_package gawk + test_install_package gcc + test_install_package gdb + test_install_package guile-2.0-dev + test_install_package g++ + test_install_package libgmp-dev + test_install_package libgcrypt11-dev + test_install_package libidn11-dev + test_install_package libidn2-0-dev + test_install_package libmysqlclient-dev + test_install_package libtasn1-3-dev + test_install_package libsctp1 + test_install_package libsctp-dev + test_install_package libxml2-dev + test_install_package linux-headers-`uname -r` + test_install_package make + test_install_package mysql-client-core-5.5 + test_install_package mysql-server-core-5.5 + test_install_package mysql-server-5.5 + test_install_package openssh-client + test_install_package openssh-server + test_install_package phpmyadmin + test_install_package python-dev + test_install_package sshfs + test_install_package swig + test_install_package unzip + test_install_package valgrind +} + +################################################# +# 2. compile +################################################ +compile_hss() { + cd $OPENAIRCN_DIR/OPENAIRHSS + 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 + echo_success "Invoking autogen" + bash_exec "./autogen.sh" + cd ./$OBJ_DIR + echo_success "Invoking configure" + ../configure + else + cd ./$OBJ_DIR + fi + if [ -f Makefile ]; then + echo_success "Compiling..." + make -j $NUM_CPU + if [ $? -ne 0 ]; then + echo_error "Build failed, exiting" + exit 1 + fi + else + echo_error "Configure failed, exiting" + exit 1 + fi +} + + +compile_epc() { + cd $OPENAIRCN_DIR + 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 + echo_success "Invoking autogen" + bash_exec "./autogen.sh" + cd ./$OBJ_DIR + echo_success "Invoking configure" + ../configure --enable-standalone-epc --enable-raw-socket-for-sgi LDFLAGS=-L/usr/local/lib + 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" + exit 1 + fi + else + echo_error "Configure failed, exiting" + exit 1 + fi +} + +compile_ltesoftmodem() { + cd $OPENAIR_TARGETS/RT/USER + if [ -f Makefile ]; then + echo_success "Compiling for EXMIMO target (default)..." + echo_success "Compiling directives: $SOFTMODEM_DIRECTIVES" + make cleanall > /dev/null 2>&1 + make $SOFTMODEM_DIRECTIVES + make -j $NUM_CPU $SOFTMODEM_DIRECTIVES + if [ $? -ne 0 ]; then + echo_error "Build lte-softmodem failed, returning" + return 1 + else + cp -f ./lte-softmodem $OPENAIR_TARGETS/bin + return 0 + fi + else + echo_error "make file for oai softmodem not found, returning" + return 1 + fi +} + +compile_oaisim() { + cd $OPENAIR_TARGETS/SIMU/USER + if [ -f Makefile ]; then + echo_success "Compiling for oaisim target ..." + echo_success "Compiling directives: $OAISIM_DIRECTIVES" + make cleanall > /dev/null + make $OAISIM_DIRECTIVES + make -j $NUM_CPU $OAISIM_DIRECTIVES + if [ $? -ne 0 ]; then + echo_error "Build oaisim failed, returning" + return 1 + else + cp -f ./oaisim $OPENAIR_TARGETS/bin + return 0 + fi + else + echo_error "Makefile not found for oaisim target, returning" + return 1 + fi +} + +compile_unisim() { + cd $OPENAIR1_DIR/SIMULATION/LTE_PHY + if [ -f Makefile ]; then + echo_success "Compiling for CHANNELSIM target ..." + make cleanall + make -j $NUM_CPU all + if [ $? -ne 0 ]; then + echo_error "Build unisim failed, returning" + return 1 + else + cp -f ./dlsim $OPENAIR_TARGETS/bin + cp -f ./ulsim $OPENAIR_TARGETS/bin + cp -f ./pucchsim $OPENAIR_TARGETS/bin + cp -f ./prachsim $OPENAIR_TARGETS/bin + cp -f ./pdcchsim $OPENAIR_TARGETS/bin + cp -f ./pbchsim $OPENAIR_TARGETS/bin + cp -f ./mbmssim $OPENAIR_TARGETS/bin + return 0 + fi + else + echo_error "Configure failed, exiting" + return 1 + fi +} +################################################ +# 1. check if the executable functions exist +############################################### + +check_for_ltesoftmodem_executable() { + if [ ! -f $OPENAIR_TARGETS/RT/USER/lte-softmodem ]; then + echo_error "Cannot find lte-softmodem executable object in directory $OPENAIR_TARGETS/RT/USER" + echo_error "Please make sure you have compiled OAI lte-softmodem" + fi +} + +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 "Please make sure you have compiled OAI EPC with --enable-standalone-epc option" + 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/" + echo_fatal "Please make sure you have compiled OAI EPC without --enable-standalone-epc option" + fi +} + +check_for_oaisim_executable() { + if [ ! -f $OPENAIR_TARGETS/SIMU/USER/oaisim ]; then + echo_error "Cannot find oaisim executable object in directory $OPENAIR_TARGETS/SIMU/USER" + echo_error "Please make sure that the OAI oaisim is compiled" + fi +} + +check_for_dlsim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/dlsim ]; then + echo_error "Cannot find dlsim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI dlsim is compiled" + fi +} + +check_for_ulsim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/ulsim ]; then + echo_error "Cannot find ulsim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI ulsim is compiled" + fi +} + +check_for_pucchsim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/pucchsim ]; then + echo_error "Cannot find pucchsim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI pucchsim is compiled" + fi +} + +check_for_prachsim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/prachsim ]; then + echo_error "Cannot find prachsim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI prachsim is compiled" + fi +} + +check_for_pdcchsim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/pdcchsim ]; then + echo_error "Cannot find pdcchsim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI pdcchsim is compiled" + fi +} + +check_for_pbchsim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/pbchsim ]; then + echo_error "Cannot find pbchsim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI pbchsim is compiled" + fi +} + +check_for_mbmssim_executable() { + if [ ! -f $OPENAIR1_DIR/SIMULATION/LTE_PHY/mbmssim ]; then + echo_error "Cannot find mbmssim executable object in directory $OPENAIR1_DIR/SIMULATION/LTE_PHY" + echo_error "Please make sure that the OAI mbmssim is compiled" + fi +} +############################### +## 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} + echo -e -n "$color$message$reset_color" + echo + return +} + +cecho2() # Color-echo +# arg1 = message +# arg2 = color +{ + local default_msg="No Message." + message=${1:-$default_msg} + echo "$message" + 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 +} + +bash_exec() { + output=$($1 2>&1) + result=$? + if [ $result -eq 0 ]; then + echo_success "$1" + else + echo_error "$1: $output" + fi +} + + +wait_process_started () { + if [ -z "$1" ]; then + echo_error "WAITING FOR PROCESS START: NO PROCESS" + return 1 + fi + ps -C $1 > /dev/null 2>&1 + while [ $? -ne 0 ]; do + echo_warning "WAITING FOR $1 START" + sleep 2 + ps -C $1 > /dev/null 2>&1 + done + echo_success "PROCESS $1 STARTED" + return 0 +} + +is_process_started () { + if [ -z "$1" ]; then + echo_error "WAITING FOR PROCESS START: NO PROCESS" + return 1 + fi + ps -C $1 > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo_success "PROCESS $1 NOT STARTED" + return 1 + fi + echo_success "PROCESS $1 STARTED" + return 0 +} + +assert() { + # If condition false + # exit from script with error message + E_PARAM_ERR=98 + E_PARAM_FAILED=99 + + if [ -z "$2" ] ; then # Not enought parameters passed. + return $E_PARAM_ERR + fi + + lineno=$2 + if [ ! $1 ]; then + echo_error "Assertion failed: \"$1\"" + echo_fatal "File \"$0\", line $lineno" + fi +} diff --git a/targets/build_oai.bash b/targets/build_oai.bash new file mode 100755 index 0000000000000000000000000000000000000000..4208a84bf1d1b30835c0bd72f22bb4a7adb903f7 --- /dev/null +++ b/targets/build_oai.bash @@ -0,0 +1,286 @@ +################################################################################ +# 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_oai.bash +# brief +# author Navid Nikaein +# company Eurecom +# email: navid.nikaein@eurecom.fr +# + +#!/bin/bash +################################ +# include helper functions +################################ +THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) +. $THIS_SCRIPT_PATH/build_helper.bash + +################### +# create a bin dir +###################3 +echo_warning "1. Creating the bin dir..." +rm -rf bin +mkdir bin +chmod 777 -R bin + +build_date=`date +%Y_%m_%d` +oai_build_date="oai_built_${build_date}" +touch bin/${oai_build_date} + + + +################################ +# cleanup first +################################ +echo_warning "2. Cleaning ..." + +$SUDO kill -9 `ps -ef | grep oaisim | awk '{print $2}'` +$SUDO kill -9 `ps -ef | grep lte-softmodem | awk '{print $2}'` +$SUDO kill -9 `ps -ef | grep dlsim | awk '{print $2}'` +$SUDO kill -9 `ps -ef | grep ulsim | awk '{print $2}'` + +#if [ $# -eq 0 ]; then + +if [ -z "$1" ]; then + echo "Build OAI" +else + if [ $1 = 0 ]; then + echo "Check the installation, and build OAI" + rm -rf ./.lock_oaibuild + fi +fi +####################################### +# PARAMETERS +###################################### + +echo_warning "3. Setup the parameters" + +HW="EXMIMO" # EXMIMO, USRP, NONE +TARGET="NONE" # ALL, SOFTMODEM, OAISIM, UNISIM, NONE + +EPC=1 +REL="REL8" # REL8, REL10 +RT="RTAI" # RTAI, RT_PREMPT or RT_DISABLED +DEBUG=0 + +ENB_CONFIG_FILE=$OPENAIR_TARGETS/"PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.conf" + +OAI_TEST=0 +# script is not currently handling these params +XFORMS=0 +ITTI_ANALYZER=0 +VCD_TIMING=0 +WIRESHARK=0 +TIME_MEAS=0 + +EMULATION_DEV_INTERFACE="eth0" +EMULATION_MULTICAST_GROUP=1 +EMULATION_DEV_ADDRESS=`ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` + +####################################### +# Check the PARAMETERS +###################################### + + +if [ $TARGET != "SOFTMODEM" ]; then + RT="RT_DISABLED" + HW="NONE" +fi + +echo_success "Parameters : HW=$HW, TARGET=$TARGET, EPC=$EPC, REL=$REL, RT=$RT, DEBUG=$DEBUG" +echo_success "ENB_CONFIG_FILE: $ENB_CONFIG_FILE" + +echo "Parameters : HW=$HW, TARGET=$TARGET, EPC=$EPC, REL=$REL, RT=$RT, DEBUG=$DEBUG" >> bin/${oai_build_date} +echo "ENB_CONFIG_FILE: $ENB_CONFIG_FILE" >> bin/${oai_build_date} + +############################################ +# compilation directives +############################################ + +echo_warning "4. building the compilation directives ..." + +SOFTMODEM_DIRECTIVES="EPC=$EPC DEBUG=$DEBUG XFORMS=$XFORMS " +OAISIM_DIRECTIVES="EPC=$EPC DEBUG=$DEBUG XFORMS=$XFORMS " +if [ $HW = "USRP" ]; then + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES USRP=1 " +fi +if [ $EPC -eq 0 ]; then + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES NAS=1 " + OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES NAS=1 " +fi +if [ $REL = "REL8" ]; then + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES Rel8=1 " + OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel8=1 " +else + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES Rel10=1 " + OAISIM_DIRECTIVES="$OAISIM_DIRECTIVES Rel10=1 " +fi +if [ $RT = "RTAI" ]; then + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES HARD_RT=1 " +else + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES RTAI=0 " +fi + +output=$(check_for_machine_type 2>&1) +MACHINE_ARCH=$? +if [ $MACHINE_ARCH -eq 64 ]; then + SOFTMODEM_DIRECTIVES="$SOFTMODEM_DIRECTIVES LIBCONFIG_LONG=1 " + OAISIM_DIRECTIVES="$OASIM_DIRECTIVES LIBCONFIG_LONG=1 " +fi + +echo_success "SOFTMODEM Compilation directive: $SOFTMODEM_DIRECTIVES" +echo_success "OAISIM Compilation directive: $OAISIM_DIRECTIVES" + +echo "SOFTMODEM Compilation directive: $SOFTMODEM_DIRECTIVES" >> bin/${oai_build_date} +echo "OAISIM Compilation directive: $OAISIM_DIRECTIVES" >> bin/${oai_build_date} + +############################################ +# Printing OAI envs, we should check here +############################################ + + +echo_warning "5. Checking the OAI PATHS... (TBD)" +cecho "OPENAIR_HOME = $OPENAIR_HOME" $green +cecho "OPENAIR1_DIR = $OPENAIR1_DIR" $green +cecho "OPENAIR2_DIR = $OPENAIR2_DIR" $green +cecho "OPENAIR3_DIR = $OPENAIR3_DIR" $green +cecho "OPENAIRCN_DIR = $OPENAIRCN_DIR" $green +cecho "OPENAIR_TARGETS = $OPENAIR_TARGETS" $green + + +echo "OPENAIR_HOME = $OPENAIR_HOME" >> bin/${oai_build_date} +echo "OPENAIR1_DIR = $OPENAIR1_DIR" >> bin/${oai_build_date} +echo "OPENAIR2_DIR = $OPENAIR2_DIR" >> bin/${oai_build_date} +echo "OPENAIR3_DIR = $OPENAIR3_DIR" >> bin/${oai_build_date} +echo "OPENAIRCN_DIR = $OPENAIRCN_DIR" >> bin/${oai_build_date} +echo "OPENAIR_TARGETS = $OPENAIR_TARGETS" >> bin/${oai_build_date} + +############################################ +# check the installation +############################################ + +echo_warning "6. Checking the installation ..." + +output=$(check_install_oai_software >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + + +############################################ +# compile +############################################ + +echo_warning "7. compiling and installing the OAI binaries..." + +softmodem_compiled=1 +oaisim_compiled=1 +unisim_compiled=1 + +if [ $TARGET = "ALL" ]; then + output=$(compile_ltesoftmodem >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + softmodem_compiled=$? + check_for_ltesoftmodem_executable + + output=$(compile_oaisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + oaisim_compiled=$? + check_for_oaisim_executable + + output=$(compile_unisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + unisim_compiled=$? + check_for_dlsim_executable + check_for_ulsim_executable + check_for_pucchsim_executable + check_for_prachsim_executable + check_for_pdcchsim_executable + check_for_pbchsim_executable + check_for_mbmssim_executable + +else + + if [ $TARGET = "SOFTMODEM" ]; then + output=$(compile_ltesoftmodem >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + softmodem_compiled=$? + check_for_ltesoftmodem_executable + fi + if [ $TARGET = "OAISIM" ]; then + output=$(compile_oaisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + oaisim_compiled=$? + check_for_oaisim_executable + fi + if [ $TARGET = "UNISIM" ]; then + output=$(compile_unisim >> $OPENAIR_TARGETS/bin/install_log.txt 2>&1 ) + unisim_compiled=$? + check_for_dlsim_executable + check_for_ulsim_executable + check_for_pucchsim_executable + check_for_prachsim_executable + check_for_pdcchsim_executable + check_for_pbchsim_executable + check_for_mbmssim_executable + fi +fi + + + + +############################################ +# testing +############################################ + +if [ $OAI_TEST = 1 ]; then + echo_warning "8. Testing ..." + python $OPENAIR_TARGETS/TEST/OAI/test01.py +else + echo_warning "8. Bypassing the Tests ..." +fi + +############################################ +# terminate +############################################ + +echo_warning "9. Terminating ..." + +if [ $softmodem_compiled = 0 ]; then + echo "target lte-softmodem built " + echo "target lte-softmodem built " >> bin/${oai_build_date} +fi +if [ $oaisim_compiled = 0 ]; then + echo "target oaisim built " + echo "target oaisim built " >> bin/${oai_build_date} +fi +if [ $unisim_compiled = 0 ]; then + echo "target unisim built " + echo "target unisim built " >> bin/${oai_build_date} +fi + +echo "build terminated, see logs is $OPENAIR_TARGETS/bin/install_log.txt" + + + + + + +