How to cross-compile OpenSSL for ARM

In a nutshell:
/opt/arm% wget http://www. openssl.org/source/ openssl-0.9.7d.tar.gz && tar xvzf openssl-0.9.7d.tar.gz && cd openssl-0.9.7d
/opt/arm/openssl-0.9.7d% ./Configure linux-elf- arm --prefix=/usr
Then set your environment so a gcc 3.3-based ARM crosscompiler (OpenZaurus 3.3.1 in /usr/local/ arm/3.3 will be fine) is in your $PATH, and patch your Makefile to use this cross-compiler (the patch also contains a linking instruction to libdl, needed to get the openssl binary):
/opt/arm/openssl-0.9.7d% export PATH=/usr/local/ arm/3.3/bin:$PATH
/opt/arm/openssl-0.9.7d% wget -N http://people.via.ecp.fr/~clem/nist/ opensslFor ARM.Makefile.patch && patch -p1 < opensslFor ARM.Makefile.patch
You can compile it now! (after setting DISTCC to /usr/bin/distcc, DISTCC_HOSTS to your distcc hosts, and using make -j DISTCC_HOSTS*2, for example, instead of make to distribute compiling if you want and can):
/opt/arm/openssl-0.9.7d% make && make build-shared
You can do the following if you want (that way /opt/arm/openssl will be your local OpenSSL dir, its includes will be in include and its libs in lib):
/opt/arm/openssl-0.9.7d% mkdir lib && cd lib && ln -s ../libcrypto* ../libssl* . && cd ../.. && ln -s openssl-0.9.7d openssl

你可能感兴趣的:(gcc,Path,include,makefile,patch)