OpenWrt 交叉编译 openssl 库

OpenWrt 交叉编译 openssl 库

参考 这里

先下载 OpenSSL 的源代码并解压缩到某个目录, 然后在这里下载 mipsel patch

打 Patch
patch -Np1 -i openssl-1.0.1e-mips_support-1.patch

生成 Makefile:
./Configure linux-mipsel

默认会生成静态库文件 (.a), 如果需要编译成动态库 (.so), 加上 shared 参数:
./Configure linux-mipsel shared

修改 Makefile: 将 cc = gcc 改为
cc = mipsel-openwrt-linux-uclibc-gcc

修改 crypto/modes/Makefile
There is an error in Makefile of crypto/modes:
at line 26-27
LIBOBJ= cbc128.o ctr128.o cts128.o cfb128.o ofb128.o gcm128.o \
ccm128.o xts128.o $(MODES_ASM_OBJ)
MODES_ASM_OBJ=fPIC and shouldn't be there since it is not a target but a compile options.
I removed $(MODES_ASM_OBJ) and it worked.


编译好的库在 OpenSSL 源码根目录 (libssl.a/so, libcrypto.a/so). 所需的头文件在 include/ 目录下.

comments powered by Disqus