一、环境配置
操作系统:
Ubuntu 18
硬件:
hackrf
- 第一步 配置国内源
备份 /etc/apt/sources.list
文件
sudo mv /etc/apt/sources.list /etc/apt/sourses.list.backup
sudo touch /etc/apt/sources.list && sudo gedit /etc/apt/sources.list
然后把选择如下源中的一个复制进去。
#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#阿里云源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
更新软件源和系统
sudo apt-get update
sudo apt-get upgrade
- 第二步 配置环境
sudo apt-get install gnuradio hackrf libhackrf-dev gqrx-sdr rtl-sdr gr-osmosdr osmo-sdr libusb-1.0
二、升级驱动&&固件
- 升级驱动
配置好环境后,输入 hackrf_info
,如果出现下图所示,hackrf_info version
和 libhackrf version
都是未知的,说明系统安装的驱动版本和 hackrf one
的固件版本不匹配,需要升级驱动。
从该网址 https://github.com/mossmann/hackrf/releases 下载最新的版本(这里的版本是2018.01.1,需要找到对应的版本,不过很建议升级到最新固件)
# 解压
xz -d hackrf-2018.01.1.tar.xz
tar xvf hackrf-2018.01.1.tar
# 安装
cd hackrf-2018.01.1/host
mkdir build && cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
- 升级固件
如果 Firmware Version
的版本比较老,需要更新固件。进入firmware-bin
目录,执行以下操作
# 更新Flash
Flash hackrf_spiflash -w hackrf_one_usb.bin
# 更新CPLD
hackrf_cpldjtag -x hackrf_cpld_default.xsvf
更新后,按一下hackrf
的 reset
键,或者拔了USB线后重新再插上,输入 hackrf_info
可以看到驱动版本号。说明安装成功。