Osmocom记录

本篇记录为杂记,具体可参考另一篇教程博文

1. Ubuntu 12.04安装

Vmware虚拟机安装镜像即可,略

安装好后,需要安装osmocom依赖的一些包,但是由于12.04早已不受支持,所以apt-get update 总是失败,提示404 not found,更换个几个源都不行。

使用的源:

deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse

deb http://archive.ubuntu.com/ubuntu precise-security universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu precise-proposed universe main multiverse restricted

最后google到一个github帖子解决了这个问题:https://gist.github.com/dergachev/f5da514802fcbbb441a1

原因:由于不受支持了,12.04相关的这些包的资源被移到了old-releases.ubuntu.com域名下,而不是security.ubuntu.com和 archive.ubuntu.com了,因此需要修改源

使用命令修改源

sudo sed -i.bak -r 's/(archive|security).ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

修改后的源

deb http://old-releases.ubuntu.com/ubuntu precise main universe restricted multiverse

deb http://old-releases.ubuntu.com/ubuntu precise-security universe main multiverse restricted

deb http://old-releases.ubuntu.com/ubuntu precise-updates universe main multiverse restricted

deb http://old-releases.ubuntu.com/ubuntu precise-proposed universe main multiverse restricted

之后sudo apt-get update / sudo apt-get upgrade 均可正常执行

安装相关依赖:

sudo apt-get install build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev   subversion  git  autoconf  vim

sudo apt-get install autoconf libtool libosip2-dev libortp-dev libusb-1.0-0-dev g++ sqlite3 libsqlite3-dev erlang libreadline6-dev libncurses5-dev

sudo apt-get install libfftw3-3 libfftw3-dev libfftw3-doc

sudo apt-get install build-essential libtool libtalloc-dev shtool autoconf automake git-core pkg-config make gcc libpcsclite-dev

sudo apt-get install wireshark tshark unbound-anchor

sudo apt-get install libunbound-dev libusb-dev libmnl-dev libsctp-dev python3 libgnutls28-dev

2. 安装libosmocore

手动安装gmp

xz -d gmp-6.2.0.tar.xz

tar -xvf gmp-6.2.0.tar

cd gmp-6.2.0

./configure --prefix=/usr --enable-shared

make

sudo make install

手动安装nettle

tar -xzvf nettle-3.4.1.tar.gz

cd nettle-3.4.1

 ./configure --prefix=/usr --disable-openssl --enable-shared --enable-mini-gmp

   make

 sudo make install

手动安装libtasn1

tar -zxvf libtasn1-4.13.tar.gz

cd libtasn1-4.13

./configure --prefix=/usr --enable-shared

make

sudo make install

手动安装libidn2

tar -zxvf libidn2-2.2.0.tar.gz

 cd libidn2-2.2.0

./configure --prefix=/usr --enable-shared

make

sudo make install

手动安装libffi

tar -zxvf libffi-3.3.tar.gz

cd libffi-3.3

./configure --prefix=/usr --enable-shared

make

sudo make install

手动安装p11-kit

tar -zxvf p11-kit-0.23.16.1.tar.gz

 cd  p11-kit-0.23.16.1

./configure --prefix=/usr --enable-shared

make

sudo make install

手动安装libunistring

xz -d  libunistring-0.9.10.tar.xz

tar -xvf libunistring-0.9.10.tar

cd libunistring-0.9.10

./configure --prefix=/usr   --disable-static  --docdir=/usr/share/doc/libunistring-0.9.10 && make

sudo make install

检查安装

pkg-config --modversion gmp

pkg-config --modversion nettle

pkg-config --modversion libtasn1

pkg-config --modversion libidn2

pkg-config --modversion libffi

手动安装gnutls

xz -d gnutls-3.6.9.tar.xz

tar -xvf gnutls-3.6.9.tar

cd gnutls-3.6.9

sudo mkdir /etc/unbound

sudo  unbound-anchor -a "/etc/unbound/root.key"

./configure --prefix=/usr --enable-shared

make

sudo make install

这里编译会出错,

经查询好像是libp11库的问题

(参考https://blog.csdn.net/sui1005316018/article/details/89133036)

sudo find / -name libp11-kit.so*

mv命令 改成只有一个libp11-kit.so 能够解决undefined reference to p11的问题,还剩一个问题

 升级GCC:

首先安装mpfr依赖

cd mpfr-4.1.0

./configure

make

sudo make install

安装mpc依赖

cd mpc-1.2.0

./configure

make

sudo make install

升级

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8

sudo update-alternatives --remove-all gcc

sudo update-alternatives --remove-all g++

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20

sudo update-alternatives --config gcc

sudo update-alternatives --config g++

(参考:https://stackoverflow.com/questions/19836858/upgrade-gcc-4-6-3-on-ubuntu-12-04-to-4-8-2

依然存在这个问题,只好改用gnutls 3.6.16 依然有p11的问题,且上述方法无法解决

卡死了

3. 换用ubuntu16.04

安装依赖

sudo apt-get install build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev   subversion  git  autoconf  vim

sudo apt-get install autoconf libtool libosip2-dev libortp-dev libusb-1.0-0-dev g++ sqlite3 libsqlite3-dev erlang libreadline6-dev libncurses5-dev

sudo apt-get install libfftw3-3 libfftw3-dev libfftw3-doc

sudo apt-get install build-essential libtool libtalloc-dev shtool autoconf automake git-core pkg-config make gcc libpcsclite-dev

sudo apt-get install wireshark tshark unbound-anchor

sudo apt-get install libunbound-dev libusb-dev libmnl-dev libsctp-dev python3 libgnutls28-dev

编译libosmo-dsp

git clone git://git.osmocom.org/libosmo-dsp.git

cd libosmo-dsp

autoreconf -i

./configure

make

sudo make install

sudo ldconfig -i

编译libosmocore

git clone git://git.osmocom.org/libosmocore.git

cd libosmocore

autoreconf -i

./configure

make

sudo make install

sudo ldconfig -i

直接通过

编译osmcom-bb

git clone git://git.osmocom.org/osmocom-bb.git

cd osmocom-bb/src

make

Make报错 需要配置合适的arm编译环境

https://github.com/koushik2506/exp/tree/master/arm 下载

bu-2.16.1_gcc-4.0.2-c-c++_nl-1.14.0_gi-6.4_x86-64.tar.bz2

解压后

mv gnuarm-* ~/gnuarm

export PATH=~/gnuarm/bin:$PATH

再make 报一个错

 arm-elf-ld: region LRAM is full (board/compal_e88/layer1.compalram.elf section .data)

经查询解决方法如下

 Ram.lds

 改为

 Highram.lds

 改为

 再make 又报一个错

git clean -dfx

make

还是报错

arm-elf-ld: address 0x800038 of board/compal_e88/hello_world.highram.elf section .text.exceptions is not within region XRAM

尝试不改highram.lds 再make 即可

参考

https://blog.csdn.net/weixin_37988926/article/details/103949106

https://blog.csdn.net/qq_42013117/article/details/89244307

https://wenku.baidu.com/view/c5fefa7102020740bf1e9b48.html

https://blog.csdn.net/azraelxuemo/article/details/107187610

4. 刷固件

cd osmocom-bb/src/host/osmocon

sudo ./osmocon -m c123xor -p /dev/ttyUSB0 ../../target/firmware/board/compal_e88/layer1.compalram.bin

半天没反应?

经查询,是需要开启flash刷写的编译参数

vim target/firmware/Makefile

去掉注释

 重新编译

make

再次尝试刷写

插好线缆 关闭手机 然后执行命令,没有反应,按一下手机开机键,提示如上图,文件大小过大 67208>65535

猜想是前面改ram.lad的数值导致的,改了几个其他的数值,文件大小没有变化

于是尝试切换一个分支

重新git一个目录

git clone git://git.osmocom.org/osmocom-bb.git osmocom-bb-2

cd osmocom-bb-2

git checkout --track origin/luca/gsmmap

cd src

make

编译出来的文件符合大小要求

 再次尝试刷写

cd osmocom-bb/src/host/osmocon

sudo ./osmocon -m c123xor -p /dev/ttyUSB0 ../../target/firmware/board/compal_e88/layer1.compalram.bin

插好线缆 关闭手机 然后执行命令,没有反应,按一下手机开机键

刷写成功

cd src/host/layer23/src/misc

sudo ./cell_log -O

扫描当前基站

 因为这台手机是只支持移动的,所以只扫出了移动基站?

根据扫描出的ARFCN,如信号最强的46,进行控制信道的监听

sudo ./ccch_scan -i 127.0.0.1 -a 46

打开新的terminal 启动 wireshark

sudo wireshark -k -i lo -f 'port 4729'

 筛选gsm_sms协议

空空如也

参考:

https://bbs.elecfans.com/jishu_939756_1_1.html

https://www.youtube.com/watch?v=jGC9bwAYLMg

https://www.youtube.com/watch?v=hrXVWRAqJQU

https://www.programmersought.com/article/81405090178/

https://osmocom.org/projects/baseband/wiki/Flashing

https://pub.nethence.com/radio/motorola

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值