mips移植openssl,生成库文件及头文件

虚拟机环境:Ubuntu16.04 64位
目标板环境:mips Linux 32位
准备:
1°. openssl官网下载openssl软件包(本人使用版本:openssl1.0.2g)
2°. 安装好交叉编译工具
1. config

JoshYueby@ubuntu:~soft/soft-package/openssl$ cd openssl-1.0.2g
JoshYueby@ubuntu:~soft/soft-package/openssl$ setarch i386 ./config --cross-compile-prefix=mips-openwrt-linux- shared no-asm

命令参数解释:
1.1. 解决Floating point exception 浮点错误问题
在 ./config 命令前加上了“setarch i386”命令,在64位系统上设置编译出32位版本的库。
1.2. 指定交叉编译工具
–cross-compile-prefix=mips-openwrt-linux-,指定交叉编译工具为:mips-openwrt-linux-
2. 修改openssl-1.0.2g文件夹下的Makefile
a. 删除-march=pentinum,我这是1.0.2g版本并没有发现,所以就不做处理了;
b. 修改linux-x86_64为mips;
c. 删除-m64。
3. make
在当前目录命令行下,make一下,得到相关的.a及.so库文件
4. 得到头文件
输入以下命令,得到openssl的头文件

JoshYueby@ubuntu:~soft/soft-package/openssl$ cd openssl-1.0.2g/include
JoshYueby@ubuntu:~soft/soft-package/openssl/openssl-1.0.2g/include$ mkdir openssl-inc
JoshYueby@ubuntu:~soft/soft-package/openssl/openssl-1.0.2g/include$ cd openssl-inc
JoshYueby@ubuntu:~soft/soft-package/openssl/openssl-1.0.2g/include/openssl-inc/$ cp ../../crypto/aes/aes.h ../../crypto/asn1/asn1.h ../../crypto/asn1/asn1_mac.h ../../crypto/asn1/asn1t.h ../../crypto/bio/bio.h ../../crypto/bf/blowfish.h ../../crypto/bn/bn.h ../../crypto/buffer/buffer.h ../../crypto/camellia/camellia.h ../../crypto/cast/cast.h ../../crypto/cmac/cmac.h ../../crypto/cms/cms.h ../../crypto/comp/comp.h ../../crypto/conf/conf_api.h ../../crypto/conf/conf.h ../../crypto/crypto.h ../../crypto/des/des.h ../../crypto/des/des_old.h ../../crypto/dh/dh.h ../../crypto/dsa/dsa.h ../../crypto/dso/dso.h ../../ssl/dtls1.h ../../crypto/ebcdic.h ../../crypto/ecdh/ecdh.h ../../crypto/ecdsa/ecdsa.h ../../crypto/ec/ec.h ../../crypto/engine/engine.h ../../e_os2.h ../../crypto/err/err.h ../../crypto/evp/evp.h ../../crypto/hmac/hmac.h ../../crypto/idea/idea.h ../../crypto/krb5/krb5_asn.h ../../ssl/kssl.h ../../crypto/lhash/lhash.h ../../crypto/md4/md4.h ../../crypto/md5/md5.h ../../crypto/mdc2/mdc2.h ../../crypto/modes/modes.h ../../crypto/objects/objects.h ../../crypto/objects/obj_mac.h ../../crypto/ocsp/ocsp.h ../../crypto/opensslconf.h ../../crypto/opensslv.h ../../crypto/ossl_typ.h ../../crypto/pem/pem2.h ../../crypto/pem/pem.h ../../crypto/pkcs12/pkcs12.h ../../crypto/pkcs7/pkcs7.h ../../crypto/pqueue/pqueue.h ../../crypto/rand/rand.h ../../crypto/rc2/rc2.h ../../crypto/rc4/rc4.h ../../crypto/ripemd/ripemd.h ../../crypto/rsa/rsa.h ../../crypto/stack/safestack.h ../../crypto/seed/seed.h ../../crypto/sha/sha.h ../../crypto/srp/srp.h ../../ssl/srtp.h ../../ssl/ssl23.h ../../ssl/ssl2.h ../../ssl/ssl3.h ../../ssl/ssl.h ../../crypto/stack/stack.h ../../crypto/symhacks.h ../../ssl/tls1.h ../../crypto/ts/ts.h ../../crypto/txt_db/txt_db.h ../../crypto/ui/ui_compat.h ../../crypto/ui/ui.h ../../crypto/whrlpool/whrlpool.h ../../crypto/x509/x509.h ../../crypto/x509v3/x509v3.h ../../crypto/x509/x509_vfy.h ./

则所有的头文件即在 openssl-1.0.2g/include/openssl-inc/文件夹内,
库文件则在openssl-1.0.2g文件夹中,主要有以下几个:libssl.so.1.0.0 libcrypto.so.1.0.0 libssl.a libcrypto.a ibssl.so libcrypto.so
注:ibssl.so libcrypto.so分别由libssl.so.1.0.0 libcrypto.so.1.0.0两个库ln -s得来,可以直接拷贝使用。
参考博客:
https://blog.csdn.net/dancer__sky/article/details/78718100
https://blog.csdn.net/BoArmy/article/details/8652927

你可能感兴趣的:(openWRT学习)