为小米路由器MINI的OPENWRT系统交叉编译能读PCSC卡的OSCAM

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/shaowl111/article/details/88838397

关键词:ubuntu miwifi-mini openwrt oscam crosscompiling

1、安装 Ubuntu:
我所使用的是最新版的 18.04.2 LTS(64位)的系统。
然后安装所需的软件包:gcc make vim dialog subversion。
具体还有哪些,记不清了,后续需要时再加装也没关系。

2、下载路由器的 SDK 包:
主流路由器的openwrt的SDK开发包可在openwrt官网上找到下载,小米路由器mini版对应的最新的SDK包是:
wget https://downloads.openwrt.org/snapshots/targets/ramips/mt7620/openwrt-sdk-ramips-mt7620_gcc-7.4.0_musl.Linux-x86_64.tar.xz
下载完后,解压,移到主目录中,为方便后续使用,可更名为mt7620。

3、下载 oscam :
svn checkout http://www.streamboard.tv/svn/oscam/trunk oscam

4、下载oscam所需的 openssl、libusb、pcsc-lite:
wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz
wget http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/pcsc-lite/1.8.10-1ubuntu1/pcsc-lite_1.8.10.orig.tar.bz2

5、设置环境变量:
export TOOLCHAIN=/home/yourusername/mt7620/staging_dir/toolchain-mipsel_24kc_gcc-7.4.0_musl
export PATH="$TOOLCHAIN/bin:$PATH"
export STAGING_DIR=/home/yourusername/mt7620/staging_dir
export CC=$TOOLCHAIN/bin/mipsel-openwrt-linux-musl-gcc
export RANLIB=$TOOLCHAIN/bin/mipsel-openwrt-linux-musl-ranlib
路径根据实际的位置修改

6、编译安装 openssl/libsrypto:
tar -xf opensll-1.0.2r.tar.gz
cd openssl-1.0.2r
./Configure --prefix=$TOOLCHAIN/usr/ linux-generic32 shared 
make
sudo make install

7、编译安装 libusb:
tar -xf libusb-1.0.9.tar.bz2
cd libsub-1.0.9
./configure --prefix=$TOOLCHAIN/usr/ --host=mipsel-openwrt-linux --enable-shared=no
make
sudo make install

8、编译安装 pcsc:
tar -xf pcsc-lite_1.8.10.orig.tar.bz2
cd pcsc-lite-1.8.10
./configure --disable-libudev --host=mipsel-openwrt-linux --prefix=$TOOLCHAIN/usr --exec-prefix=$TOOLCHAIN/usr --disable-shared LIBUSB_LIBS="-L$TOOLCHAIN/usr/lib -lusb-1.0" LIBUSB_CFLAGS="-I$TOOLCHAIN/usr/include/libusb-1.0"
make
sudo make install

9、编译 oscam:
进入oscam目录,做相关配置
cd oscam
make config
然后设置一个包含路径之后,再执行交叉编译命令
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$TOOLCHAIN/usr/include
make CROSS=$TOOLCHAIN/bin/mipsel-openwrt-linux-musl- CONF_DIR=/etc/oscam/config/ USE_LIBUSB=1 LIBUSB_LIB="$TOOLCHAIN/usr/lib/libusb-1.0.a -lrt" USE_PCSC=1 USE_SSL=1 EXTRA_FLAGS="-I$TOOLCHAIN/usr/include/PCSC"

参考文献:
http://www.streamboard.tv/oscam/wiki/crosscompiling
https://wenku.baidu.com/view/b51048b7011ca300a7c39007.html
 

展开阅读全文

没有更多推荐了,返回首页