boa-0.94.13 移植到 ARM

http://blog.csdn.net/furtherchan/article/details/5702187

1. 程序移植

      2. 配置

      3. 测试

 

1. 程序移植

 

  <1> 解压源码,配置

furtherchan@further:~/work/boa_porting/boa-0.94.13$ src/configure

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim Makefile

CC = arm-linux-gcc

CPP = arm-linux-gcc -E

 

<2> 编译

furtherchan@further:~/work/boa_porting/boa-0.94.13$ make

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o y.tab.o y.tab.c

src/boa_grammar.y:30:19: error: parse.h: No such file or directory

y.tab.c: In function 'yyparse':

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim src/boa_grammar.y

       # 出错,修改头文件包含路径。

 

flex  src/boa_lexer.l

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o lex.yy.o lex.yy.c

src/boa_lexer.l:28:19: error: parse.h: No such file or directory

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim src/boa_lexer.l

# 出错,修改头文件包含路径。

 

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o util.o src/util.c

src/util.c:100:1: error: pasting "t" and "->" does not give a valid preprocessing token

make: *** [util.o] Error 1

  # 去掉其中(./src/compat.h)的 ”##”

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim src/compat.h


furtherchan@further:~/work/boa_porting/boa-0.94.13$ make

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o util.o src/util.c

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o sublog.o src/sublog.c

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o timestamp.o src/timestamp.c

arm-linux-gcc  -o boa y.tab.o lex.yy.o alias.o boa.o buffer.o cgi.o cgi_header.o config.o escape.o get.o hash.o ip.o log.o mmap_cache.o pipe.o queue.o read.o request.o response.o select.o signals.o util.o sublog.o timestamp.o -g

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o index_dir.o src/index_dir.c

arm-linux-gcc  -o boa_indexer index_dir.o escape.o -g

  # 编译成功

 

furtherchan@further:~/work/boa_porting/boa-0.94.13$ file boa

boa: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped

furtherchan@further:~/work/boa_porting/boa-0.94.13$ arm-linux-strip boa

furtherchan@further:~/work/boa_porting/boa-0.94.13$ file boa

boa: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, stripped

 

2. 配置

 

<1> 配置 boa.conf ,如下

Port 80

User 0

Group 0

ErrorLog /var/boa_error_log

DocumentRoot / var/ www

UserDir public_html

DirectoryIndex index.html

DirectoryMaker /usr/lib/boa/boa_indexer

KeepAliveMax 1000

KeepAliveTimeout 10

MimeTypes /etc/mime.types

DefaultType text/plain

CGIPath /bin:/usr/bin:/usr/local/bin

Alias /doc /usr/doc

ScriptAlias /cgi-bin/ / var/ www/cgi-bin/

ServerName www.your.org.here

 

<2> 配置开发板环境

创建目录

furtherchan@further:~/rootfs$ mkdir etc/boa

furtherchan@further:~/rootfs$ mkdir /var/ www

furtherchan@further:~/rootfs$ mkdir /var/ www/cgi-bin

拷贝文件

furtherchan@further:~/rootfs$ cp /home/furtherchan/work/boa_porting/boa-0.94.13/boa.conf ./etc

furtherchan@further:~/rootfs$ cp -v /home/furtherchan/work/boa_porting/boa-0.94.13/boa ./bin

furtherchan@further:~/rootfs$ cp /etc/mime.types ./etc

 

3. 测试

<1> 程序

 

# include < stdio . h >
# include < stdlib . h >
int main ( void )
{
  
printf ( "Content-type: text/html/n/n" );
  
printf ( "/n" );
  
printf ( "CGI test /n" );
  
printf ( "/n" );
  
printf ( "

Hello,world.

/n" );
  
printf ( "/n" );
  
printf ( "/n" );
  
exit ( 0 );
}

furtherchan@further:~/rootfs/www/cgi-bin$ arm-linux-gcc -o hello hello.c

 

<2> 打开网页

http:// 板子 IP/cgi_bin/hello


<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(718) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
原文地址:https://www.cnblogs.com/ztguang/p/12647369.html