openssl for uclinux(嵌入式系统中使用openssl)

来源:互联网 发布:中国软件外包网 编辑:程序博客网 时间:2024/06/03 20:49

Openssl for uclinux

Software Enviroment

OpenSuse 10.0 Linux
 arm-elf toolchains  
OpenSSL 0.9.7c Compiling
1.donwload OpenSSL  0.9.7c from openssl.org2.  download the patch for uclinux:
http://ftp.snapgear.org/pub/patches/openssl-0.9.7c.diff
http://ftp.snapgear.org/pub/patches/openssl-0.9.7c_linux_include.diff
http://ftp.snapgear.org/pub/patches/openssl-0.9.7c_makefile.diff

install openssl(we assume the current working directory: uClinux-dist):

cd lib
tar zxvf ~/tmp/openssl-0.9.7c.tar.gz
mv openssl-0.9.7c libssl
cd libssl
patch -p1 < ~/tmp/openssl.diff

patch the linux kernel:

cd linux-2.4.x/include/openssl
patch -p0 < ~/tmp/openssl_linux_include.diff

patch the openssl makefile.

cd user/openssl
patch -p0 < ~/tmp/openssl_makefile.diff

3. run the configure under the openssl source directory
./configure linux-elf-arm no-shared

4.modify Makefile
replace CC = gcc with CC = arm-elf-gcc
add “-D__PIC__ -fpic -msingle-pic-base -Wl,-elf2flt” to CFLAGS

5. make
6. now we have  libssl.a and libcrypto.a in the source directory
7.copy the include and lib files to the arm-elf toolchains directory

Add the Openssl lib in your applications
add “-D__PIC__ -fpic -msingle-pic-base -Wl,-elf2flt” to the CFLAGS,

add –lssl  –lcrypto to LDFLAGS

that is all :)

这篇文章不是我原创的,是参考了很多国外的资料而成的,最后一部分如何正确的在uclinux使用openssl是我加的。本文发在我的blog上: http://www.info-life.cn  或是参考http://www.info-life.cn/?p=22
原创粉丝点击