-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsrsran_handover.sh
84 lines (73 loc) · 3 KB
/
srsran_handover.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" >&2
exit 1
fi
# Check the current working directory
REQUIRED_DIR="/home/ubnt/main-file-repo/oaic"
if [ "$(pwd)" != "$REQUIRED_DIR" ]; then
echo "This script must be run from $REQUIRED_DIR" >&2
exit 1
fi
######################### Install srsRAN #####################
sudo apt install nlohmann-json3-dev
sudo apt-get install build-essential cmake libfftw3-dev libmbedtls-dev libboost-program-options-dev libconfig++-dev libsctp-dev
sudo apt-get install libzmq3-dev
sudo add-apt-repository ppa:ettusresearch/uhd
sudo apt-get update
sudo apt-get install libuhd-dev libuhd4.1.0 uhd-host
git clone https://gitlab.eurecom.fr/oai/asn1c.git
cd asn1c
git checkout velichkov_s1ap_plus_option_group
autoreconf -iv
./configure
cd ..
# Define the destination directory where srsRAN is located
DEST_DIR="/home/ubnt/main-file-repo/oaic/srsRAN-e2"
# Define the URLs of the source files to be replaced
declare -A files_to_download=(
["srsenb/src/handover_server/handover_server.cpp"]="https://raw.githubusercontent.com/natanzi/srsRAN_4G_Handover/master/srsenb/src/handover_server/handover_server.cpp"
["srsenb/src/handover_server/handover_server.h"]="https://raw.githubusercontent.com/natanzi/srsRAN_4G_Handover/master/srsenb/src/handover_server/handover_server.h"
["srsenb/src/CMakeLists.txt"]="https://raw.githubusercontent.com/natanzi/srsRAN_4G_Handover/master/srsenb/src/CMakeLists.txt"
["srsenb/src/main.cc"]="https://raw.githubusercontent.com/natanzi/srsRAN_4G_Handover/master/srsenb/src/main.cc"
)
# Create the handover_server directory
HANDOVER_SERVER_DIR="${DEST_DIR}/srsenb/src/handover_server"
mkdir -p "$HANDOVER_SERVER_DIR"
# Download and copy files
for dest_path in "${!files_to_download[@]}"; do
url=${files_to_download[$dest_path]}
full_dest_path="${DEST_DIR}/${dest_path}"
# Create destination directory if it doesn't exist
mkdir -p "$(dirname "$full_dest_path")"
# Download the file using wget or curl
if wget -q -O "$full_dest_path" "$url" || curl -s -o "$full_dest_path" "$url"; then
echo "Downloaded $url to $full_dest_path"
else
echo "Failed to download $url to $full_dest_path" >&2
exit 1
fi
done
echo "Files have been downloaded and placed in the correct directories successfully."
# Navigate to the srsRAN build directory and build the project
cd "${DEST_DIR}"
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake ..
make -j$(nproc)
sudo make install
sudo ldconfig
# Export the environment variable for srsRAN
export SRS=$(realpath .)
# Additional cmake configurations, assuming e2_bindings directory exists under ${SRS}
cmake ../ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DRIC_GENERATED_E2AP_BINDING_DIR=${SRS}/e2_bindings/E2AP-v01.01 \
-DRIC_GENERATED_E2SM_KPM_BINDING_DIR=${SRS}/e2_bindings/E2SM-KPM \
-DRIC_GENERATED_E2SM_GNB_NRT_BINDING_DIR=${SRS}/e2_bindings/E2SM-GNB-NRT
make -j$(nproc)
sudo make install
sudo ldconfig
sudo srsran_install_configs.sh service