Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6684809
  • 博文数量: 1159
  • 博客积分: 12444
  • 博客等级: 上将
  • 技术积分: 12570
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-13 21:34
文章分类

全部博文(1159)

文章存档

2016年(126)

2015年(350)

2014年(56)

2013年(91)

2012年(182)

2011年(193)

2010年(138)

2009年(23)

分类: 嵌入式

2011-11-01 16:20:53

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

 

<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 </span> </span> <span class="SourceText"><span style="font-size: 11pt; font-family: 新宋体; color: fuchsia;" lang="EN-US">test</span> </span> <span class="SourceText"><span style="font-size: 11pt; font-family: 新宋体; color: fuchsia;" lang="EN-US">/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


阅读(1821) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~