Skip to content

Instantly share code, notes, and snippets.

@ia
Created September 18, 2017 12:52
Show Gist options
  • Save ia/6ed49e23ef72211744747a3f2d7ab112 to your computer and use it in GitHub Desktop.
Save ia/6ed49e23ef72211744747a3f2d7ab112 to your computer and use it in GitHub Desktop.
LEGACY: bladerf/openbts routine
#!/usr/bin/env bash
# WTFPL license
# firmware links:
# https://www.nuand.com/fx3/bladeRF_fw_v1.9.1.img
# https://www.nuand.com/fx3/bladeRF_fw_v1.9.1.img.sha256sum
# https://www.nuand.com/fpga/v0.6.0/hostedx40.rbf
# https://www.nuand.com/fpga/v0.6.0/hostedx40.rbf.sha256sum
# https://www.nuand.com/fpga/v0.6.0/hostedx115.rbf
# https://www.nuand.com/fpga/v0.6.0/hostedx115.rbf.sha256sum
OUT="out"
download()
{
mkdir -p "${OUT}"
cd "${OUT}"
wget -i ../list.txt
sha256sum -c *.sha256sum
}
setup_host()
{
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 build-essential cmake libncurses5-dev libtecla1 libtecla-dev pkg-config git wget
git clone https://github.com/Nuand/bladeRF.git "${OUT}"/bladerf
cd "${OUT}"/bladerf/host
mkdir BUILD
cd BUILD
mkdir ROOT
dst="`realpath ROOT`"
# cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${dst}" -DINSTALL_UDEV_RULES=ON -DBLADERF_GROUP=plugdev ../
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${dst}" -DINSTALL_UDEV_RULES=OFF ../
make
make install
cd ROOT
LIBBRF="`realpath lib`"
BINBRF="`realpath ./bin/bladeRF-cli`"
echo "alias brf-cli=\"LD_LIBRARY_PATH="${LIBBRF}" "${BINBRF}"\""
echo "sudo LD_LIBRARY_PATH="${LIBBRF}" "${BINBRF}" \${@}" > brf-cli
chmod a+x brf-cli
LD_LIBRARY_PATH="${LIBBRF}" "${BINBRF}" --version
}
upgrade_fw()
{
# flash firmware to update
brf-cli -f bladeRF_fw_v1.9.1.img
# flash FPGA to autoload
brf-cli -L hostedx40.rbf # ???
}
check_rf()
{
brf-cli -e version
}
# https://www.evilsocket.net/2016/03/31/how-to-build-your-own-rogue-gsm-bts-for-fun-and-profit/
# https://blog.strcpy.info/2016/04/21/building-a-portable-gsm-bts-using-bladerf-raspberry-and-yatebts-the-definitive-guide/
prepare_gsm()
{
# sudo apt-get install git telnet apache2 php5 libusb-1.0-0 libusb-1.0-0-dbg libusb-1.0-0-dev libgsm1 libgsm1-dev cmake automake
mkdir -p "${OUT}"/ybts
cd "${OUT}"/ybts
git clone https://github.com/strcpyblog/SubversiveBTS.git
cd SubversiveBTS/yate
./autogen.sh
./configure --prefix="${dst}"
make -j8
make install
# edit /etc/ld.so.conf: add "${dst}"/lib
ldconfig
cd ../yatebts
./autogen.sh
#./configure --prefix="${dst}"
./configure --prefix="${dst}" --with-yate="${dst}"/bin
# fix Makefile
make -j8
make install
ldconfig
}
# prepare_adsb
#### main
# download
# setup_host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment