Osmo-bsc and OpenBSC on rPi4 with Limesdr Ubuntu Server 20.04 LTS

Osmo-bsc on rPi4 with Limesdr Ubuntu server 20.04 LTS

#!/bin/bash
rm -rf /opt/GSM
mkdir /opt/GSM
cd /opt/GSM
apt update && sudo apt upgrade -y
apt install -y libusb-1.0-0-dev libuhd-dev uhd-host cmake autoconf make
git clone https://github.com/pothosware/SoapySDR
cd /opt/GSM/SoapySDR
mkdir build && cd build && cmake .. && make -j4 && make install && ldconfig
cd /opt/GSM
sudo apt install -y libtool
git clone https://github.com/pothosware/SoapyUHD
cd /opt/GSM/SoapyUHD
mkdir build && cd build && cmake .. && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/myriadrf/LimeSuite
cd /opt/GSM/LimeSuite
cd build && cmake .. && make -j4 && make install && ldconfig
cd /opt/GSM
echo “export UHD_MODULE_PATH=/usr/lib/uhd/modules” >> /root/.bashrc
sudo apt install -y cpufrequtils
sudo apt install -y libsctp-dev libconfig++-dev libconfig-dev libmbedtls-dev
cd /opt/GSM
apt install -y libtalloc-dev libgnutls28-dev libmnl-dev
git clone https://github.com/osmocom/libosmocore
cd /opt/GSM/libosmocore
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
apt install -y libortp-dev
git clone https://github.com/osmocom/libosmo-abis
cd /opt/GSM/libosmo-abis
autoreconf -fi && ./configure –disable-dahdi && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/libosmo-netif
cd /opt/GSM/libosmo-netif
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-hlr
apt install -y libsqlite3-dev
cd /opt/GSM/osmo-hlr
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-mgw
cd /opt/GSM/osmo-mgw
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone git://git.osmocom.org/libgtpnl.git
cd /opt/GSM/libgtpnl
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/libosmo-sccp
cd /opt/GSM/libosmo-sccp
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-ggsn
cd /opt/GSM/osmo-ggsn
autoreconf -fi && ./configure –enable-gtp-linux && make -j4 && make install && ldconfig
cd /opt/GSM
apt install -y libc-ares-dev
git clone https://github.com/osmocom/osmo-sgsn
cd /opt/GSM/osmo-sgsn
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-msc
apt install -y libdbi-dev
cd /opt/GSM/osmo-msc
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-bsc
cd /opt/GSM/osmo-bsc
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
apt install -y libsofia-sip-ua-glib-dev
git clone https://github.com/osmocom/osmo-sip-connector
cd /opt/GSM/osmo-sip-connector
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-trx
cd /opt/GSM/osmo-trx
git checkout 1.1.0
autoreconf -fi && ./configure –with-lms && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/osmocom/osmo-bts
cd /opt/GSM/osmo-bts
git checkout 1.1.0
autoreconf -fi && ./configure –enable-trx && make -j4 && make install && ldconfig
cd /opt/GSM
git clone https://github.com/bbaranoff/osmocom-nitb-standalone /etc/osmocom
cp -r /usr/local/bin/. /usr/bin
apt install libdbd-sqlite3
mkdir /var/lib/osmocom
wget https://raw.githubusercontent.com/bbaranoff/PImpMyPi/main/osmo-msc.service
cp osmo-msc.service /lib/systemd/system/osmo-msc.service
systemctl daemon-reload
cd /etc/osmocom
./osmo-all enable
cd /opt/GSM
update-alternatives –set gcc /usr/bin/gcc-10
cd /opt/GSM
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.25.3.tar.gz
tar zxvf asterisk-11.25.3.tar.gz
cd /opt/GSM/asterisk-11.25.3
apt install libncurses-dev libxml2-dev
./configure
make
make install
make config
ldconfig
cd /etc/asterisk
rm extensions.conf
wget https://raw.githubusercontent.com/bbaranoff/PImpMyPi/main/extensions.conf
rm sip.conf
wget https://raw.githubusercontent.com/bbaranoff/PImpMyPi/main/sip.conf

running

cd /etc/osmocom
sudo ./osmo-all
sudo osmo-trx-lms
sudo osmo-bts-trx

Adding OpenBSC mISDN LCR

cd /opt/GSM
git clone https://github.com/osmocom/openbsc
cd openbsc/openbsc
autoreconf -fi && ./configure && make -j4 && make install && ldconfig
cd /lib/modules/$(uname -r)/build/certs
openssl req -new -x509 -newkey rsa:2048 -keyout signing_key.pem -outform DER -out signing_key.x509 -nodes -subj “/CN=Owner/”
apt install -y gcc-9 g++-9 gcc-7 g++-7 gcc-10 g++-10
update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-7 70 –slave /usr/bin/g++ g++ /usr/bin/g++-7
update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-9 90 –slave /usr/bin/g++ g++ /usr/bin/g++-9
update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-10 100 –slave /usr/bin/g++ g++ /usr/bin/g++-10
cd /opt/GSM/
git clone https://github.com/isdn4linux/mISDN
cd /opt/GSM/mISDN
rm -Rf /lib/modules/$(uname -r)/kernel/drivers/isdn/hardware/mISDN
rm -Rf /lib/modules/$(uname -r)/kernel/drivers/isdn/mISDN/
wget https://raw.githubusercontent.com/bbaranoff/PImpMyPi/main/octvqe.patch
cp /boot/System.map-$(uname -r) /usr/src/linux-headers-$(uname -r)/System.map
ln -s /lib/modules/$(uname -r)/build /lib/modules/$(uname -r)/source
aclocal && automake –add-missing
./configure
patch -p0 < octvqe.patch
make modules
cp /opt/GSM/mISDN/standalone/drivers/isdn/mISDN/modules.order /usr/src/linux-headers-$(uname -r)
cp -rn /usr/lib/modules/$(uname -r)/. /usr/src/linux-headers-$(uname -r)
make modules_install
depmod -a
update-alternatives –set gcc /usr/bin/gcc-7
cd /opt/GSM
apt install bison flex -y
git clone https://github.com/isdn4linux/mISDNuser
cd /opt/GSM/mISDNuser
make
./configure
make
make install
ldconfig
cd example
./configure
make
make install
ldconfig
update-alternatives –set gcc /usr/bin/gcc-10
cd /opt/GSM
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.25.3.tar.gz
tar zxvf asterisk-11.25.3.tar.gz
cd /opt/GSM/asterisk-11.25.3
apt install libncurses-dev libxml2-dev
./configure
make
make install
make config
ldconfig
cd /opt/GSM
git clone http://git.eversberg.eu/lcr.git
cd /opt/GSM/lcr
wget https://raw.githubusercontent.com/bbaranoff/PImpMyPi/main/ast_lcr.patch
wget https://raw.githubusercontent.com/bbaranoff/PImpMyPi/main/sip_gcc.patch
patch -p0 < ast_lcr.patch
patch -p0 < sip_gcc.patch
./autogen.sh
./configure –with-sip –with-gsm-bs –with-gsm-ms –with-asterisk –with-sip
make
make install
ldconfig

Nice script but a few comments to make it work for most. I tested it on ubuntu 20.04LTS running on a Raspberry CM3.

Remember to install lib pcsclite
sudo apt install libpcsclite-dev

and change the following config flags

–disable-dahdi => --disable- dahdi
–enable-gtp-linux => --enable-gtp-linux
–with-lms => --with-lms
–enable-trx => --enable-trx

The inverted commas in the command below may be unrecognised by your system
echo “export UHD_MODULE_PATH=/usr/lib/uhd/modules” >> /root/.bashrc

Finally, some may need to install or compile gcc v10
sudo apt install gcc-10

1 Like