首页 > 代码库 > HackRF初次接触

HackRF初次接触

概述

   刚开始是从网站上看了相关的信息,感觉此板子真NB,能有真么多高级的玩法,而再看看此板子的价格能买半个最高的级苹果plus了,正赶上公司项目需要,公费买个先去折腾下,就这样就订购了一套这样的主板。

购买的设备清单:

1、HackRF主板;
2、亚克力外壳;
3、GSM天线;
4、上变频器;
5、附属配件(螺丝、铜柱及USB线)

拿到板子后,第一反应就是去找这个板子的Debug接口,可能是开发板的习惯性动作吧。

其实这个HackRF主板与机器的连通,就只有一个USB口,它不仅仅单一用来供电 ,还用来做数据连通,感觉就是开发板的Debug口了啊。

编译

接下来就从官方网上去clone数据,搭建编译服务器,我的操作系统选的是ubuntu 14.04的32bit位。

前提是官方网上所述的被墙了,所以我用的是香港主机下载的数据包。
下载完毕后导入本地计算机中,整个过程除了下载数据的速度坑爹外,其它一切OK.
以下为搭建数据的整个过程:

login as: leekwen
leekwen@192.168.10.100's password:
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.11.0-15-generic i686)

 * Documentation:  https://help.ubuntu.com/

New release '14.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Fri Dec  5 15:13:38 2014 from 192.168.10.132

leekwen@dell:~$ cat /etc/issue
Ubuntu 12.04.4 LTS \n \l

leekwen@dell:~$ uname -a
Linux dell 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:42:40 UTC 2014 i686 i686 i386 GNU/Linux

leekwen@dell:~$ mkdir -p hackrf/tar-gz
leekwen@dell:~$ cd hackrf/tar-gz

############这些包我已经传到360的云盘上去了###################
############需要下载的请点击此处,尽情下载####################
  360云盘地址:http://yunpan.cn/cfdCJmZJeYPu3   提取码 4a69   将下载的文件包都放在这个目录下;


leekwen@dell:~/hackrf$ ls -l
total 66160
-rwxr-xr-x 1 leekwen leekwen 44647462 Dec  4 16:49 gnuradio.tar.gz
-rwxr-xr-x 1 leekwen leekwen  5571445 Dec  5 15:53 gqrx.tar.gz
-rwxr-xr-x 1 leekwen leekwen  1208375 Dec  4 17:03 gr-osmosdr.tar.gz
-rwxr-xr-x 1 leekwen leekwen 15793136 Dec  5 13:38 hackrf-2014.08.1.zip
-rwxr-xr-x 1 leekwen leekwen   515902 Dec  4 17:03 rtl-sdr.tar.gz

环境的依赖包,请运行以下代码来解决:

leekwen@dell:~/hackrf$ sudo apt-get -y install build-essential cmake git-core autoconf automake \ 
libtool g++ python-dev swig pkg-config libfftw3-dev libcppunit-dev libgsl0-dev \ 
libusb-dev sdcc libsdl1.2-dev python-wxgtk2.8 python-numpy python-cheetah python-lxml \ 
doxygen python-qt4 python-qwt5-qt4 libxi-dev libqt4-opengl-dev libqwt5-qt4-dev \ 
libfontconfig1-dev libxrender-dev libusb-1.0 libboost1.48-all-dev libboost1.48-dev

然后将下载的包都解压到hackrf目录下对应的包目录中:


1、Gnuradio的编译过程

leekwen@dell:~/hackrf$ cd gnuradio/
leekwen@dell:~/hackrf/gnuradio$ mkdir build; cd build
leekwen@dell:~/hackrf/gnuradio/build$ vi build.sh
#!/bin/sh
echo "\r"
echo ">>>>>>>>>>>>>> Cmake Start <<<<<<<<<<<<<<<<<<"
echo "\r"
		cmake ../
echo "\r"
echo ">>>>>>>>>>>>>> Make Start <<<<<<<<<<<<<<<<<<"
echo "\r"
		make -j 4
echo "\r"
echo ">>>>>>>>>>>>>> Make Install <<<<<<<<<<<<<<<<<<"
echo "\r"
		sudo make install
echo "\r"
echo ">>>>>>>>>>>>>> ldconfig Start <<<<<<<<<<<<<<<<<<"
echo "\r"
		sudo ldconfig

leekwen@dell:~/hackrf/gnuradio/build$ sh build.sh


[sudo] password for leekwen:  <<<<< 输入密码

2、HackRF的编译过程

leekwen@dell:~/hackrf$ cd hackrf-2014.08.1/
leekwen@dell:~/hackrf/hackrf-2014.08.1$ ls
COPYING  doc  firmware  firmware-bin  hardware  host  Readme.md  RELEASENOTES  TRADEMARK
leekwen@dell:~/hackrf/hackrf-2014.08.1$ cd host/
leekwen@dell:~/hackrf/hackrf-2014.08.1/host$ ls
build  cmake  CMakeLists.txt  hackrf-tools  libhackrf  python  README.md
leekwen@dell:~/hackrf/hackrf-2014.08.1/host$ mkdir build; cd build
leekwen@dell:~/hackrf/hackrf-2014.08.1/host/build$ vi build.sh
#!/bin/sh
echo "\r"
echo ">>>>>>>>>>>>>> Cmake Start <<<<<<<<<<<<<<<<<<"
echo "\r"
		cmake ../ -DINSTALL_UDEV_RULES=ON
echo "\r"
echo ">>>>>>>>>>>>>> Make Start <<<<<<<<<<<<<<<<<<"
echo "\r"
		make
echo "\r"
echo ">>>>>>>>>>>>>> Make Install <<<<<<<<<<<<<<<<<<"
echo "\r"
		sudo make install
echo "\r"
echo ">>>>>>>>>>>>>> Ldconfig Start <<<<<<<<<<<<<<<<<<"
echo "\r"
		sudo ldconfig

leekwen@dell:~/hackrf/hackrf-2014.08.1/host/build$  sh build.sh

[sudo] password for leekwen:  <<<<< 输入密码

3、Gqrx的编译过程

leekwen@dell:~/hackrf$ cd gqrx/
leekwen@dell:~/hackrf/gqrx$ mkdir build; cd build
leekwen@dell:~/hackrf/gqrx/build$ vi build.sh
#!/bin/sh
echo "\r"
echo ">>>>>>>>>>>>>> Qmake Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        qmake ../gqrx.pro
echo "\r"
echo ">>>>>>>>>>>>>> Make Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        make -j 4
echo "\r"
echo ">>>>>>>>>>>>>> Make install Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        sudo make install
echo "\r"
echo ">>>>>>>>>>>>>> Ldconfig Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        sudo ldconfig
leekwen@dell:~/hackrf/gqrx/build$ sh build.sh

[sudo] password for leekwen:  <<<<< 输入密码

4、Gr-osmosdr的编译

leekwen@dell:~/hackrf$ cd gr-osmosdr/
leekwen@dell:~/hackrf/gr-osmosdr$ mkdir build; cd build
leekwen@dell:~/hackrf/gr-osmosdr/build$ vi build.sh
#!/bin/sh
echo "\r"
echo ">>>>>>>>>>>>>> Cmake Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        cmake ../
echo "\r"
echo ">>>>>>>>>>>>>> Make Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        make -j 4
echo "\r"
echo ">>>>>>>>>>>>>> Make install Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        sudo make install
echo "\r"
echo ">>>>>>>>>>>>>> ldconfig Start <<<<<<<<<<<<<<<<<<"
echo "\r"
        sudo ldconfig
		
leekwen@dell:~/hackrf/gr-osmosdr/build$ sh build.sh

[sudo] password for leekwen:  <<<<< 输入密码

5、Rtl-sdr/的编译

leekwen@dell:~/hackrf$ cd rtl-sdr/
leekwen@dell:~/hackrf/rtl-sdr$ mkdir build; cd build
leekwen@dell:~/hackrf/rtl-sdr/build$ vi build.sh
#!/bin/sh
echo "\r"
echo ">>>>>>>>>>>>>> cmake Start <<<<<<<<<<<<<<<<<<"
echo "\r"
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
echo "\r"
echo ">>>>>>>>>>>>>> Make install Start <<<<<<<<<<<<<<<<<<"
echo "\r"
sudo make install
echo "\r"
echo ">>>>>>>>>>>>>> ldconfig Start <<<<<<<<<<<<<<<<<<"
echo "\r"
sudo ldconfig
echo "\r"
leekwen@dell:~/hackrf/rtl-sdr/build$ sh build.sh

[sudo] password for leekwen:  <<<<< 输入密码

总结:此编译过程都是参照hackrf官方网上的过程,区别可能是在环境变量安装的过程中,对几个依赖包做了版本上的调整,其它均未修改。


当然你也可以通过向一个脚本传递变量方式去编译各个包,这样就不用每次都做切换了。

HackRF初次接触