From 5dfdec6c259d1c7cca4ba319cf7da072025bd04f Mon Sep 17 00:00:00 2001
From: Wilson Thong <wilsonthong@astri.org>
Date: Tue, 28 Mar 2017 10:11:43 +0800
Subject: [PATCH] #219 add minimum support for running and building UE and eNB

---
 cmake_targets/build_ue           |  5 +++++
 cmake_targets/tools/build_helper |  8 +++++++-
 cmake_targets/tools/init_nas_s1  |  8 ++++----
 cmake_targets/tools/run_ue_s1    | 33 ++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+), 5 deletions(-)
 create mode 100644 cmake_targets/build_ue
 create mode 100644 cmake_targets/tools/run_ue_s1

diff --git a/cmake_targets/build_ue b/cmake_targets/build_ue
new file mode 100644
index 00000000000..76b1c96315e
--- /dev/null
+++ b/cmake_targets/build_ue
@@ -0,0 +1,5 @@
+#!/bin/bash
+#sudo ./build_oai -c -C -I --install-optional-packages --install-system-files --UE -w USRP -V 
+#sudo ./build_oai -c -C -I --install-optional-packages --UE -w USRP -V 
+#sudo ./build_oai -c -C --UE -w USRP -V
+sudo ./build_oai -c -C --UE -w USRP
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index ede8ef4196e..e3bd2e07823 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -164,7 +164,13 @@ compilations() {
   } > $dlog/$2.$REL.txt 2>&1
   set -e
   echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt"
-  if [ -s $3 ] ; then
+
+echo "#!/bash/bin" > domake_$2.sh
+  echo "$SUDO make -j`nproc` $2" >> domake_$2.sh
+  echo "$SUDO cp $3 $4" >> domake_$2.sh
+  chmod 775 domake_$2.sh  
+
+if [ -s $3 ] ; then
      cp $3 $4
      echo_success "$2 compiled"
      check_warnings "$dlog/$2.$REL.txt"
diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1
index 5f27c528374..003a3ae600a 100644
--- a/cmake_targets/tools/init_nas_s1
+++ b/cmake_targets/tools/init_nas_s1
@@ -33,7 +33,7 @@
 #
 #######################################
 
-LTEIF=oip0
+LTEIF=oip1
 #OPENAIR_DIR=/home/oai/svn-oai/openair4G
 
 load_module() {
@@ -48,11 +48,11 @@ load_module() {
   sudo insmod $1
 }
 
-load_module $OPENAIR_DIR/targets/bin/ue_ip.ko
+load_module ../../targets/bin/ue_ip.ko
 
 if [ "$1" = "UE" ]; then
-  echo "bring up oip0 interface for UE"
-  ifconfig oip0 up
+  echo "bring up $LTEIF interface for UE"
+  ifconfig $LTEIF up
 fi
 
 ip route flush cache
diff --git a/cmake_targets/tools/run_ue_s1 b/cmake_targets/tools/run_ue_s1
new file mode 100644
index 00000000000..56b18d72b92
--- /dev/null
+++ b/cmake_targets/tools/run_ue_s1
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Carrier frequency in Hz
+#FREQ=2660000000 #FDD
+FREQ=2350000000 #TDD
+NRB=50
+TA=0
+
+#9:trace, 8/7:debug, 6:info, 4:warn, 3:error
+LOGLEVEL=6
+
+#enable or disable soft scope
+#SCOPE=''
+SCOPE='-d'
+
+#enable or disable VCD logging
+VCD=''
+#VCD='-V'
+
+ISTDD='-T'
+#ISTDD=''
+
+#use external clock
+ECLK="--external-clock"
+#ECLK=""
+
+#UE scan carrier
+#ISSCAN="--ue-scan-carrier"
+ISSCAN=""
+
+sudo sh -c './init_nas_s1 UE'
+cd ../../targets/bin/ 
+sudo -E ./lte-softmodem.Rel10 -U -C$FREQ -r$NRB $ISSCAN --ue-txgain 70 --ue-rxgain 80 -A $TA $ECLK -W $ISTDD -g $LOGLEVEL $SCOPE 2>&1 | sudo tee /tmp/UE.log 
-- 
GitLab