Skip to content

Instantly share code, notes, and snippets.

@smarek
Last active March 3, 2024 00:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save smarek/b538465a711edc7e6d7652c82e76d374 to your computer and use it in GitHub Desktop.
Save smarek/b538465a711edc7e6d7652c82e76d374 to your computer and use it in GitHub Desktop.
Yate, YateBTS and bladeRF install
#!/bin/bash
#
# For debian-like systems, for others you might have to change package names
# libusb-dev at least 1.0
# build-essential => make, dpkg-dev, gcc, g++, libc-dev / libc6-dev
#
#
# Depending on your architecture and available cores, you might want to change -j4 argument (4 = number of compilation threads = cpu cores available)
#
# If you have GCC version greater than 6, go /usr/src/yatebts/ and patch using `patch -p1 < yatebts-5.0.0-gcc6.patch`
# https://yate.null.ro/mantis/view.php?id=416
#
# If you are on ARM64 platform, go /usr/src/yate/ and patch using `patch -p1 < add-arm64-support.patch`
# https://yate.null.ro/mantis/view.php?id=412
#
# go root
sudo bash
# Prerequisites
apt-get install -y --no-install-recommends pkg-config libgsm1-dev libssl-dev git libusb-dev autoconf automake make build-essential libspandsp-dev libsqlite3-dev libsctp-dev doxygen libopencore-amrwb-dev libopencore-amrnb-dev libc++-dev libspeex-dev libpthread-stubs0-dev libpthread-workqueue-dev libasound2-dev wget libusb-1.0-0-dev
# you might have to replace libssl-dev with libssl1.0-dev if you get "error: ‘AES_ctr128_encrypt’ was not declared in this scope"
# Optionals
apt-get install -y --no-install-recommends byobu unbound tmux curl ca-certificates htop gdb
# Sources
cd /usr/src
git clone --recursive https://github.com/itds-consulting/yate
git clone --recursive https://github.com/itds-consulting/yatebts
git clone --recursive https://github.com/Nuand/bladeRF
# Configure and install
# Yate
cd /usr/src/yate
./autogen.sh
./configure --prefix=/usr/local > ../yate.configure.log
make -j4 > ../yate.make.log
make install > ../yate.install.log
make install >> ../yate.install.log
ldconfig
# YateBTS
cd /usr/src/yatebts
./autogen.sh
./configure --prefix=/usr/local > ../yatebts.configure.log
make -j4 > ../yatebts.make.log
make install > ../yatebts.install.log
make install >> ../yatebts.install.log
ldconfig
# bladeRF toolkit
cd /usr/src/bladeRF
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DINSTALL_UDEV_RULES=ON -DENABLE_LIBBLADERF_SYSLOG=ON ../ > bladerf.configure.log
make -j4 > bladerf.make.log
make install > bladerf.install.log
make install >> bladerf.install.log
ldconfig
# Finished
touch /usr/local/etc/yate/snmp_data.conf
touch /usr/local/etc/yate/tmsidata.conf
# Now go to /usr/local/etc/yate and update configuration of `ybts.conf` and `subscribers.conf` (see below)
# Run YateBTS via `/usr/local/bin/yate -C`
# In case core-dump is generated, inspect with `gdb /usr/local/bin/yate core` (file "core" created in current working directory"
@smarek
Copy link
Author

smarek commented Jul 14, 2017

yatebts-5.0.0-gcc6.patch

--- a/mbts/GPRS/MSInfo.cpp
+++ b/mbts/GPRS/MSInfo.cpp
@@ -638,7 +638,7 @@
         if (msPCHDowns.size() > 1) {
             std::ostringstream os;
             msDumpChannels(os);
-            GPRSLOG(INFO,GPRS_MSG|GPRS_CHECK_OK) << "Multislot assignment for "<<this<<os;
+            GPRSLOG(INFO,GPRS_MSG|GPRS_CHECK_OK) << "Multislot assignment for "<<this<<(!os.fail());
         }
 
 	} else {
--- a/mbts/SGSNGGSN/Sgsn.cpp
+++ b/mbts/SGSNGGSN/Sgsn.cpp
@@ -149,7 +149,7 @@
 	clearConn(GprsConnNone,SigConnLost);
 	std::ostringstream ss;
 	sgsnInfoDump(this,ss);
-	SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing SgsnInfo:"<<ss);
+	SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing SgsnInfo:"<<(!ss.fail()));
 	sSgsnInfoList.remove(this);
 	GmmInfo *gmm = getGmm();
 	if (gmm && (gmm->getSI() == this)) {
@@ -252,7 +252,7 @@
 {
 	std::ostringstream ss;
 	gmmInfoDump(gmm,ss,0);
-	SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<ss);
+	SGSNLOGF(INFO,GPRS_OK|GPRS_MSG,"SGSN","Removing gmm:"<<(!ss.fail()));
 	SgsnInfo *si;
 	RN_FOR_ALL(SgsnInfoList_t,sSgsnInfoList,si) {
 		// The second test here should be redundant.

@smarek
Copy link
Author

smarek commented Jul 14, 2017

dd-arm64-support.patch

Index: b/libs/miniwebrtc/typedefs.h
===================================================================
--- a/libs/miniwebrtc/typedefs.h
+++ b/libs/miniwebrtc/typedefs.h
@@ -99,6 +99,9 @@
 #define WEBRTC_ARCH_BIG_ENDIAN
 #define WEBRTC_BIG_ENDIAN
 #endif
+#elif defined(__aarch64__)
+#define WEBRTC_ARCH_64_BITS 
+#define WEBRTC_ARCH_LITTLE_ENDIAN 
 
 #else
 #error Please add support for your architecture in typedefs.h

@smarek
Copy link
Author

smarek commented Jul 15, 2017

Configuration changes (minimum)

ybts.conf (just changed lines, not full content)

Radio.Band=900
Radio.C0=0
Radio.PowerManager.MaxAttenDB=35
Radio.PowerManager.MinAttenDB=35

subscribers.conf (just changed lines, not full content)

country_code=111
regexp=.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment