本文章基于 CentOS7 进行安装

GK2A是韩国气象卫星之一,由韩国气象厅开发,KARI制造,于2018年12月4日由欧洲航天局的阿丽亚娜5号将其送上轨道,属于地球同步卫星。

基础环境安装

yum install -y epel-release
yum install -y wget git lrzsz zip unzip screen
yum install -y make automake gcc gcc-c++ kernel-devel cmake3 zlib-devel

yum install -y centos-release-scl
yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++
scl enable devtoolset-8 -- bash

禁用防火墙, 或者自己放行端口

systemctl disable firewalld
systemctl stop firewalld

安装 LibUSB

如果未安装LibUSB,编译RTL-SDR驱动会出现如下错误

-- Checking for module 'libusb-1.0'
--   Package 'libusb-1.0', required by 'virtual:world', not found
CMake Error at CMakeLists.txt:88 (message):
  LibUSB 1.0 required to compile rtl-sdr

对于Ubuntu与Debian等系统可以尝试使用如下命令进行安装

sudo apt-get install libusb-1.0-0.dev

或者找到对应你系统版本的 libusbx-devel 手动安装

https://pkgs.org/search/?q=libusbx-devel

对于和我一样在CentOS 7的同学可以使用如下方式安装

# 首先下载该RPM包
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libusbx-devel-1.0.21-1.el7.x86_64.rpm
# 安装RPM包
yum install -y libusbx-devel-1.0.21-1.el7.x86_64.rpm

从源码编译 librtlsdr

git clone https://github.com/steve-m/librtlsdr.git
cd librtlsdr && mkdir build && cd build
# 如果 cmake 提示找不到命令请尝试使用 cmake3
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINSTALL_UDEV_RULES=ON ..
sudo make -j2 install

# Load udev rules and blacklist the DVB driver shipped with the OS
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/
sudo ldconfig
echo 'blacklist dvb_usb_rtl28xxu' | sudo tee --append /etc/modprobe.d/blacklist-dvb_usb_rtl28xxu.conf
sudo reboot

从源码编译 goesrecv

git clone --recursive https://github.com/sam210723/goestools
cd goestools && mkdir build && cd build
# 如果这一步出现找不到 libairspy 请查看 错误1, 如果 cmake 提示找不到命令请尝试使用 cmake3
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
sudo make && sudo make install
cd ~
cp goestools/etc/goesrecv.conf goesrecv.conf

# 编辑 goesrecv.conf 文件
[demodulator]
satellite = "GK-2A"
downlink = "lrit"
source = "rtlsdr"

# [airspy]
# frequency = 1692140000
## 2500000 for the R2, 3000000 for the Mini
# sample_rate = 3000000
# gain = 18
# bias_tee = false

[rtlsdr]
frequency = 1692140000
# sample_rate = 1024000
# gain = 30
# bias_tee = false
# device_index = 0

# 运行
goesrecv -v -i 1 -c goesrecv.conf
错误 1 (由于未找到适用于红帽系的 libairspy 包,如果出现如下错误,请在 CMakeLists 里将 libairspy 检查注释掉)
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3") 
-- Checking for module 'libairspy'
--   Package 'libairspy', required by 'virtual:world', not found
CMake Warning at src/goesrecv/CMakeLists.txt:14 (message):
  Unable to find libairspy


-- Checking for module 'librtlsdr'
--   Found librtlsdr, version 0.6.0-31-ga4ea
-- Configuring done
-- Generating done
-- Build files have been written to: /root/goestools/build
vim ~/goestools/src/goesrecv/CMakeLists.txt

12 - 18 行注释掉
#pkg_check_modules(AIRSPY libairspy)
#if(NOT AIRSPY_FOUND)
#  message(WARNING "Unable to find libairspy")
#else()
#  add_library(airspy_source airspy_source.cc)
#  target_link_libraries(airspy_source ${AIRSPY_LIBRARIES} publisher stdc++)
#endif()

63 - 66 行注释掉
#if(AIRSPY_FOUND)
#  target_compile_definitions(goesrecv PUBLIC -DBUILD_AIRSPY)
#  target_link_libraries(goesrecv airspy_source)
#endif()

运行 goesrecv 测试是否有输出

[root@localhost ~]# goesrecv -v -i 1 -c goesrecv.conf
Found Rafael Micro R820T tuner
Disabled direct sampling mode
[R82XX] PLL not locked!
2021-08-29T11:54:14Z [monitor] gain: 12.20, freq:   254.0, omega: 18.750, vit(avg): 2077, rs(sum):    0, packets:  0, drops:  4
2021-08-29T11:54:15Z [monitor] gain: 25.02, freq:  2958.7, omega: 18.750, vit(avg): 2086, rs(sum):    0, packets:  0, drops:  5
2021-08-29T11:54:16Z [monitor] gain: 30.72, freq:  7250.1, omega: 18.750, vit(avg): 2090, rs(sum):    0, packets:  0, drops:  4
2021-08-29T11:54:17Z [monitor] gain: 33.04, freq: 13950.2, omega: 18.751, vit(avg): 2094, rs(sum):    0, packets:  0, drops:  6
2021-08-29T11:54:18Z [monitor] gain: 34.16, freq: 19201.4, omega: 18.750, vit(avg): 2099, rs(sum):    0, packets:  0, drops:  5
2021-08-29T11:54:19Z [monitor] gain: 34.79, freq: 21535.1, omega: 18.750, vit(avg): 2101, rs(sum):    0, packets:  0, drops:  5

xrit-rx 安装

wget https://github.com/sam210723/xrit-rx/releases/latest/download/xrit-rx.zip
mkdir xrit-rx
unzip xrit-rx.zip -d xrit-rx
解码 GK2A 的数据需要用到密钥
解密后生成的密钥名为 EncryptionKeyMessage.bin
cd xrit-rx
wget --no-check-certificate https://c.ibcl.us/GK2A-Decode_20190811/EncryptionKeyMessage_001F2904C905.bin
python3 ../tools/keymsg-decrypt.py EncryptionKeyMessage_001F2904C905.bin 001F2904C905

安装 Python3

sudo yum install python34
cd xrit-rx
pip3 install -r requirements.txt -i https://pypi.douban.com/simple

通过 screen 后台运行

# 请自行查阅screen用法, 这里不过多赘述
screen -S goestools
cd ~
goesrecv -v -i 1 -c goesrecv.conf

screen -S xrit-rx
cd xrit-rx && python3 xrit-rx.py

测试

浏览器输入 http://ip:1692 访问 web 控制台

最后修改:2021 年 11 月 03 日 04 : 02 PM
如果觉得我的文章对你有用,请随意赞赏