nginx嵌入式移植
nginx嵌入式板卡移植
1, 交叉编译PCRE库,Nginx对PCRE库有依赖,PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括Perl 兼容的正则表达式库。这些在执行正规表达式模式匹配时用与Perl 5同样的语法和语义是很有用的。
下载: pcre-8.30.tar.bz2 (参考放置路劲:/home/workspace/web)
wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.30/pcre-8.30.tar.bz2
tar -jxvf pcre-8.30.tar.bz2
chmod -Rf 777 pcre-8.30
cd pcre-8.30
./configure CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld --host=arm-linux-gnueabihf --prefix=/home/root/satellite/WEB/nginx
make
make install
2. 交叉编译Nginx,Nginx不多做解释,假设"你懂的"。
进入官网:nginx: download
补丁a:nginx-1.0.15\auto\cc\conf
case $NGX_CC_NAME in
51 arm-linux-gnueabihf-gcc)
52 # gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
53 # 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
54 # 4.0.0, 4.0.1, 4.1.0
55
56 . auto/cc/gcc
57 ;;
补丁b-1:nginx-1.0.15\auto\types\sizeof
----------------------------------------
checking for $ngx_type size
END
## Modify By XinTinG
ngx_size=4
补丁b-2:nginx-1.0.15\auto\types\sizeof
##ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
## -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
##eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
##if [ -x $NGX_AUTOTEST ]; then
## ngx_size=`$NGX_AUTOTEST`
## echo " $ngx_size bytes"
##fi
补丁c:nginx-1.0.15\auto\feature
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
## if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
## else
## echo " found but is not working"
## fi
;;
补丁d:nginx-1.0.15\configure
if test -z "$NGX_PLATFORM"; then
echo "checking for OS"
## NGX_SYSTEM=`uname -s 2>/dev/null`
## NGX_RELEASE=`uname -r 2>/dev/null`
## NGX_MACHINE=`uname -m 2>/dev/null`
补丁e:nginx-1.0.15\src\os\unix\ngx_time.h
#include <time.h> #HCF
#include <ngx_config.h>
#include <ngx_core.h>
补丁f:nginx-1.0.15\src\os\unix\ngx_errno.h
#define NGX_EILSEQ EILSEQ
#define NGX_ENOMOREFILES 0
#define NGX_SYS_NERR 1 // Modify By HCF
补丁g:nginx-1.0.15/auto/cc/name
补丁h:nginx-1.0.15\objs\Makefile
操作:
export CC=arm-linux-gnueabihf-gcc
export LD=arm-linux-gnueabihf-ld
export AR=arm-linux-gnueabihf-ar
export NGX_SYSTEM=linux
export NGX_RELEASE=3.2-XT5
export NGX_MACHINE=arm
./configure --with-http_stub_status_module --prefix=/home/root/satellite/WEB/nginx --with-pcre=/home/workspace/web/pcre-8.30 --with-cc-opt="-O2 -Wall -Wpointer-arith -I/home/root/satellite/WEB/nginx/include" --with-ld-opt="-L/home/root/satellite/WEB/nginx/lib" --without-http_gzip_module
make CPU=arm
make install
cd /home/root/satellite/WEB/
tar -zcvf nginx.tar.gz nginx
nginx.tar.bz2 解压到arm板linux shell控制台中home/root/satellite/WEB文件夹;
/home/root/satellite/WEB/nginx/conf/nginx.conf
user root;
http {
#access_log logs/access.log main;
access_log off;
error_log /dev/null;
}
更多推荐
所有评论(0)